xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.1k stars 195 forks source link

How to dynamic update the `xAxis.data` #35

Closed edgexie closed 6 years ago

edgexie commented 6 years ago

@xieziyu Thanks for your contribution. I saw there is an attribute named dataset. It can dynamic update the series. Then, I need it also can dynamic update xAxis.data, because my date is real-time who is come from socket data. Could you help me?

xieziyu commented 6 years ago

@edgexie I suggest you to use echartsInstance.setOption() directly. You can get echartsInstance in (chartInit)="onChartInit($event)"

ngx-echarts is designed to be a light directive that is simple to use and easy to extend. That means, you can build fantastic chart components based upon ngx-echarts. Maybe the directive itself won't support dynamically updating xAxis data, but you can always find a way to make it.

As mentioned above, it's easy to use setOption() to handle real-time data charts.