Open masalinas opened 6 years ago
@masalinas it depends on the way how you want to update the data. There are several available options.
For example, If you want to add two new points just put the following lines into your code and the chart will update and redraw automatically
table.addData([ ['2015-12-28', 511.53, 514.98, 505.79, 506.40], ['2015-12-29', 512.53, 514.88, 505.69, 507.34] ]);
If you want to update values of existing points you may use the same method 'addData()'. This method adds new points and replace values of existing points with the same key (here particularly the key is the date)
If you want to remove an interval of points from startKey to endKey you may use remove() method like this:
table.remove('2015-12-28', '2015-12-29');
If you want to remove all points it's better to remove the whole series, then create new dataTable and create new series. For example, to remove all series in your code use the following line:
chart.plot(0).removeAllSeries();
Also, you may learn more about removeAllSeries(), removeSeriesAt() and removeSeries() methods here - https://api.anychart.com/8.1.0/anychart.core.stock.Plot#removeAllSeries
Actually I have:
inde.html
index.js:
But how can i refresh the the stock chart already created with new data??