-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems when updating chart through echartsInstance.setOption() #6202
Comments
I have the same problem recently , i solved it by set the series's |
Thanks for your suggestions! Setting And, using |
This is still a problem. And a very annoying one. I'd call it a bug rather than an enhancement, since it's a very big problem when dealing with realtime data (calling setOption frequently) and building the chart from data in React. :) |
I have the same problems and I agree with @sorenhoyer: I would also call it a bug. It should be possible to delete series with setOptions |
+1 |
2 similar comments
+1 |
👍 |
setOption() is still leaving the old data on the chart BTW. |
+1 |
Until this is solved, I've come with the radical solution of clearing the chart and "recreate" it again. Basically: |
I have the same issue with bar chart |
+1! |
This sounds like a bug to me, if you can add a series via Clicking on Clicking on |
@100pah I've noticed you added the |
+1 |
2 similar comments
+1 |
+1 |
Same issue here. To resolve it I set |
It does not solve the problem for me. |
This is a bug |
I've solved it creating two functions one only with myChart.clear and another for draw all the chart and allways first call de function wich clear the chart and after the ones for draw it. |
I solved it by storing the options in a variable and doing the merge by myself :/ |
But you still nee the clear() call before setting your merged result, correct? |
To me this is a serious defect, as it kills most of the animation feature from echarts, when morphing across changes. Doing a clear() inbetween all updates is destroying most of the nice rendering effects. |
Nearly two years and still no response to this. This isn't an "enhancement" ... it's an extremely annoying and show stopping bug. Any idea on when this will be resolved? All these hacky solutions are mediocre at best and leave the potential for a future update to Echarts that fixes the problem to break the solution users have come up with on their own. |
I tried all the suggested hacks listed above but I am getting the same error. I am using socket.io to update the data but I have no idea how to approach this issue after trying the suggested hacks. Any suggestions what the underlying cause of this problem might by? |
This issue has been a high priority since 2019.... please... I fixed it in fixIssue6202Echart() {
//Fix: https://github.com/apache/echarts/issues/6202
if (this.$refs.yourChart) this.$refs.yourChart.setOption(this.datas, true);
}
|
So is there a recommended way by now to remove a Series from the Chart, without losing every other config option? |
Just ran into a similar bug when changing axis names and using |
Sorry to be late here. 5.0 introduces a new parameter https://echarts.apache.org/en/api.html#echartsInstance.setOption Example usage: myChart.setOption({
series: newSeriesHere
}, { replaceMerge: ['series'] }) |
A pending bug from 5 years ago in high priority, and it is still not fixed ... |
@marccompte Please see my comment above |
I tried that but did not work. I'm trying other chart libraries now. |
@marccompte I have struggled with the same issue, chart.setOption(options, {
replaceMerge: ["series", "yAxis", "xAxis", "grid"],
}); |
This help for me <3 |
I felt some cases above might relate to this issue #14192 , where the seettings of components like axis need passed to setOption() to trigger relevant graph redraw correctlly. I was using 5.3.2 and that issue still exists. |
Is there any news for this issue. Recently I got issue that cannot change the symbolSize of the lines series. Not sure that relates to this issue. |
for someone who may meet this problem, you may have wrapped a component like this: useEffect(() => {
if (!chartInstanceRef.current) return;
chartInstanceRef.current?.setOption(option, { notMerge: true }); // set notMerge true
}, [options]) |
the problem is still present |
Yeah, I’m still experiencing this problem. |
Are there any updates? |
Thanks, I have this problem with echart 5.4.4 too |
Using
|
This issue is still relevant... Luckily setting |
When updating the charts through
echartsInstance.setOption()
, the series are not always correctly updated/drawn.For example, when I initialize the chart (custom made funnel, but this happens with every chart type) with 3 series, it may look like this:
It shows 3 series, which all display correctly. Now, when I create a new chart object with 6 series, and overwrite my current chart, it changes (and animates) to:
This, also, looks good. The problem is when updating again, to a chart with less series then the current chart. See what happens when I update the chart to 3 series:
It draws the 3 new series over the first old 3 series, and keeps series 4, 5 and 6.
When I output the chart object to console, it shows:
There is not a single mention of "Motorola", "Huawei" or "Overig" in my code, but, when I add console.log(params) to
charts.tooltip.formatter
, it shows:So, they are not in my chart object, but Echarts still draws them, and as you can see, they still exist in the tooltip params.
The chart does update well when using
chartInstance.clear()
beforechartInstance.setOption()
, but then I'll lose all the nice transitions and animations, which make ECharts look so beautiful.The text was updated successfully, but these errors were encountered: