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 linestyle at runtime
jas1956y
I have a line chart that is grouping data by year. I would like the linestyle for each year to be different. Solid for one, dashed for the next. How do I do this?
Find more posts tagged with
Comments
Virgil Dodson
Hi jas1956y,<br />
<br />
You could write a script in the beforeDrawSeries method like below.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
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 == "2003")
{
series.getLineAttributes().setStyle(LineStyle.SOLID_LITERAL);
}
if (seriesID == "2004")
{
series.getLineAttributes().setStyle(LineStyle.DASHED_LITERAL);
}
if (seriesID == "2005")
{
series.getLineAttributes().setStyle(LineStyle.DOTTED_LITERAL);
}
}
</pre>
<br />
Example enclosed created with BIRT 2.3.2
jas1956y
Thank you for the reply.
When I do as you suggested I get the following error:
Cannot find function getLineAttributes.
This is my code:
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 != "2005")
{
series.getLineAttributes().setStyle(LineStyle.DOTTED_LITERAL);
}
}