Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Y Series Grouping and colors
Y Series Grouping and colors [message #362817] Tue, 27 May 2008 05:58 Go to next message
Anders Vegh is currently offline Anders Vegh
Messages: 507
Registered: July 2009
Senior Member
Hi,

I have created a bar chart where I put a "verdict" column from my database
as an "Optional Y Series Grouping". I have noticed that it is possible to
define that the first value will get a specific color, say green, the
second will get red and so forth.

My verdict column can cotain one of three values "passed", "failed" and
"not tested". I would like to link these values to specific colors to make
sure that "passed" always is green, "failed" always is red and "not
tested" is white.

Now I have the colors green, white, red in that order in my series palett
and then I have group sorting = descending on my verdict column, so it
works when all verdicts are present. But I have a report parameter that
offers a possibility to only show "failed" results and these bars will
then be green. I would like them to be red.

Any suggestions on how to link a color to a specific db-value?

Thanks in advance,
Anders
Re: Y Series Grouping and colors [message #362833 is a reply to message #362817] Tue, 27 May 2008 12:14 Go to previous messageGo to next message
Eclipse User
Originally posted by: jasonweathersby.alltel.net

Anders,

Can you try adding a script to the chart like:

function beforeDrawDataPoint(dph, fill, icsc)
{
importPackage( Packages.java.io );
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );

if( dph.getBaseValue() == "Pass" ){
var mycolor = ColorDefinitionImpl.GREEN();
r = mycolor.getRed();
g = mycolor.getGreen();
b = mycolor.getBlue();
fill.set(r, g, b);
}
}


Jason


Anders Vegh wrote:
> Hi,
>
> I have created a bar chart where I put a "verdict" column from my
> database as an "Optional Y Series Grouping". I have noticed that it is
> possible to define that the first value will get a specific color, say
> green, the second will get red and so forth.
>
> My verdict column can cotain one of three values "passed", "failed" and
> "not tested". I would like to link these values to specific colors to
> make sure that "passed" always is green, "failed" always is red and "not
> tested" is white.
> Now I have the colors green, white, red in that order in my series
> palett and then I have group sorting = descending on my verdict column,
> so it works when all verdicts are present. But I have a report parameter
> that offers a possibility to only show "failed" results and these bars
> will then be green. I would like them to be red.
>
> Any suggestions on how to link a color to a specific db-value?
>
> Thanks in advance,
> Anders
>
Re: Y Series Grouping and colors [message #362865 is a reply to message #362833] Wed, 28 May 2008 15:34 Go to previous message
Anders Vegh is currently offline Anders Vegh
Messages: 507
Registered: July 2009
Senior Member
Hi Jason,

Thanks for your answer. I didn't get it to work with
if( dph.getBaseValue() == "Pass" ){
but when I tried
if( dph.getSeriesValue() == "Pass" ){
it worked.

Don't know the acutal difference between basevalue and seriesvalue.

Anyhow ... finally I fixed the legend as well using

function beforeDrawLegendItem(lerh, bounds, icsc){
if (lerh.getLabel().getCaption().getValue() == "Pass" ){
lerh.getFill().set(0, 128, 0);
}
...
}

Just thought I might share it if someone else looks for similar info.

Once again, thanks for helping.

Regards,
Anders
Previous Topic:How to pass multivalue parameters to a subreport (Urgent!)
Next Topic:Frameset not working in a JSP
Goto Forum:
  


Current Time: Sun Aug 31 00:28:05 EDT 2014

Powered by FUDForum. Page generated in 0.01529 seconds