You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "LanPangWang (via GitHub)" <gi...@apache.org> on 2025/03/31 10:00:54 UTC
[I] [Bug] setOption frequently will lead to legend click failure [echarts]
LanPangWang opened a new issue, #20882:
URL: https://github.com/apache/echarts/issues/20882
### Version
5.6.0
### Link to Minimal Reproduction
1
### Steps to Reproduce
when i use react useEffect to update series frequently such as every 60ms
than i can not click legend
i want to toggle legend when series update
### Current Behavior
1
### Expected Behavior
1
### Environment
```markdown
- OS:mac OS 15.3.1
- Browser: Chrome
- Framework: react 18.3
```
### Any additional comments?
const StCharts: React.FC<Props> = ({ playTime }) => {
const stContainer = useRef<HTMLDivElement>(null);
const chartRef = useRef<echarts.EChartsType | null>(null);
const handleLegendSelect = (params: any) => {
// 当图例切换时强制重渲染
console.log("chartRef==", params, chartRef.current?.getOption());
};
useEffect(() => {
if (stContainer.current) {
chartRef.current = echarts.init(stContainer.current, {
animation: false,
chartEvent: [{ type: "legendselectchanged", handler: handleLegendSelect }],
});
const option = baseOption;
option && chartRef.current.setOption(option);
}
}, []);
useEffect(() => {
if (chartRef.current) {
const chartsData = dataManager.getStData(playTime, legends);
const series = legends.map((name) => ({
data: chartsData[name] || [],
}));
chartRef.current.setOption({ series });
}
}, [playTime]); // every 60ms i will update the chart
return <Col span={12} style={{ height: "300px" }} ref={stContainer}></Col>;
};
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [I] [Bug] setOption frequently will lead to legend click failure [echarts]
Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #20882:
URL: https://github.com/apache/echarts/issues/20882#issuecomment-2770337053
user is expected to click on a chart that refreshes every 60 milliseconds ? ⚡ 💨
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org