Graph contains 4 marker lines, some not needed [message #1027927] |
Wed, 27 March 2013 12:00  |
Eclipse User |
|
|
|
I'm currently using BIRT 3.7. I've got a report template that has 4 marker lines that are threshold lines. When the report is run, the query result may or may not contain all of these thresholds. Some may be null. In the case that the value is null, is there a way to not draw the line? In the template I have a working script that sets the value of each marker line under the use case where all marker lines contain valid values. importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
function beforeDrawMarkerLine( axis, markerLine, context)
{
target = context.getExternalContext().getScriptable().getPersistentGlobalVariable("COUNTER");
if(target == 1)
{
target = context.getExternalContext().getScriptable().getPersistentGlobalVariable("MAX_THRESHOLD");
markerLine.setValue(NumberDataElementImpl.create(target));
markerLine.getLabel().getCaption().setValue("Max Red " + target);
context.getExternalContext().getScriptable().setPersistentGlobalVariable("COUNTER", "2");
}
else if(target == 2)
{
target = context.getExternalContext().getScriptable().getPersistentGlobalVariable("MIN_THRESHOLD");
markerLine.setValue(NumberDataElementImpl.create(target));
markerLine.getLabel().getCaption().setValue("Min Red " + target);
context.getExternalContext().getScriptable().setPersistentGlobalVariable("COUNTER", "3");
}
else if(target == 3)
{
/*
target = context.getExternalContext().getScriptable().getPersistentGlobalVariable("MAX_THRESHOLD_YELLOW");
markerLine.setValue(NumberDataElementImpl.create(target));
markerLine.getLabel().getCaption().setValue("Max Yellow " + target);*/
context.getExternalContext().getScriptable().setPersistentGlobalVariable("COUNTER", "4");
}
else
{
/*
target = context.getExternalContext().getScriptable().getPersistentGlobalVariable("MIN_THRESHOLD_YELLOW");
markerLine.setValue(NumberDataElementImpl.create(target));
markerLine.getLabel().getCaption().setValue("Min Yellow " + target);*/
context.getExternalContext().getScriptable().setPersistentGlobalVariable("COUNTER", "1");
}
}
Is there any way to check at this point that if the value of the threshold is null then don't draw it? I can set the global variable to a flag value and check it for the flag in another method if need be. I've been looking through some API's http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.birt.chart.doc.isv%2Fchart%2Fapi%2Forg%2Feclipse%2Fbirt%2Fchart%2Fmodel%2Fcomponent%2FMarkerLine.html but I'm still looking for a solution. Any help is appreciated.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03996 seconds