Hello,<br />
<br />
I'm having trouble changing the line color of a series in a line chart. <br />
<br />
I have successfully changed the colors of the markers (within beforeDrawDataPoint) and the legend (within beforeDrawLegendItem) but I'm having difficulties with the line color. The only way I've managed to change the line color is within beforeGeneration but, as a side effect, the outline of the markers are also changing from black to the color I'm assigning to the line.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>function beforeDrawLegendItem( lerh, bounds, icsc )
{
var seriesValue = lerh.getLabel().getCaption().getValue();
var fill = lerh.getFill();
if( seriesValue == "141" )
fill.set( 250, 178, 23, 255 );
}
function beforeDrawDataPoint( dph, fill, icsc )
{
if( dph.getSeriesDisplayValue() == '141' )
fill.set( 250, 178, 23, 255 );
}
function beforeGeneration( chart, icsc )
{
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
var xAxis = chart.getAxes().get(0);
var yAxis = xAxis.getAssociatedAxes().get(0);
var xSeriesDef = xAxis.getSeriesDefinitions().get(0);
var ySeriesDef = yAxis.getSeriesDefinitions().get(0);
var ySeries = ySeriesDef.getRunTimeSeries();
var numberofrunseries = ySeries.size();
//loop thru all of the series
for (var i = 0; i < numberofrunseries; i++) {
//my condition
if ( ySeries.get(i).getSeriesIdentifier() == '141' ) {
ySeries.get(i).setPaletteLineColor(false);
ySeries.get(i).getLineAttributes().setColor( ColorDefinitionImpl.create( 250, 178, 23 ) );
i = numberofrunseries;
}
}
}</pre>
<br />
I spent some time researching this topic but haven't seen a solution that will help me out. <br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/20136-change-chart-series-color-via-script-in-birt-2-3-1/page__s__4a21e3d43fa52b95e8e0e8ae9929310a'>Change chart series color via script in birt 2.3.1</a><br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/22208-how-to-set-marker-color-different-from-line-color-in-chart/page__s__bcef1fddd7d83b95f5e5f3d48a6e38cd'>How to set marker color different from line color in chart?</a><br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/14709-change-line-color-via-script-in-a-chart/page__s__52eca4c59bfd383d72646997320fb965'>Change line color via script in a chart </a><br />
<br />
I keep wandering back to the beforeDrawSeries but I can't seem to find anything in there that deal with the line attributes.<br />
<br />
I'm looking for help to either change the marker outline back to black OR just change the line of the series without affecting the marker outline. Any suggestions are appreciated. I've added an example report for reference.<br />
<br />
BIRT version 2.6.2<br />
<br />
Thanks in advance,<br />
Rich