where i can get the sample program for each and every chart

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

where i can get the sample program for each and every chart

Post by shalinippriya » Mon Apr 15, 2002 7:39 am

Hi ,
i am new user in this forum.
in the documentation, i have seen different types of charts.
Can i get the sample program for each and every program.so that i can run it and see that.
Specifically i want to implement time series chart with all functionality like
dragging left and right , zooming..etc.
can i get it?

David Gilbert

Re: where i can get the sample program for each and every c

Post by David Gilbert » Mon Apr 15, 2002 9:46 am

The JFreeChartDemo class in the download includes an example of most chart types. There are also several other demo applications in the same directory (source/com/jrefinery/chart/demo) that focus on particular chart types.

There is a zooming facility for most chart types, but nothing for panning left and right yet.

Regards,

DG.

shalinippriya

Re: where i can get the sample program for each and every c

Post by shalinippriya » Mon Apr 15, 2002 10:53 am

hi DG,
thank u ..
in the times series chart,
BasicTimeSeries timeseries = new BasicTimeSeries("Anuual", "Year", "Value",Year.class);
timeseries.add(new Year(2002),new Double(1000));
timeseries.add(new Year(2003),new Double(2000));
timeseries.add(new Year(2004),new Double(3000));
timeseries.add(new Year(2005),new Double(4000));
timeseries.add(new Year(2006),new Double(5000));
timeseries.add(new Year(2007),new Double(6000));
timeseries.add(new Year(2008),new Double(7000));
timeseries.add(new Year(2009),new Double(8000));
timeseries.add(new Year(2010),new Double(9000));
timeseries.add(new Year(2011),new Double(10000));

i am setting the parameters like this.when i used to pass the dataset in the static method of factory,it is expecting the XYDataSet,how can i handle this..

David Gilbert

Re: where i can get the sample program for each and every c

Post by David Gilbert » Mon Apr 15, 2002 11:50 am

The TimeSeriesCollection class implements the XYDataset interface. You can add one or more BasicTimeSeries objects to a TimeSeriesCollection. If you have just one series, then you can use the constructor:

TimeSeriesCollection dataset = new TimeSeriesCollection(timeseries);
Now just pass the dataset to the chart.

Regards,

DG.

Locked