Dynamic dial chart scale [message #948956] |
Thu, 18 October 2012 14:48 |
Tobbi Filteau Messages: 10 Registered: September 2011 |
Junior Member |
|
|
I'm currently doing a sparkline chart in BIRT that resembles the one presented here (just so you have a general idea of what sort of context I'm working with):
http://www.eclipse.org/forums/index.php/m/682572/
This part went swimmingly, but now, I'd like a dial chart at the end of the line that shows where the average payment is located in relation with the maximum payment and the minimum payment.
So essentially, I want the minimum payment as the minimum value on the dial's scale and the maximum payment as the maximum value on the dial's scale. So, I created three aggregations in my table to extract this data (one for the average, one for the max and one for the min).
However, while I can set these aggregations as dials for the chart, I can't set any of them as the max and min for the scale. In my case, hardcoded values are impossible to set since, from one product to another, my values change greatly (for example, one can be between 100 and 200 while the next goes from 5000 to 10000... try hardcoding that!!!). And there's also WAY too many product to do each one of them by hand.
Obviously, the chart has access to the aggregations since I can choose them for dials... so why only dials and not the min and max of the scale too? I saw this post:
www.birt-exchange.org/org/devshare/designing-birt-reports/377-change-meter-scale-with-script/
which sets the min and max via a script... but again the values are hardcoded, which sucks because it's otherwise exactly what I need to do.
Any suggestion would be greatly appreciated.
Thanks
|
|
|
Re: Dynamic dial chart scale [message #949392 is a reply to message #948956] |
Fri, 19 October 2012 00:22 |
|
Is the dial going to be in the row? Meaning will you have multiple dials? If you only have one and it is in the table, put an oncreate script on the row containing it and enter a script like:
var myMin = this.getRowData().getColumnValue("nameofyourmincolbinding");
var myMax = this.getRowData().getColumnValue("nameofyourmaxcolbinding");
reportContext.setPersistentGlobablVariable("myMin", myMin);
reportContext.setPersistentGlobablVariable("myMax", myMax);
Then in the chart script
mscale.setMin( NumberDataElementImpl.create(parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("mymin")) );
mscale.setMax( NumberDataElementImpl.create( parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("mymax")) );
Jason
|
|
|
|
Powered by
FUDForum. Page generated in 0.03734 seconds