<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;">I have created a BIRT report with a chart which gets data from a oracle database. I got the chart done properly. Now i need to add 4-5 markers to the chart. Values for markers which could be changed are also stored in a database.</p>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;">I tried the scripts mentioned in this article with some modifications <a data-ipb='nomediaparse' href='
http://blogs.actuate.com/birt-chart-scripting-dynamic-markers/'>http://blogs.actuate.com/birt-chart-scripting-dynamic-markers/</a></p>
<pre class="_prettyXprint">
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.getBaseAxes()[0];
var min_value = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("min_val");
var ok_value = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("ok_val");
var great_value = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("great_val");
min_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(min_value));
min_ml.getLabel().getCaption().setValue("Minimum");
min_ml.getLineAttributes().getColor().set(255,0,0);
} </pre>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;">It generates a marker but at the wrong location. Seems like it doesn't properly get marked according to the x axis values.</p>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;"> </p>
<p style="font-size:15px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;"> </p>