I have a bar chart showing 10 bars. I would like to give the 3 longest bars (i.e. the 3 bars with the highest value) a different colour then the other bars.<br />
<br />
I have found an example online (<a class='bbc_url' href='
http://marklorenz.blogspot.com/2006/02/birt-tips-for-java-developers.html'>http://marklorenz.blogspot.com/2006/02/birt-tips-for-java-developers.html</a>) that shows how to change the colour of a bar if it passes a marker line, but have been struggeling to adapt this to my wishes. <br />
<br />
Example I found:<br />
<br />
function beforeDrawDataPoint(dataPointHints, fill, scriptContext )<br />
{ val = dataPointHints.getOrthogonalValue();<br />
chart = scriptContext.getChartInstance();<br />
marker = chart.getAxes().get(0).getAssociatedAxes().get(0).getMarkerLines().get(0).getValue().getValue(); <br />
if (val > marker) //crosses marker?<br />
fill.set(255, 0, 0); //yes - display in red <br />
elsefill.set(0, 0, 255); //no - display in blue<br />
}<br />
<br />
Which function should I use in a script attached to a chart to test whether a value is in the Top 3 ?<br />
<br />
I have tried things like: if (isTopN(val, 3)....<br />
<br />
but keep getting errors that isTopN is undefined.<br />
<br />
Any help would be greatly appreciated.