Home
Analytics
Dynamically change Meter chart scale
canutri
Find more posts tagged with
Comments
mwilliams
Hi Daron,
Sorry for the delayed response. Check out this devShare post:
http://www.birt-exchange.org/org/devshare/designing-birt-reports/377-change-meter-scale-with-script/
canutri
Hi Michael,
That's exactly what I was looking for! But the example is still somewhat static in that the .setMin and .setMax values are nothing more than literals in the script itself.
I would like to set the min/max value 10% lesser/greater than the current performance value I'm obtaining from my db query. For example, if the current performance value is -51, then I want to set the min value to -55. The performance value is derived from row["CURRENTPERFORMANCE"]. There must be some way to reference the this column from the dataset directly in the script. Can I reference a dataset column in the script?
As you can see, I'm not too familiar with the scripting model. Where would I begin to learn more about such?
Thank you,
Daron
mwilliams
What is your BIRT version? I'll see if I can put something together. Is your value the only value in its dataSet? Or are you doing several meter charts in your report that will pull from the dame data?
canutri
Hi Michael,<br />
<br />
Sorry for the late response as I thought I should be getting an email to follow this post. I'll have to check into why I'm not<br />
<br />
I'm using BIRT 2.3.2.<br />
<br />
mwilliams
Since your dataSet is only 1 row, you can simply set a persistentGlobalVariable with the values you need to access in the chart. You'd do this in the onFetch method of your dataSet. Then, in your chart script, you can recall the PGV(s) you set to determine what you need to do with the scale. Let me know if you need an example.
canutri
I get the concept and will make an attempt at coding it properly. Stay tuned...
canutri
I'm just getting back to this having returned from vacation.
As luck would have it, I use your guidance for this on another similar - non chart - report and all is well after a bit of trial and error. A few google searches and I stumbled acrossed reportContext.setPersistentGlobalVariable() & .getsetPersistentGlobalVariable()
The chart required some further searches to realize the context was the 2nd parameter of the chart's beforeGeneration function.
Thanks for pointing me in the right direction!
mwilliams
You're welcome. Glad you got it working. Let us know whenever you have questions!