Dynamically change Meter chart scale

canutri
canutri Member
edited February 11, 2022 in Analytics #1

Comments

  • mwilliams
    mwilliams Member
    edited December 31, 1969 #2
    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/
    Warning No formatter is installed for the format ipb
  • canutri
    canutri Member
    edited December 31, 1969 #3
    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
    mwilliams Member
    edited June 23, 2011 #4
    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?
    Warning No formatter is installed for the format ipb
  • canutri
    canutri Member
    edited December 31, 1969 #5
    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
    mwilliams Member
    edited December 31, 1969 #6
    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.
    Warning No formatter is installed for the format ipb
  • canutri
    canutri Member
    edited December 31, 1969 #7
    I get the concept and will make an attempt at coding it properly. Stay tuned...
  • canutri
    canutri Member
    edited December 31, 1969 #8
    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
    mwilliams Member
    edited December 31, 1969 #9
    You're welcome. Glad you got it working. Let us know whenever you have questions! :)
    Warning No formatter is installed for the format ipb