help setting the line color for a series(solved) [message #1214350] |
Wed, 27 November 2013 12:02  |
Eclipse User |
|
|
|
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 15:36] by Moderator
|
|
|
|
Re: help setting the line color for a series [message #1219241 is a reply to message #1214350] |
Mon, 02 December 2013 15:35  |
Eclipse User |
|
|
|
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 15:38] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03619 seconds