Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Change chart series color via script in birt 2.3.1
ichBirt
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. As I have seen in this forum I have tried this:
function beforeDrawSeries(series, isr, icsc)
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
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.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
var seriesID = series.getSeriesIdentifier();
var seriesId = series.getSeriesIdentifier();
if (seriesId == "series 1"){
icsc.getChartInstance().getPlot().getOutline().getColor().set(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!!
Find more posts tagged with
Comments
mwilliams
Hi ichBirt,
So, you're getting the data point colors changed, but not the line between them? Is this your issue? Let me know.