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)
Marker Line and Range Label Showing Even Though Value Isn't Reached
bcs0629
<p>Hey all, I'm looking at trying to use a Marker label for one of my charts that'll display when a certain value is reached. I've noticed that labels will show right above the chart regardless of if that value is there or not. I set up a range and a line and both behaved the same way, with the label showing even if the value wasn't in the chart. I would think that if the value you specified for the range wasn't on the chart then the label/range also wouldn't show up. In the example I have a range called 'Unsafe to Train' that starts at 16000. The first chart properly hits the range, but the second chart only goes up to 12000, yet 'Unsafe to Train' still shows. I wouldn't think the second chart would show the label since 16000 is never reached. I could always force a min and max scale but I'd rather leave it dynamic if possible, any suggestions? I'm using 3.72.</p><p> </p><p>
Find more posts tagged with
Comments
kclark
<p>I've attached an example of one way you could do this. I created a hidden table that groups on the same row that my chart uses for the x-axis series. Then I created a aggregation item in the group footer that checks for a value over n. If any of the values are over n the I set a PGV called setMarker to true.</p><p> </p><p>Now that I know if the chart goes over that value or not I can create the marker using a script like this.</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.getAxes().get(0).getAssociatedAxes().get(0);var setMarker = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("setMarker"); if(setMarker == "true") { marker = MarkerLineImpl.create(yAxis, NumberDataElementImpl.create(3600000)); marker.getLabel().getCaption().setValue("3600000"); marker.getLineAttributes().getColor().set(255,0,0); }}</pre>