changing data - or datasets

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Richard

changing data - or datasets

Post by Richard » Fri Mar 07, 2003 2:58 pm

I would like to create a contour plot and set it's initial dataset a null dataset (so it won't plot). Later in the program I need to get a set of data and plot it in the plot. The user will then be allowed to get new sets of data and plot these one at a time like this:

display plot with null dataset
user gets new data
plot new dataset
user gets new data
plot new dataset
etc..

All using the same original plot instance. I'm missing something (I have the manual but it didn't address a problem like this). I've created the plot but when I change the dataset how do I get the plot to replot using the new dataset?

David Gilbert

Re: changing data - or datasets

Post by David Gilbert » Sat Mar 08, 2003 12:44 am

When you use the setDataset(...) method in the Plot class, it fires a PlotChangeEvent. The JFreeChart class receives this, and reacts by firing a ChartChangeEvent. If your chart is displayed in a ChartPanel, the panel receives the ChartChangeEvent and reacts by redrawing the chart.

If this doesn't happen, it is a bug.

Regards,

Dave Gilbert

Locked