Hi,
I have been using JFreeChart for 1 year and am impressed with the easy and the quality of graph also the documentation (need some improvement).
Lately I stumbled on a problem and I cannot find a solution ….
Problem: Need for a Stacked Area Time Series chart.
Good example for this is under Area Charts --> StackedXYAreaChartDemo1.java (this does not use timeseries dataset). However, I need timeseries DataSet (like the one under Area Chart --> XYAreaChartDemo2.java)
So can someone tell me/direct me how to replace TableXYDataset to IntervalXYDataSet and use it in JFreeChart chart = ChartFactory.createStackedXYAreaChart(……
Or
Any other solutions that will help me resolve this.
Thanks
Zack
Using TimeSeries in StackedArea Chart (StackedXYAreaChartDem
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Have a look at StackedXYAreaChartDemo3.java.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


StackedXYAreaChartDemo3.java does not support TimeSeries Dataset (my data could be in seconds,days,weeks,months,years).
I was able to create Stacked Area chart from ChartFactory.createXYAreaChart(with TimeSeries dataset as Second.class). I faced problem while setting the color of stacked chart.
Note: the code below successfully set the color for legend but failed to set the color for stacked area.
renderer.setSeriesPaint(0, Color.GREEN);
Do I have to something special to set the color for stacked area?
Thanks,
Zack
I was able to create Stacked Area chart from ChartFactory.createXYAreaChart(with TimeSeries dataset as Second.class). I faced problem while setting the color of stacked chart.
Note: the code below successfully set the color for legend but failed to set the color for stacked area.
renderer.setSeriesPaint(0, Color.GREEN);
Do I have to something special to set the color for stacked area?
Thanks,
Zack
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
This is a limitation in JFreeChart. You need to use a TimeTableXYDataset. There is some work being done on the StackedXYAreaRenderer class that will hopefully mean that a regular TimeSeriesCollection can be plotted in the future---but for now, it can't.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


I'm using a TimeTableXYDataset and rendering it with a XYStepAreaRenderer. I have a vertical (time) crosshair applied, and want to query the value of the underlying Dataset once I've fetched the crosshair value.
I cannont find anyway of looking up the data row given a time in millis.
It seems there is a remove(TimePeriod period, String seriesName) method. But not a similar get() method.
The internal DefaultKeyedValues2D is private so I can't seem to find any way of getting the data.
Thanks
I cannont find anyway of looking up the data row given a time in millis.
It seems there is a remove(TimePeriod period, String seriesName) method. But not a similar get() method.
The internal DefaultKeyedValues2D is private so I can't seem to find any way of getting the data.
Thanks