Jump to content

BIRT Developer Center Download


Photo
- - - - -

Adding marker line to bar chart

bar chart marker line

  • Please log in to reply
2 replies to this topic

#1 hedgehog

hedgehog

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 21 April 2017 - 02:02 AM

Hi,

 

I'm trying to add a marker line on x-axis.

 

The code bellow is working fine for y-axis.

I was trying to use the same code for adding marker line to x-axes as well, I just replaced

 

MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(min_value));

by

  MarkerLineImpl.create(xAxis, NumberDataElementImpl.create(min_value));  

 

I tried

var xAxis = chart.primaryBaseAxes[0];

and

var xAxis = chart.getAxes().get(0);

 

None of them is working. Any suggestions? Thank you in advance,

Lucy

 

function beforeGeneration( chart, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);
var chart = icsc.getChartInstance();
var yAxis = chart.getAxes().get(0).getAssociatedAxes().get(0);
var xAxis = chart.primaryBaseAxes[0];
//var xAxis = chart.getAxes().get(0);
var min_value = 1337;


min_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(min_value));
min_ml.getLabel().getCaption().setValue("Min " + parseFloat(min_value));            

}

 



#2 hedgehog

hedgehog

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 21 April 2017 - 02:50 AM

Hi,

 

solved :) I needed to make sure that the parameter "Is Category Axis" is unchecked.

 

Lucy



#3 mblock

mblock

    Expert Member

  • BIRT Experts
  • 1870 posts

Posted 23 April 2017 - 05:35 AM

In any case here is another example - http://developer.act...-for-bar-chart/


Regards,

Mica J. Block

Principal Analytics Architect

OpenText Corporation






Also tagged with one or more of these keywords: bar chart, marker line