Hello,<br />
<br />
How do I remove both a series and the corresponding legend entry from a chart? My attempt below:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
/**
* Called before generation of chart model to GeneratedChartState.
*
*
@param chart
* Chart
*
@param icsc
* IChartScriptContext
*/
function beforeGeneration(chart, icsc)
{
importPackage( Packages.org.eclipse.birt.chart.model.attribute );
// hiding first series in case we are dealing with a time period
xAxis = chart.getBaseAxes()[0];
yAxis = chart.getOrthogonalAxes( xAxis, true)[0];
//use 0 in the following for the first series and 1
//for the second series
seriesDef = yAxis.getSeriesDefinitions().get(0);
runSeries = seriesDef.getRunTimeSeries();
firstRunSeries = runSeries.get(0);
if(some conditions apply)
firstRunSeries.setVisible(false);
// attempt to remove first legend entry
firstLegendEntry = chart.getLegend().eContents().get(0);
if(some conditions apply)
firstLegendEntry.setVisible(false);
}
</pre>
<br />
With the above, I manage to hide the correct series, but the legend entry is still there. How do I get a hold of the corresponding legend entry?<br />
<br />
Regards,<br />
T