Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Chart area and legend colors(Difference between chart area and legend)
Chart area and legend colors [message #837046] Thu, 05 April 2012 07:54 Go to next message
Fabien REMY is currently offline Fabien REMYFriend
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.
Re: Chart area and legend colors [message #837050 is a reply to message #837046] Thu, 05 April 2012 08:03 Go to previous messageGo to next message
Fabien REMY is currently offline Fabien REMYFriend
Messages: 10
Registered: April 2012
Junior Member
Do I need to declare in the "series palette" the colors that I will use in the javascripts, because I can notice that it takes the colors in the order of the declaration.

What is the relation between the series palette and the javascript code ?

Thx
Re: Chart area and legend colors [message #837083 is a reply to message #837050] Thu, 05 April 2012 08:49 Go to previous message
Fabien REMY is currently offline Fabien REMYFriend
Messages: 10
Registered: April 2012
Junior Member
Problem solved : I used the getBaseDisplayValue function instead of getSeriesDisplayValue and now I have the same colors between pie area and legend.
Previous Topic:dynamic column show/hide at client side script
Next Topic:BIRT viewer integration into a JSF web application
Goto Forum:
  


Current Time: Sat Oct 16 04:52:37 GMT 2021

Powered by FUDForum. Page generated in 0.01240 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top