Home
Analytics
Assign color to stacked bar series
tymhon
Hi, I would like to know how to assign a color to a bar series through the charting API in Java. The series are stacked and I would like to select one of 2 colors for each based on an attribute of the values.
Thanks!
Terry
Find more posts tagged with
Comments
Virgil Dodson
Hi Terry,<br />
<br />
Since you want to change the colors based on values, then you should look at scripting for the chart.<br />
<br />
First, look at this example where the bar colors are changed based on values:<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=276'>http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=276</a><br
/>
This example uses the chart inside a BIRT report design but makes it easy to test this way.<br />
<br />
Once you have a handle on how that works with the BIRT Designer, then you can use the setScript method on your chart with a similar script to have it work only with the Chart Engine API.
tymhon
Thanks Virgil, I have gotten it working with adding a script. I also have another question. I am using SWT and I have a table with a list of items. These items are presented in two pie charts and a bar chart. Is there a way where I can highlight the part of each chart that contains the item that is selected on the table?
Thanks!
Terry