hustcc / echarts-for-react

⛳️ Apache ECharts components for React wrapper. 一个简单的 Apache echarts 的 React 封装。
https://git.hust.cc/echarts-for-react
MIT License
4.56k stars 633 forks source link

this.echarts.getEchartsInstance(...).appendData is not a function #287

Closed wiredgril666 closed 5 years ago

wiredgril666 commented 5 years ago

<ReactEcharts ref={(e)=>{this.echarts_react = e}/> , then use this.echarts_react.getInstance().appendData({seriesIndex:'1',data:newData}}, but reported Wrong TypeError: this.echarts_react.getEchartsInstance(...).appendData is not a function. My chart is also a scatter plot of the base version. I don't know why this method is not available, because my data volume is a bit large, there may be a few 100,000 to more than 1 million, so I want to use this function

hustcc commented 5 years ago

You can save data in component state, then set it into ReactEcharts.

Why you want to use appendData?

wiredgril666 commented 5 years ago

The amount of data is a bit large, it is hundreds of thousands to 1 million, so use appendData, load it in batches, and then dynamically increase it. If you use option, it may be too much rendering, then the page will be stuck.

hustcc commented 5 years ago

so save them into state, can do this.

refer: https://git.hust.cc/echarts-for-react/#/echarts/dynamic?_k=0fpo4v