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)
united color configuration
flosmi
hi,<br />
<br />
at the moment i have to configure for each graphic, which color it should use for certain captions.<br />
<br />
eg.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeDrawDataPoint( dph, fill, icsc )
{
var sValue = dph.getSeriesDisplayValue();
if( sValue == "Closed" )
{
fill.set( 0, 255, 0, 255 );
}
else if( sValue == "Open" )
{
fill.set( 255, 66, 66, 255 );
}
}
</pre>
<br />
is it possible to configure such colors in a libary or in a style sheet? how?<br />
<br />
thx
Find more posts tagged with
Comments
kclark
flosmi,<br />
There's no way to change the color based on the series with CSS or a library. There are a few ways you could do this with script, I can't think of anyway to avoid that.<br />
<br />
you could do<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function chartColor(status){
switch(status){
case "Cancelled":
clr = new Array(0,255,0,255);
break;
case "Shipped":
clr = new Array(255,0,0,255);
break;
default:
clr = new Array(255,255,255,255);
}
return(clr);
}
</pre>
<br />
as a js function, or<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeDrawDataPoint( dph, fill, icsc )
{
var clr = icsc.getExternalContext().getScriptable().evaluate("chartColor('" + dph.getSeriesDisplayValue() + "')");
r = clr[0];
g = clr[1];
b = clr[2];
t = clr[3];
fill.set(r,g,b,t);
}
</pre>