Change chart series color via script in birt 2.3.1 [message #548482] |
Thu, 22 July 2010 02:30  |
Eclipse User |
|
|
|
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 #548606 is a reply to message #548576] |
Thu, 22 July 2010 09:11  |
Eclipse User |
|
|
|
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!
|
|
|
Powered by
FUDForum. Page generated in 0.03554 seconds