Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » help setting the line color for a series(solved)
help setting the line color for a series(solved) [message #1214350] Wed, 27 November 2013 17:02 Go to next message
Matthew Tiffany is currently offline Matthew TiffanyFriend
Messages: 4
Registered: November 2013
Junior Member
I have searched the forums for a little while but I cannot find a solution to this problem.

I'm using birt 4.3.1 and i'm trying to change the line color by series.(dynamic number of series) I have been able to change the legend and the data points but I can't seem to find a way to change the line.

The following gives the error, but all the posts I have found on here and all websites I have found say to use that method.

Quote:
Chart (id = 23):
+ TypeError: Cannot find function getlineAttributes in object org.eclipse.birt.chart.model.type.impl.LineSeriesImpl@1d741a0c (visible: true, seriesIdentifier: Actual, labelPosition: Above, stacked: false, translucent: <unset>) (paletteLineColor: true, curve: false, connectMissingValue: true). at line 32 of chart script:''
exception.javascript.error ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: TypeError: Cannot find function getlineAttributes in object org.eclipse.birt.chart.model.type.impl.LineSeriesImpl@1d741a0c (visible: true, seriesIdentifier: Actual, labelPosition: Above, stacked: false, translucent: <unset>) (paletteLineColor: true, curve: false, connectMissingValue: true). at line 32 of chart script:


importPackage( Packages.java.io );
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );

function beforeDrawDataPoint(dph, fill, icsc)
{

if( dph.getSeriesValue() == "Actual" ){
var mycolor = ColorDefinitionImpl.BLUE();
r = mycolor.getRed();
g = mycolor.getGreen();
b = mycolor.getBlue();
fill.set(r, g, b);
}	
}

function beforeDrawLegendItem(lerh, bounds, icsc){ 
if (lerh.getLabel().getCaption().getValue() == "Actual" ){ 
var mycolor = ColorDefinitionImpl.BLUE();
r = mycolor.getRed();
g = mycolor.getGreen();
b = mycolor.getBlue();
lerh.getfill.set(r, g, b);
}
}


function beforeDrawSeries( series, isr, icsc )
{
if( series.getSeriesIdentifier() == "Actual" ){series.getlineAttributes().getcolor();}
}

[Updated on: Mon, 02 December 2013 20:36]

Report message to a moderator

Re: help setting the line color for a series [message #1216739 is a reply to message #1214350] Thu, 28 November 2013 16:03 Go to previous messageGo to next message
donino donino is currently offline donino doninoFriend
Messages: 183
Registered: July 2011
Senior Member
Hi,

it seems there is a small uppercase typo in your code: try
series.getLineAttributes()

instead of
series.getlineAttributes()


Hope this helps
Re: help setting the line color for a series [message #1219241 is a reply to message #1214350] Mon, 02 December 2013 20:35 Go to previous message
Matthew Tiffany is currently offline Matthew TiffanyFriend
Messages: 4
Registered: November 2013
Junior Member
Thank you donino that did help X.x Also encase someone else is looking for this answer, here is the code that worked(I also had to unset the pallete color, which did in the code.)

importPackage( Packages.java.io );
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );

var blue = ColorDefinitionImpl.BLUE();
var bluer = blue.getRed();
var blueg = blue.getGreen();
var blueb = blue.getBlue();

function beforeDrawDataPoint(dph, fill, icsc)
{
if( dph.getSeriesValue() == "Actual" ){fill.set(bluer, blueg, blueb);}	
}

function beforeDrawLegendItem(lerh, bounds, icsc){ 
if (lerh.getLabel().getCaption().getValue() == "Actual" ){ 
lerh.getFill().set(bluer, blueg, blueb);
}
}


function beforeDrawSeries( series, isr, icsc )
{
if( series.getSeriesIdentifier().toString() == "Actual" ){series.unsetPaletteLineColor();series.getLineAttributes().setColor(blue);}
}

[Updated on: Mon, 02 December 2013 20:38]

Report message to a moderator

Previous Topic:Format error not a PDF or corrupted
Next Topic:compare year
Goto Forum:
  


Current Time: Tue Mar 19 09:54:08 GMT 2024

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

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

Back to the top