Hi
I want to display more data in igDataChart by change datasource. I use igDataChart in react project. It looks I can't show the change. Could you help to provide a sample to display change in igDataChart with react project. Thanks.
As long as you are setting the dataSource when it changes, we should react to the change. If your mutating the data source instead, then you may just need to call the notify* methods on the chart to tell us how you mutated the array. If you are already doing this, it will help if you provide an example showing the specific issue that you are facing so that we can see the issue and provide better guidance.
4745.my-app.zip
In this sample I have button to add data to the datasource. Please help to take a look. Thanks
Hi, Shengjie.
As Alan Halama suggested you - what you need is to notify the chart that the data has changed. In your sample what you need is inside the addData() method to call:
addData(){ let data= this.state.data; let index= this.state.index+1; data.push({time:String(index),value:index}); this.setState({data:data,index:index}); let lastIndex = data.length - 1; this.refs.graphic.refs.chart.igControl.notifySetItem(data, lastIndex, data[lastIndex], data[lastIndex]);}
where:
<Graphic ref="graphic"
and
<IgDataChart ref="chart"
I have attached updated sample that notifies the chart when the add button is clicked.
You can also take a look at our samples (Dashboard and Financial State), where the same is achieved, using notifySetItem() chart method. I hope that this will help you. Thank you for using our product!
Best regards,
Nikolay Alipiev
Software Developer
5468.4745.my-app.zip
Thanks. It works.