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)
Dynamix Y-axis max scale chart
msolovyov
Hello,
I want to be able to have my chart, take the max value, in the scale option, from a dataset value, that's pulled in at run time.
Right now I can only hard input a value in for the max in the scale options when you double click the chart, format chart, Y-axis, scale button.
Thanks.
Find more posts tagged with
Comments
mwilliams
Hi msolovyov,
What version of BIRT are you using?
msolovyov
2.3.1 is the version I'm running.
mwilliams
msolovyov,<br />
<br />
This <a class='bbc_url' href='
http://www.birt-exchange.com/forum/eclipse-birt-newsgroup-mirror/11431-chart-y-axis-limiting.html'>post</a>
; from the Eclipse Newsgroup Mirror may help you with that.
msolovyov
Is there a set max y axis scale function that would take a value from a data set result I can call as a script pre-generation of the chart?
---edit
after looking through that linked thread, I've progressed to this:
function beforeGeneration(chart, icsc)
{
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
xAxis = chart.getBaseAxes()[0];
yAxis1 = chart.getOrthogonalAxes( xAxis, true)[0]
yscale1 = yAxis1.getScale();
yscale1.setMin( NumberDataElementImpl.create(0) );
yscale1.setMax(NumberDataElementImpl.create(dataSetRow["name"]) );
yAxis1.setScale(yscale1); //yscale1
}
dataSetRow["name"] doesn't exist, exception is produced; when I put a number such as 10 in there, it works.
How do I link the datasetrow value properly?
msolovyov
Any ideas on how to access data returned by a query from the dataset in a chart script?
Virgil Dodson
This post should help <a class='bbc_url' href='
http://www.birt-exchange.com/forum/designing-birt-reports/12847-how-draw-dynamic-marker.html'>http://www.birt-exchange.com/forum/designing-birt-reports/12847-how-draw-dynamic-marker.html</a>
;
msolovyov
Thanks, I found your post earlier today at <a class='bbc_url' href='
http://www.birt-exchange.com/blog/2008-02-01/birt-chart-scripting-dynamic-markers/'>BIRT
Chart Scripting: Dynamic Markers » Blog - BIRT Exchange</a><br />
<br />
it helped a lot, it works now. <br />
<br />
the final onrender script for the chart looks like this: function beforeGeneration(chart, icsc)<br />
{<br />
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );<br />
importPackage(Packages.org.eclipse.birt.chart.model.component.impl); <br />
<br />
importPackage(Packages.org.eclipse.birt.chart.model.attribute); <br />
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl); <br />
var chart = icsc.getChartInstance();<br />
var trunkVar = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("trunk");<br />
xAxis = chart.getBaseAxes()[0];<br />
<br />
yAxis1 = chart.getOrthogonalAxes( xAxis, true)[0]<br />
yscale1 = yAxis1.getScale();<br />
yscale1.setMin( NumberDataElementImpl.create(0) );<br />
yscale1.setMax(NumberDataElementImpl.create(trunkVar) ); <br />
yAxis1.setScale(yscale1); //yscale1<br />
<br />
<br />
}<br />
<br />
<br />
I had to create a table from the data set and then make a script in it for the set global variable statement. Have to figure out how to make the chart hidden now. Thanks so much for your article. I wish there was a big book on birt scripting.