Eclipse BIRT orRender Chart Script function Can't find method org.eclipse.birt.chart.model.dat
<ul><li>Hi, I'm trying to displaying Chart minimum , maximum and average values but I can't able to render output I'm always getting bellow error how to debug chart script ? </li>
<li>Can't find method org.eclipse.birt.chart.model.data.impl.NumberDataElementImpl.create(null)</li>
</ul><p>OnRender Chart Script Code :</p>
<p> </p>
<div>
<pre class="_prettyXprint">
function afterDataSetFilled( series, dataSet, icsc ){
if(series.getSeriesIdentifier() !=null){
if( series.getSeriesIdentifier() == "MANUAL-DISC" ||series.getSeriesIdentifier()=="MANUAL-LOAD" ||
series.getSeriesIdentifier()=="DISC" || series.getSeriesIdentifier()=="LOAD" ){
var list = dataSet.getValues();
var total=new Number();
var theMin=new Number();
var theMax=new Number();
var items=list.length;
theMin=list[0];
for (i=0; i < items; i++) {
total = total + Number(list[i]);
if (list[i] < theMin) theMin = list[i];
if (list[i] > theMax) theMax = list[i];
}
icsc.getExternalContext().getScriptable().setGlobalVariable("minimum",theMin);
icsc.getExternalContext().getScriptable().setGlobalVariable("average",(total/items));
icsc.getExternalContext().getScriptable().setGlobalVariable("maximum",theMax);
}
}
}</pre>
<div> </div>
<div>
<pre class="_prettyXprint">
function beforeGeneration( gcs, 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 min_value = icsc.getExternalContext().getScriptable().getGlobalVariable("minimum");
var avg_value = icsc.getExternalContext().getScriptable().getGlobalVariable("average");
var max_value = icsc.getExternalContext().getScriptable().getGlobalVariable("maximum");
min_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(min_value));
min_ml.getLabel().getCaption().setValue("Min " + parseInt(min_value)); // parseInt
min_ml.getLabel().getCaption().getFont().setName("Arial");
min_ml.getLabel().getCaption().getFont().setSize(11);
min_ml.getLabel().getCaption().setColor( ColorDefinitionImpl.create(136,136,136));
min_ml.getLineAttributes().getColor().set(173,210,252);
min_ml.getLineAttributes().setThickness(1);
avg_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(avg_value));
avg_ml.getLabel().getCaption().setValue("Average " + parseFloat(avg_value).toFixed(2));
avg_ml.getLabel().getCaption().getFont().setName("Arial");
avg_ml.getLabel().getCaption().getFont().setSize(11);
avg_ml.getLabel().getCaption().setColor( ColorDefinitionImpl.create(136,136,136));
avg_ml.getLineAttributes().getColor().set(173,210,252);
avg_ml.getLineAttributes().setThickness(1);
max_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(max_value));
max_ml.getLabel().getCaption().setValue("Max " + parseInt(max_value)); // parseInt
max_ml.getLabel().getCaption().getFont().setName("Arial");
max_ml.getLabel().getCaption().getFont().setSize(11);
max_ml.getLabel().getCaption().setColor( ColorDefinitionImpl.create(136,136,136));
max_ml.getLineAttributes().getColor().set(173,210,252);
max_ml.getLineAttributes().setThickness(1);
}</pre>
</div>
</div>
<p> </p>
<p> </p>