How to update DataSource

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jean-marie condom

How to update DataSource

Post by jean-marie condom » Wed Oct 10, 2001 5:14 pm

Hello

is it possible to update a DataSource without having
to create a new DataSource ?

I give an example : I have a float array for example :

Number[][] valuesarray=new Float[3][3];

Then I create a DefaultCategoryDataSource :
DefaultCategoryDataSource myDataSource=new DefaultCategoryDataSource(valuesarray);

and then my chart :
JFreeChart myChart=JFreeChart.createVerticalBarChart(myDataSource);

each time some values of valuesarray change I would like that myDataSource be notified instead of creating a new DefaultCategoryDataSource object as I feel obliged now writing :

mychart.setDataSource(new DefaultCategoryDataSource(valuesarray));

is there a way to avoid this new object by notifying myDataSource that valuesarray has changed ?

thanks in advance

jean-marie

David Gilbert

RE: How to update DataSource

Post by David Gilbert » Fri Oct 12, 2001 8:00 pm

Hi Jean-Marie,

Sorry - it's not possible yet. See my comment a couple of posts up the message board...which I wrote just now!

Regards,

Dave Gilbert.

John Currier

RE: How to update DataSource

Post by John Currier » Fri Oct 12, 2001 8:33 pm

If she writes her own data source (instead of using DefaultCategoryDataSource) she can just update the data source. The only "problem" is that she'll still have to call myChart.setDataSource(), but she won't have to create a new data source each time.

John

Plamen Dragozov

RE: How to update DataSource

Post by Plamen Dragozov » Thu Nov 01, 2001 3:56 pm

Look at:
http://www.jrefinery.com/forums/read.ph ... =654&t=654
Hope it would be of help for you.

Locked