Average Line on Vertical Bar Chart

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

Average Line on Vertical Bar Chart

Post by Justin King » Tue Jul 02, 2002 1:41 am

Hi, I am trying to have a line drawn across a chart as an average of the Vertical Bar Chart.

Now from the documentation which I bought, and is quite informative, it suggests combining using xyplots.

However I wish to have a vertical barchart that has say 3 months

Jan, feb and march and in each series for each months has two values.

i.e Jan Sales, Jan Calls, Feb Sales, Feb Calls, Mar Sales, March Calls.

I can only get one chart per value with the XYPlot.

Any tips to help me out??

Justin King

David Gilbert

Re: Average Line on Vertical Bar Chart

Post by David Gilbert » Tue Jul 02, 2002 5:45 am

Hi Justin,

You can add any number of horizontal "marker" lines to a vertical bar chart by using the addRangeMarker(...) method in the CategoryPlot class. You will need to calculate the average yourself, and create a Marker object (which could do with another constructor that needs just a value and uses defaults for everything else...I'll fix that).

Let me know if that doesn't work for you.

Regards,

DG.

Locked