Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Chart Area : script to change colors
egau
<p>Hello guys,</p>
<p> </p>
<p>I'm trying to modify an Area chart to color the area depending on treshold.</p>
<p> </p>
<p>The purpose is to have :</p>
<p> green area when value < X </p>
<p> orange area when value > X && < Y</p>
<p> red area when value > Y</p>
<p> </p>
<p>Does anyone have a suggestion on how to modify the color of an area chart, it seems the fill.set is not taken into account.</p>
<p> </p>
<p>Thanks in advance</p>
<p> </p>
<p>I can't manage doing it, I have already tried that : </p>
<pre class="_prettyXprint">
function beforeDrawDataPoint( dph, fill, icsc )
{
var seriesName = dph.getSeriesDisplayValue();
fill.set(136,185,23);
label.getCaption().setColor(136,185,23);
if (dph.getSeriesDisplayValue() == "Avg"){
val = dph.getOrthogonalValue();
if(val > icsc.getExternalContext().getScriptable().getParameterValue("w_threshold")){
if(val < icsc.getExternalContext().getScriptable().getParameterValue("c_threshold")){
fill.set(255,154,219)
}else{
icsc.getExternalContext().getScriptable().evaluate("writeLogServer(\"CRITICAL VALUE\");");
fill.set(224,11,61);
}
}
}
}</pre>
Find more posts tagged with
Comments
Clement Wong
<p>Are you using commercial BIRT? If so, with HTML5 charts report item, you can add additional thresholds to display those "zones" in the area chart.</p>
<p> </p>
<p>Attached is an iHub 3.1 sample of those "zones": red (0 - 400), orange (400 - 600), and green (600+). There are three series, one for each color band. The Z-Index has been updated accordingly for each series.</p>
<p> </p>
<p>
egau
<p>Hello,</p>
<p> </p>
<p>Thanks for your answer but I'm using the open source BIRT so I can't use your solution.</p>