how to do overlaid charts

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

how to do overlaid charts

Post by Ansh Desi » Wed Jun 12, 2002 6:40 pm

Hi all,

I need clues as to how to do overlaid charts?

Currently I am tracking values for a TimeSeries chart...but I also want
to set thresholds (such as horizontal bars, or something better) to set
zones where those values lie...

For this I would need to overlay charts...

Write now I am simple using JFreeChart chart = ChartFactory.createTimeSeriesChart(xxx)

How do I combine two charts together?

Thanks in advance!

Ansh Desi

Re: how to do overlaid charts

Post by Ansh Desi » Wed Jun 12, 2002 6:58 pm

And yes forgot to mention the release version I am using...its 0.9.0.

If it does not have feature to do overlay charts, do suggest if there is any other way to get around the problem.

Thanks

Ansh Desi

Re: how to do overlaid charts

Post by Ansh Desi » Thu Jun 13, 2002 12:11 am

David or anyone else qualified,

Please tell me the approach of plotting the above...

Let me reiterate...

On both X and Y axis I need number values...actually on the Y axis, its Time...since I am using Time Series chart to plot a data set. This part I have already dealt with.

Now I want to for my X axis values plot horizontal bar graphs...and these would lie underneath the 'time series' plotted line. So in essence I am mixing time series line with horizontal bar graph.

So how should I go about it?

Thanks

David Gilbert

Re: how to do overlaid charts

Post by David Gilbert » Thu Jun 13, 2002 9:57 am

Hi Ansh,

There is a demo application OverlaidPlotDemo that shows the approach. With OverlaidXYPlot you can now add any XYPlot as a subplot, but there is only one type of bar plot available so far (the one that uses VerticalXYBarRenderer as in the demo).

Regards,

DG.

Ansh Desi

Re: how to do overlaid charts

Post by Ansh Desi » Thu Jun 13, 2002 6:45 pm

Hi David,

Yes I already looked at the demo app OverlaidPlotDemo. So let me get this right - what you are saying is that 'there is no way we can plot horizontal bar graphs' with an overlaid XY plot?

SO, there is no such thing as HorizontalXYBarRenderer...? or similar...correct?

I am gonna be in a fix, since the time series chart was working perfect for me, and I already designed the app accordingly...and then the requirement came that I need to have horizontal bar graphs running in the back ground...

Ansh Desi

Re: how to do overlaid charts

Post by Ansh Desi » Thu Jun 13, 2002 7:09 pm

David,

Essentially what I wanna do, is to have in the background different areas with colored back ground 'zones'. And these zones whether 'red', 'green' or 'yellow' are tied to the X axis mainly and have a lower range and a upper range. So think of it as colored zone areas, say for example sake, on the Y axis - from 0 to 30 (red), 30-60(green), 60-90(yellow).

Also these colored zones should run across parallel to the X axis, on which I have 5 days of data.

Obviouslly I am not tied to Horizontal bar graphs...would AreaXYItemRenderer do the job for me? Since I can have filled areas in it as well? Right? :-)

David Gilbert

Re: how to do overlaid charts

Post by David Gilbert » Thu Jun 13, 2002 11:17 pm

I think the PeriodMarkerPlot may do something along these lines. It is a subclass of XYPlot so you can use it in an overlaid chart.

PeriodMarkerPlot was contributed by another developer, and I've never used it, but it would be worth having a look at.

Another solution would be to subclass OverlaidXYPlot and override the drawOutlineAndBackground method to color the ranges the way you want them.

Regards,

DG.

Locked