Chart area and legend colors [message #837046] |
Thu, 05 April 2012 07:54  |
Fabien REMY Messages: 10 Registered: April 2012 |
Junior Member |
|
|
Hello !
I use a pie chart in a report where I try to set my own color codes in terms of my serie.
Here is how I proceed :
2 javascript functions of my chart : beforeDrawDataPoint and beforeDrawLegendItem and I test the values in order to fix the colors :
function beforeDrawDataPoint( dph, fill, icsc )
{
var sValue = dph.getSeriesDisplayValue();
if( sValue == "AA" )
{
fill.set( 111, 206, 229, 255 );
}
else if( sValue == "AT" )
{
fill.set( 0, 111, 81, 255 );
}
else if( sValue == "MN" )
{
fill.set( 0, 147, 209, 255 );
}
else if( sValue == "Autres" )
{
fill.set( 238, 28, 37, 255 );
}
}
function beforeDrawLegendItem( lerh, bounds, icsc )
{
var sValue = lerh.getLabel().getCaption().getValue();
var fill = lerh.getFill();
if( sValue == "AA" )
{
fill.set( 111, 206, 229, 255 );
}
else if( sValue == "AT" )
{
fill.set( 0, 111, 81, 255 );
}
else if( sValue == "MN" )
{
fill.set( 0, 147, 209, 255 );
}
else if( sValue == "Autres" )
{
fill.set( 238, 28, 37, 255 );
}
}
But the result is that "sometimes" I don't have the good color between the pie area and the legend.
Any idea ?
Thank you.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02033 seconds