|
Comparision Barchart with Colors |
Posted by Divya on Jun-19-2013 15:25 |
|
Hi,
My requirement is that I need a Comparision Barchart like below:
I need to have the first set of bars using y axis and second set of bars using yaxis2().But
the colors of first 4 bars should be blue and last two orange.
I tried many ways but i am unable to achieve it.For all that i do the bars are
overlapping . We use Barlayer3 for colors and Barlayer2 for getting it side by side but how
do i achieve both together??
Please do help me asap.
Thanks In advance
|
Re: Comparision Barchart with Colors |
Posted by Peter Kwan on Jun-19-2013 19:57 |
|
Hi Divya,
There are many methods to achieve what you need. You may use two BarLayer objects with Chart.Side layout, or you may use one BarLayer object with Chart.Stack layout, and with the data sets "grouped" into two groups (see the "Multi-Stacked Bar Chart" sample code). An example is:
double[] leftBlueBars = {111, 222, Chart.NoValue};
douible[] rightBlueBars = {333, 444, Chart.NoValue};
BarLayer blueLayer = c.addBarLayer2(Chart.Side);
blueLayer.addDataSet(leftBlueBars, 0x9999ff);
blueLayer.addDataSet(rightBlueBars, 0x9999ff).setUseYAxis2();
double[] leftOrangeBars = {Chart.NoValue, Chart.NoValue, 555};
douible[] rightOrangeBars = {Chart.NoValue, Chart.NoValue, 666};
BarLayer orangeLayer = c.addBarLayer2(Chart.Side);
orangeLayer.addDataSet(leftBlueBars, 0xffcc66);
orangeLayer.addDataSet(rightBlueBars, 0xffcc66).setUseYAxis2();
Hope this can help.
Regards
Peter Kwan |
Re: Comparision Barchart with Colors |
Posted by Divya on Jun-19-2013 20:12 |
|
Hello Peter,
Thank you so much i achieved exactly what i wanted...
Now, how do i set different AggregateLabelFormat for each dataset we are adding to the
layer.For Eg. LeftBlueLayer has a different format and rightblueLayer has a different label
format.How do i do this?
My Chart would be 100% if i do this plz do help me with this also..
Thanks in advance |
Re: Comparision Barchart with Colors |
Posted by Peter Kwan on Jun-19-2013 23:44 |
|
Hi Divya,
You may use Layer.addCustomGroupLabel to add custom labels to individual bars. In this way, each bar can use a different label format, and you can use different formats for left and right bars.
Hope this can help.
Regards
Peter Kwan |
|