How to define color for every legend item [message #255007] |
Tue, 11 September 2007 09:52  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
}
|
|
|
Powered by
FUDForum. Page generated in 0.04870 seconds