how to show multicoloured horizontal bar on x axis?

Discussion about JFreeChart related to stockmarket charts.
Locked
satishonweb
Posts: 3
Joined: Wed Feb 04, 2004 6:25 am

how to show multicoloured horizontal bar on x axis?

Post by satishonweb » Wed Feb 04, 2004 6:52 am

Hi all,
I am using jfreecharts 0.9.15 to plot charts of stocks.
How to add a multi coloured bar of certain width on x axis of the chart.
can somebody help regarding this.

Thanks in advance,
Satish.

sputnik
Posts: 2
Joined: Fri Dec 09, 2005 12:12 pm

add multicolored bar in place of X axis

Post by sputnik » Fri Dec 09, 2005 12:18 pm

hi,

saw ur query regarding placing a mulitcolored bar at x axis.Its dated 2004 . Did u get any solution for this? I actually want to create a simple one dimensional chart with only one thick multicolored bar at x axis and a tick showing the values e.g we can have three colors blue,red green...and each one can stand for high , medium and low value.....and there would be this tick showing soem value.
hope i m clear in explaining what type of a chart i want.
Can you please help if u ever got the solution for ur prob?

jam06511
Posts: 4
Joined: Sun Jan 15, 2006 4:27 am

Re: add multicolored bar in place of X axis

Post by jam06511 » Sun Jan 15, 2006 4:33 am

Hi,

I am going to the same thing but have not found a way to do so. Could I share the solution if you get a answer?

Thanks

[quote="sputnik"]hi,

saw ur query regarding placing a mulitcolored bar at x axis.Its dated 2004 . Did u get any solution for this? I actually want to create a simple one dimensional chart with only one thick multicolored bar at x axis and a tick showing the values e.g we can have three colors blue,red green...and each one can stand for high , medium and low value.....and there would be this tick showing soem value.
hope i m clear in explaining what type of a chart i want.
Can you please help if u ever got the solution for ur prob?[/quote]

jam06511
Posts: 4
Joined: Sun Jan 15, 2006 4:27 am

Post by jam06511 » Sun Jan 15, 2006 5:15 pm

After posted my same question yesterday, I found a solution for this problem. It is to set one dataset with three TimeSeries:

TimeSeries sell_series = new TimeSeries("Sell", Month.class);
TimeSeries hold_series = new TimeSeries("Hold", Month.class);
TimeSeries buy_series = new TimeSeries("Buy", Month.class);

TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(sell_series);
dataset.addSeries(hold_series);
dataset.addSeries(buy_series);

then define color for each dataset:
XYBarRenderer renderer = new XYBarRenderer(0.01);
renderer3.setSeriesPaint(0, Color.red); //sell
renderer3.setSeriesPaint(1, Color.green); //hold
renderer3.setSeriesPaint(2, Color.blue); //buy

and remove tick in y-axis:
Axis.setTickLabelsVisible(false);

The key point for this solution is to assign either 0 or 1 for all TimeSeries. For example, if it should be sell in Mar 2005, then
sell_series.add(new Month(3, 2005), 1);
hold_series.add(new Month(3, 2005), 0);
buy_series.add(new Month(3, 2005), 0);

Try it and good luck.

sputnik
Posts: 2
Joined: Fri Dec 09, 2005 12:12 pm

Can this be done in Netcharts Pro ?

Post by sputnik » Mon Mar 06, 2006 11:00 am

Hey thanx !!
I also wanted to know whether this is possible using Netcharts Pro. This time we can have either this bar or even an Image .
I actually want a mulitcolored side bar ( in place of y axis) in a XY graph.What I am hoping to get is some api in Netcharts pro to set this image at Y axis of the graph.

Any solutions are most welcome and greatly appreciated.

Locked