Skip to main content



      Home
Home » Archived » BIRT » How to define color for every legend item
How to define color for every legend item [message #255007] Tue, 11 September 2007 09:52 Go to next message
Eclipse UserFriend
I'm creating a chart and i try to define color for this chart using a
ChartEventHandler class. My goal is to associate e.g. color "red" to
"SportCars" or color "blue" to "Oldtimer", so if i generate pdf or html
sportcars have everytime color red in my chart.

How can I do that?
Re: How to define color for every legend item [message #255088 is a reply to message #255007] Tue, 11 September 2007 13:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

You can use the beforeDrawLegendItem method in BIRT 2.2 in the onRender
scripts of the chart

function beforeDrawLegendItem(lerh, bounds, icsc)

{


val = lerh.getLabel().getCaption().getValue();

fill = lerh.getFill();



if (val == "SportsCars")

fill.set(255,0,0); // color red

else if(val == "Oldtimer")

fill.set(0,0,255); //color blue



}



- Payal

"Reinhard Klausel" <reinhard.klausel@freenet.de> wrote in message
news:6844d770c17ff5c09bd93d2ca6c2b6e2$1@www.eclipse.org...
> I'm creating a chart and i try to define color for this chart using a
> ChartEventHandler class. My goal is to associate e.g. color "red" to
> "SportCars" or color "blue" to "Oldtimer", so if i generate pdf or html
> sportcars have everytime color red in my chart.
>
> How can I do that?
>
Re: How to define color for every legend item [message #255257 is a reply to message #255088] Thu, 13 September 2007 03:50 Go to previous messageGo to next message
Eclipse UserFriend
Thank you chakravp,

that's exactly what i am searching for, BUT...

that colors only my legend in red, the color of the part "Oldtimer" in my
chart stays green.



chakravp wrote:

> Hi,

> You can use the beforeDrawLegendItem method in BIRT 2.2 in the onRender
> scripts of the chart

> function beforeDrawLegendItem(lerh, bounds, icsc)

> {


> val = lerh.getLabel().getCaption().getValue();

> fill = lerh.getFill();



> if (val == "SportsCars")

> fill.set(255,0,0); // color red

> else if(val == "Oldtimer")

> fill.set(0,0,255); //color blue



> }



> - Payal

> "Reinhard Klausel" <reinhard.klausel@freenet.de> wrote in message
> news:6844d770c17ff5c09bd93d2ca6c2b6e2$1@www.eclipse.org...
>> I'm creating a chart and i try to define color for this chart using a
>> ChartEventHandler class. My goal is to associate e.g. color "red" to
>> "SportCars" or color "blue" to "Oldtimer", so if i generate pdf or html
>> sportcars have everytime color red in my chart.
>>
>> How can I do that?
>>
Re: How to define color for every legend item [message #255620 is a reply to message #255257] Mon, 17 September 2007 03:09 Go to previous message
Eclipse UserFriend
I found the way on my own,

i have to make the same as for legend in method "beforeDrawDataPoint"

function beforeDrawDataPoint(dph, fill, icsc)
{
val = dph.getBaseDisplayValue();

if (val == "SportsCars")
fill.set(255,0,0); // color red
else if(val == "Oldtimer")
fill.set(0,0,255); //color blue

}
Previous Topic:Help : Very Urgent
Next Topic:Urgent: Can we hide report url parameters
Goto Forum:
  


Current Time: Wed May 07 11:47:57 EDT 2025

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

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

Back to the top