Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 How do I clear a plot?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

javaman

22 Posts

Posted - 30 Oct 2008 :  20:04:59  Show Profile  Reply with Quote
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?

Thanx. Joe...

Thanx - Joe!

quinncurtis

1164 Posts

Posted - 30 Oct 2008 :  20:15:50  Show Profile  Reply with Quote
Call the ChartView ResetChartObjectList method to clear out all of the previously added chart objects. Then add the new stuff.
Go to Top of Page

javaman

22 Posts

Posted - 31 Oct 2008 :  16:32:27  Show Profile  Reply with Quote
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?

Thanx - Joe!
Go to Top of Page

quinncurtis

1164 Posts

Posted - 31 Oct 2008 :  18:08:36  Show Profile  Reply with Quote
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?

http://www.quinn-curtis.com/QCChart2DJavaFAQs.htm

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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07