I have a simpleLinePlot that I would like to clear from a popup menu option. I'd like to remove all the datapoints and start a new graph.
I do the following:
1) Change my dataset to a newly initialized dataset 2) remove the old plot from the chartview 3) add a new simpleLinePlot with the newly formed dataset 4) add the plot to the chartview 5) repaint
This doesn't work - the plot still shows the old data. Is there a simpler way of doing this?
That doesn't make sense. I don't want to remove my axes and grid lines. I only want to clear out the datapoints and start the graph over. Is there another method to call that will just clear out the datapoints in the dataset and leave the graph untouched in terms of layout?
Actually it shouldn't make much of a difference. Everything is going to be redrawn anyway. If you want to re-autoscale and re-autoaxes the chart you might as well just clear it and start over.
But, if you don't want to do it that way, see item #7 in the FAQ section: How do you update charts in real-time?
There is no need to remove the old line plot. Just create the new dataset, change the dataset of the line plot to the new one. Then call the ChartView updateDraw method. Look at the examples in the DynamicCharts example program.