Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Change color of one bar in chart
MikeyD
Hi all,
I know there are a large number of threads concerning the change of color in a bar chart. Most of the ones I can find concern changing the color of a series. However, I need to find a way to change one specific bar within a series and leave the other bars within that same series as they were.
To put it differently: my query result is always 5 records, and the record with the NameID field equal to 'overtime' needs to have a different color.
Could someone give me some help on how to solve this?
Thanks for your support.
Kind regards, Mike
Find more posts tagged with
Comments
elmatador
Mike,
My understanding is that a column in your query is represented as a series in your graph. Therefore the Overtime column is a series in its own right.
MikeyD
Hi Elmatador,
Thanks for your reply.
I have the impression I only have one series, and "overtime" is the x-axis label for one of the bars. To give you an example: my data set looks like:
NameID, Value
"worka", 20
"workb", 5
"workc", 15
"overtime", 10
Now I get a bar chart with one series, and 4 bars. I need to change the bar color for the bar with label "overtime", but do not know how to address this bar in a script.
mwilliams
Hi Mike,
This should do it for you:
function beforeDrawDataPoint( dph, fill, icsc )
{
if (dph.getBaseDisplayValue() == "overtime"){
fill.set(255,0,0);
}
}
MikeyD
Hi Michael,
This is exactly what I needed to finalize my report. Many thanks for your great support.
MikeyD
Hi Michael,
I just wondered about an other variation on this theme: can I change the color of the second bar in the chart? So I would like to check on position, and not the name of the label.
Regards,
Mike
bhanley
This DevShare item formats the color of bars in a chart based on a parameter value. You should easily be able to tweak the formatting condition to suit your needs as well as add more conditions to the overall list of formatting possibilities.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/819-parameter-driven-bar-chart-formatting/#description'>Parameter-Driven
Bar Chart Formatting - Designs & Code - BIRT Exchange</a><br />
<br />
Good Luck!
MikeyD
Thanks Brian!!! it works