Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How can I set line chart's marker's color in JavaScript?
tochiai
Guys,
I want to add line series to bar chart runtime by using JavaScript at beforeFactory.
But I couldn't set the color to marker.
CODE:
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.type.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
cht = reportContext.getDesignHandle().findElement("MyLineChart");
mychart = cht.getReportItem().getProperty( "chart.instance" );
xAxis =mychart.getAxes().get(0);
yAxis1 = xAxis.getAssociatedAxes().get(0);
var sdNew = SeriesDefinitionImpl.create();
var ls = LineSeriesImpl.create();
ls.setSeriesIdentifier( "Average" );
ls.getMarkers().get(0).setType( MarkerType.TRIANGLE_LITERAL );
ls.getMarkers().get(0).setSize(10);
//I want to change fill color of marker to same as line color
ls.getLineAttributes().getColor().set(255,0,0);
var qry = QueryImpl.create("row["QTY_AVG"]" );
ls.getDataDefinition().add(qry)
sdNew.getSeries().add( ls );
yAxis1.getSeriesDefinitions().add( sdNew );
Thanks.
Tatsumi
Find more posts tagged with
Comments
mwilliams
Hi Tatsumi,
What version of BIRT are you using? I'll take a look. Was this attached report design made with the sample database so that I can run it?
tochiai
Thanks Michael.
Yes I used CalssicModels.
I made this sample with Actuate BIRT 10SP1 Fix2.
(Actuate BIRT Report Designer Professional
Version: 2.3.2 Build id: 20090701)
Cheers.
Tatsumi
mwilliams
Hi Tatsumi,
This version of your report should do what you're looking for. You can see the changes I made in the script. I added a package and a line of code to add your color to the series palette. Let me know if you have any questions.
tochiai
Michael thanks.
SeriesPalette!
Tatsumi Ochiai
mwilliams
Tatsumi,
Glad I could help. Let us know whenever you have questions!