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.
how to show multicoloured horizontal bar on x axis?
-
- Posts: 3
- Joined: Wed Feb 04, 2004 6:25 am
add multicolored bar in place of X axis
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?
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?
Re: add multicolored bar in place of X axis
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]
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]
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.
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.
Can this be done in Netcharts Pro ?
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.
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.