Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Setting MarkerLine by script (source from db)
minthril
<p>Hello,</p><p>I would like to set 2 MarkerLines dynamically. The one has its value from parameter (and I was able to do it by myself. See attachment) but the second has source from Data in table (in Grid..) ... and I have no idea how to write properly handling of this situation..</p><p> </p><p>Do anyone could help me to set MarkerLine value(label - "valFromTable")? Please look at attachment.</p><p> </p><p> </p><p>It is code for setting MarkerLine in chart - onRender</p><pre class="_prettyXprint">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);importPackage(Packages.org.eclipse.birt.chart.util);function beforeDrawMarkerLine( axis, markerLine, icsc ){if(markerLine.getLabel().getCaption().getValue() == "paramValue") { var cdt = icsc.getExternalContext().getScriptable().getParameterValue("paramValue"); markerLine.setValue(NumberDataElementImpl.create(cdt)); markerLine.getLabel().getCaption().setValue("param val: " + cdt); }}</pre><p>Best regards,</p><p>minthril</p><p> </p>
Find more posts tagged with
Comments
GLO_FR
<p>Hi,</p><p> </p><p>you can do the same by using a variable in which your store the value from the db.</p><p> </p><p>On the OnCreate event of your table cell, create a variable.</p><pre class="_prettyXprint _lang-js">reportContext.setPersistentGlobalVariable("MarkerLineValue",this.getValue()); </pre><p>Use it in the chart the same way you've done it with the parameter value.</p><pre class="_prettyXprint _lang-js">function beforeDrawMarkerLine( axis, markerLine, icsc ){var cdt="";if(markerLine.getLabel().getCaption().getValue() == "parameter") { cdt = icsc.getExternalContext().getScriptable().getParameterValue("parameter"); markerLine.getValue().setValue(cdt); markerLine.getLabel().getCaption().setValue("parameter: " + cdt); } if(markerLine.getLabel().getCaption().getValue() == "valFromTable") { cdt = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("MarkerLineValue"); markerLine.getValue().setValue(cdt); markerLine.getLabel().getCaption().setValue("Value from db : " + cdt); } }</pre><p>Here is your example updated</p>
minthril
<p>Thanks a lot!
I tried something like this but without proper result
Your updated file had problem with chart - I corrected (used your tips) my file in first post - for people who need it - there is example of solution
</p>
GLO_FR
<p>Hi,</p><p> </p><p>Sorry for that, I've used BIRT Designer Pro, so maybe, the version in not the correct one.</p><p> </p><p>Here is the same report in BIRT 3.7.2</p><p> </p><p> </p><p> </p>
minthril
<p>Hello again,</p>
<p>I have question about setting the height of label near MarkerLine. Now I have situation that two MarkerLines are very close and the Labels overlaps. Is there some easy way to set one Label little lower than the second one? (Please see attached image - I would like to have design like for red "text1" and "text2")</p>
<p> </p>
<p>In my design I use the almost the same script as used in example.rptdesign</p>
<p> </p>
<p>Thanks for help</p>
<p> </p>
<p>Best regards,</p>
<p>minthril</p>