Vertical BAr Plot

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

Vertical BAr Plot

Post by Sudha Sundaram » Sun Mar 18, 2001 6:59 pm

I have two series of data to be displayed on a vertical bar plot.
There is a particular requirement for me that the values in series 2 will determine the color of the bar of series 1. ie, Series 2 need not be displayed on the plot. But should be used to determine the color of bars of series 1.

Like if Series 1 data is (x1,x2,x3,x4) =(25, 100, 75, 300) and the corresponding
series 2 data is (y1,y2,y3,y4) = (20, 40, 60, 80)
the bar corresponding to x1 should be red, x2 blue,green,yellow and so on.
Please let me know what is the best way of doing this.

Thanks in advance
Sudha

David Gilbert

RE: Vertical Bar Plot

Post by David Gilbert » Mon Mar 19, 2001 1:55 pm

Hi Sudha,

The quickest way to implement this would be to modify the getBars() method in VerticalBarPlot. At the moment, this method assigns each bar a color based on which series it belongs to. You could code it so that it looks at some value in the data source and decides the color on that basis - not a very general implementation, but it would work.

I've registered a Feature Request (id=409711) on SourceForge because I'd like to extend JFreeChart in a general way to handle the case you describe and also other variations. The priority is low for me though, so I'd recommend having a go at the code yourself. If you come up with something that others might find useful, feel free to post the code here (or e-mail it to me and I'll put it on the web-site).

Regards,

DG.

Locked