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)
Displaying last label as Y-axis value
rk1981
<p>Dear All,</p><p> </p><p>we have a requirement to show the last data value( label) as the secondary y axis scale value. And also we need to show only the data point where its min and Maximum</p><p> </p><p> </p><p>Please see attached chart, could you please tell me how to accomplish this in chart scripting.</p><p> </p><p>Thanks,</p><p>RK</p><p> </p>
Find more posts tagged with
Comments
kclark
<p>What kind of data source are you using? If you're using sql then you could aggregate and group the data for your chart in the sql statement. Doing something like this</p><pre class="_prettyXprint">select sum ( amount ) as groupTotals, paymentdate, customernumberfrom paymentsgroup by paymentdate, customernumber</pre><p>Since that's grouped by the date you could then create a computed column to get the last value, then store it as a PGV then set your scale in the beforeGeneration() doing something like this</p><pre class="_prettyXprint">function beforeGeneration( chart, icsc ){ importPackage( Packages.org.eclipse.birt.chart.model.data.impl ); xAxis = chart.getBaseAxes()[0]; yAxis = chart.getOrthogonalAxes( xAxis, true)[0]; yscale = yAxis.getScale(); max = parseFloat(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("max")); yscale.setMax( NumberDataElementImpl.create(max) ); yscale.setMin( NumberDataElementImpl.create(0) ); yAxis.setScale(yscale);}</pre>