Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Change chart series color via script in birt 2.3.1
Change chart series color via script in birt 2.3.1 [message #548482] Thu, 22 July 2010 06:30 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2010
Junior Member
Hi everyone,

I have a line chart and I have to check the values of some parameters to define the colours of each line, so I need to use the script. I have tried this:

function beforeDrawSeries(series, isr, icsc)
{

importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribut e);

var seriesID = series.getSeriesIdentifier();

if (seriesID == "series 1")
{

series.getLineAttributes().getColor().set(255,255,0);

}

But I'm using Birt 2.3.1, and I get the error that the method getLineAttributes() is not defined, because in this version of Birt the package org.eclipse.birt.chart does not exist.
I also have unchecked the option "Use Series Palette as Line Color" in each series in the Edit Chart window.

I have tried the following as well:

function beforeDrawSeries(series, isr, icsc)
{

importPackage(Packages.org.eclipse.birt.chart.model.componen t.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribut e);

var seriesID = series.getSeriesIdentifier();
var seriesId = series.getSeriesIdentifier();

if (seriesId == "series 1"){
icsc.getChartInstance().getPlot().getOutline().getColor().se t(255,255,0);
}

because icsc.getChartInstance().getPlot().getOutline() returns a LineAttribute type Object, but although I don't get any error, I don't get the expected result (I see every line in black).

Is there any way to do this with Birt 2.3.1?

Thank you very much in advance!!
Re: Change chart series color via script in birt 2.3.1 [message #548576 is a reply to message #548482] Thu, 22 July 2010 11:54 Go to previous messageGo to next message
Thomas Hergenröder is currently offline Thomas HergenröderFriend
Messages: 15
Registered: July 2009
Junior Member
I am not sure but maybe you can have a look at:
http://code.google.com/a/eclipselabs.org/p/birt-functions-li b/
to guide you
Re: Change chart series color via script in birt 2.3.1 [message #548606 is a reply to message #548576] Thu, 22 July 2010 13:11 Go to previous message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2010
Junior Member
Thank you very much for your help.
I don't know why but after trying for some more times, and with some more examples, the first code I wrote finally worked. I thought that with Birt 2.3.1 you couldn't use that, cause I got some errors, but it ended up workin like in previoius versions.
In any way I'm gonna take a look to the guide you have told me, as it can be helpful for a begginer like me.
Thanks!
Previous Topic:Include a TOC in a PDF
Next Topic:NullPointerException in ReportDesigner (Debug Report)
Goto Forum:
  


Current Time: Sat May 04 23:01:36 GMT 2024

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

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

Back to the top