What's the typical way to reload data, and keep other options such as 'selected label', 'data zoom'.
I'm using a websocket connection to push tick to browser. When new tick arrived, I run these code:
echart.clear();
echart.setOption({xAxis: new_option.xAxis, series: new_option.series});
echart.refresh();
The new tick is plotted in chart, but failed to keep 'selected label' and 'data zoom' status. Is there any way to plot new tick in existing chart and keep 'selected label' and 'data zoom'.
Thanks.
setOption will merge the newOption into the oldOption and refresh as the first render. None status will be kept.
so catch the EVENT.LEGEND_SELECTED and EVENT.DATA_ZOOM to get the current 'selected' and 'zoom', save it in your new_option. Reuse it when setOption again in the next tick.
Good luck. Thanks.
By the way, I had sent a email to you (@live.com), check it please :)
fuck,都是中国人,说毛鸟语啊
要有民族自豪感
哈哈~ @xiujunma 一直在外企,说不定为的就是“树立民族自豪感”要教给鸟语人看呢,别激动~ 要树立民族自豪感,提高国人在全球的技术地位或许更显重要,echarts要走出国门给鸟语人看看,整份文档还真得翻译为鸟语。 谢谢关注~ :)
是啊,echarts要走出国门!我们在弄R的接口,echarts太好了~~
@kener I solved my problem completely by adding code what you mentioned. But, I don't think it is friendly enough for dynamic chart. Anyway, thank you very much for explaining it so kindly.
期待R接口~
@taiyun I'm an R fan, and I expect R interface for echarts very soon.
我想要的动态走动效果是这样一个效果: http://jsfiddle.net/dragonfish/8wUAt/ 用setSeries更新数据会导致整个图表刷新,而不是这种平滑走动。 好像还不能实现?
上次忘了说了,
echart.clear();
echart.setOption({xAxis: new_option.xAxis, series: new_option.series});
echart.refresh();
这代码里的clear和refresh都是不必的,可以删掉
@kener Ok, thank you, got it.
check this http://efe.baidu.com/echarts/doc/example/dynamicLineBar.html
Hello when i have initial data in the chart the Echart looks fine. When i getData from the server and calculate my own new dataseries and reset the options with = nuill and with clear() i see the chart going away in the debugger, but when it is drawn i see a line from initial data set to the end of the inital dataset. And second the new datapoints have double series in the tooltip
https://ibb.co/L9pmcbN
How do i add a new dataseries to a excisting instance? This component is good, but a bit complex i think? I hope you could help me quick. I use Angular6