Setting series names in a DefaultXYDataSource

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

Setting series names in a DefaultXYDataSource

Post by Gijs » Thu Apr 19, 2001 8:33 am

Hi,

In a DefaultCategoryDataSource it' easy to set the series names with the setSeriesNames method.
But what about the DefaultXYDataSource, the documentation says something about these being automatically generated, but nothing about changing them, and that's what I want.
I have a TimeSeriesChart with to Series in it and I want to change their names.
Could anyone help me out?

Thanks.

Gijs

Julio Guzman

RE: Setting series names in a DefaultXYDataSource

Post by Julio Guzman » Mon Apr 23, 2001 8:36 pm

Gijs,

To set the series name in the TimeSeriesChart you simply send the series names to the constructor like this:

Object graphData[][][];
String seriesNames[];


DefaultXYDataSource myData = new DefaultXYDataSource
(seriesNames, graphData);

So just set the seriesNames array to what you want your names to be. I hope that helps.
By the way, Mr. Gilbert, i apologize about telling you the applet was not posting the graph data quickly. I finally figured out how to drastically speed up my application.

Still a novice,
Julio Guzman

David Gilbert

RE: Setting series names in a DefaultXYDataSource

Post by David Gilbert » Mon Apr 23, 2001 10:53 pm

Julio,

You have correctly pointed out the only way (in version 0.5.6) to set the series names in DefaultXYDataSource - thanks for posting the answer.

My intention was for DefaultXYDataSource to work the same way as DefaultCategoryDataSource so I've modified the source by copying the setSeriesNames() method from DefaultCategoryDataSource. That should allow the series names to be changed even after the data source is created.

Regards,

DG.

Locked