Producing a TimeSeries graph

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Producing a TimeSeries graph

Post by ahopkins » Thu Jul 20, 2006 2:18 pm

Hi,

I am trying to produce a TimeSeries graph and am currently implementing the produceDataSet() method. I have a Map of Dates,Integers which I am reading in. But, I also have a list of labels (Strings) that I need to read in which will be the names of the different lines that are produced (based on my dates and values). How do I do this? Any suggestions will be greatly appreciated.

Regards,
Andre

cringe
Posts: 54
Joined: Wed May 10, 2006 10:39 am
Location: Germany
Contact:

Post by cringe » Thu Jul 20, 2006 2:22 pm

When you create the TimeSeries for your chart, just pass in the label in the constructor http://www.jfree.org/jfreechart/api/gjd ... ies:String

That name is displayed in the legend. This is similar to XYSeriesCollection (and every other Dataset, I think).

ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Post by ahopkins » Thu Jul 20, 2006 2:46 pm

In the TimeSeries constructor I am already reading in a "chart name" for that particular graph. I am retrieving my data set points (Date,Integer) out of the DB. For each data set point I have a series label name that should be displayed on the graph. For example, my query to the DB, will produce the following type chart:

ChartName --> Series Label --> Data Set Point (Date, Integer)

So for a given ChartName I may have 1..N Series Labels, each with a Data Set Point (Date,Integer). I need to show all this on one graph.

Thanks,
Andre

cringe
Posts: 54
Joined: Wed May 10, 2006 10:39 am
Location: Germany
Contact:

Post by cringe » Thu Jul 20, 2006 2:48 pm

Do you create only one TimeSeries in your TimeSeriesCollection? Or do you want to have a label for each datapoint displayed? Like the tooltips?

ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Post by ahopkins » Thu Jul 20, 2006 2:54 pm

For a given chartName, I want to provide a single TimeSeriesCollection that takes in all of my series labels and all of the data points for those series labels. I do want a label produced for each datapoint. So, I may perform a query in the DB and my result set may have a chartname and 8 series labels, with each series label having a datapoint set.

cringe
Posts: 54
Joined: Wed May 10, 2006 10:39 am
Location: Germany
Contact:

Post by cringe » Thu Jul 20, 2006 2:58 pm

You should write your own TooltipGenerator, maybe extending StandardXYToolTipGenerator that provides the label for each datapoint. I think that's what you want to do, but I didn't understand completly what you want... :?

I'm off for today. cu tomorrow.

Locked