A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
ndhai
- Posts: 10
- Joined: Thu Jun 05, 2008 2:00 pm
Post
by ndhai » Thu Jun 05, 2008 2:08 pm
Hello
I would like to do one chart that has somes series
my problem: number of serie is unknow before
could I do some think link that:
Code: Select all
XYSeries seriesS = null;
Hashtable hSeries = new Hashtable();
for (i = 1 >>>>>>>>> S) {
seriesS = new XYSeries("Serie " + i);
hSeries ("" + i, seriesS );
// add some values here ..
seriesS .add( X, Y);
}
and then
Code: Select all
XYSeriesCollection dataset = new XYSeriesCollection();
seriesS = (XYSeries)hSeries .get("1");
dataset.addSeries(seriesS );
seriesS = (XYSeries)hSeries .get("2");
dataset.addSeries(seriesS );
thanks for your helps
best regards
ndhai[/code]
-
ndhai
- Posts: 10
- Joined: Thu Jun 05, 2008 2:00 pm
Post
by ndhai » Thu Jun 05, 2008 2:39 pm
I have just tested
it works well
thanks everyway
ndhai
-
paradoxoff
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Post
by paradoxoff » Sun Jun 08, 2008 9:03 am
Why not storing the XYSeries in the XYSeriesCollection directly? If you need to access a specific XYSeries later (for getting some data items in) you can access the XYSeries either by XYSeriesCollection.getSeries(Comparable key) or by XYSeriesCollection.getSeries(int index).
-
ndhai
- Posts: 10
- Joined: Thu Jun 05, 2008 2:00 pm
Post
by ndhai » Mon Jun 09, 2008 11:25 am
hi paradoxoff,
you are right, i forgot it
thanks a lot
nice day
ndhai