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)
Problem with "Web Viewer"
blub1.0
Hello, I?m searching for an expert, who can help me with chart-scripting.
I have a code, which creates 2 MarkerLines and scales the y-axis. This works very good in the preview and on the ?View Report as HTML? or ?View Report as PDF?.
My Problem is: It didn't work on the ?View Report in Web Viewer?.
It looks like the GlobalVariable is ?null?.
Code:
?
icsc.getExternalContext().getScriptable().getGlobalVariable("maximum");
?
Why does it work in 3 of 4 cases?
Has anyone an idea?
Thanks a lot for your help.
Find more posts tagged with
Comments
kosta
Hello blub1.0,
I have another question:
what do you mean by: "I have a code, which creates 2 MarkerLines and scales the y-axis"?
Do you create them programmatically. How do you do that?
Regards,
Kosta
blub1.0
Hello kosta,<br />
<br />
this is my chart-script:<br />
<br />
<p class='bbc_indent' style='margin-left: 40px;'><span style='color: #4169E1'>function beforeGeneration( chart, icsc )<br />
{<br />
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.attribute);<br />
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);<br />
<br />
var chart = icsc.getChartInstance();<br />
var yAxis = chart.getAxes().get(0).getAssociatedAxes().get(0);<br />
var min_value = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("mini");<br />
var max_value = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("maxi");<br />
var max_max = icsc.getExternalContext().getScriptable().getGlobalVariable("maximum");<br />
<br />
min_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(min_value));<br />
max_ml = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(max_value));<br />
<br />
//label, color and style of the markers<br />
min_ml.getLabel().getCaption().setValue(" ");<br />
max_ml.getLabel().getCaption().setValue(" ");<br />
min_ml.getLineAttributes().getColor().set(0,128,0);<br />
max_ml.getLineAttributes().getColor().set(255,0,0);<br />
min_ml.getLineAttributes().setStyle(LineStyle.SOLID_LITERAL);<br />
max_ml.getLineAttributes().setStyle(LineStyle.SOLID_LITERAL);<br />
min_ml.getLineAttributes().setThickness(2); //Dicke des Balkens<br />
max_ml.getLineAttributes().setThickness(2); //Dicke des Balkens<br />
<br />
//scales the y-axis<br />
xAxis = chart.getBaseAxes()[0]; <br />
yAxis = chart.getOrthogonalAxes( xAxis, true)[0];<br />
yscale = yAxis.getScale(); <br />
yscale.setMin( NumberDataElementImpl.create(0)) ;<br />
yscale.setMax( NumberDataElementImpl.create(max_max));<br />
yAxis.setScale(yscale);<br />
}</span></p>
<br />
The variables mini and maxi are values from a aggregation of a table. <br />
Maximum is calculated on the table-script.<br />
<br />
<br />
By blub1.0
blub1.0
Hello,
okay I have a solution.
I have to find out that in charts PersistentGlobalVariable work, but GlobalVariable don?t work.
Because it don?t work to write a local variable in a PersistentGlobalVariable, I writing it in a table (this.setDisplayValue(xyz)). After this I write the value of this cell in an PersistentGlobalVariable (reportContext.setPersistentGlobalVariable("maximum",this.getValue())).
This isn?t very elegant, but it works!
Thanks at all who read my question.