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)
Change meter chart max scale value dynamically
Max Bo
<p>Hi,</p><p> </p><p>I have a recordset with the following data:</p><p> </p><p>open_task | finished_task | total_task</p><p>100 | 250 | 350</p><p> </p><p>Now I want to display these values with a meter chart, the needle representing the finished task, the max. scale representing the total_task.</p><p> </p><p>I see that I can set the max. scale value of a meter chart by "cheating" and defining a second value series with the total_task value. Is there any other 'cleaner' way to achive this?</p><p> </p><p>Regards</p><p> </p><p>Max</p>
Find more posts tagged with
Comments
kclark
<p>Take a look at <a data-ipb='nomediaparse' href='
http://www.birt-exchange.org/devshare/_/designing-birt-reports/377-change-meter-scale-with-script'>this
devshare</a>. You can set the scale from script in the beforeGeneration() of the meter chart.</p>
Max Bo
<p>Thanks! Can you also give me a hint on how to read the data from the recordset in the script in order to use it?</p>
kclark
<p>No problem! In the onFetch() of your data set you can set a PGV doing something like this</p><pre class="_prettyXprint">reportContext.setPersistentGlobalVariable("maxValue", row["DATA"]);</pre><p>And you could check to make sure you're putting the largest value in the PGV from there. Then when you're setting the max value of your chart you can recall this variable and use that data.</p>
Max Bo
<p>Thanks, I will give this a try!
</p>
kclark
<p>You're welcome, let me know if it works for you!
</p>
awilson430
<p>I am having the same need to dynamically set the max value on the BIRT meter scale. I am able to get the chart script, referred to above, to work with set values, but am having trouble using the dataset script to read a value from a table and set it in the chart script. I have the idea of how to do it, but I don't seem to be able to get the syntax right. My dataset name is DataSet, and it is a single column, single row table. My column header is ArchElCount. Would you please help me with the code to take the value from the table and apply it to the maxvalue for the chart scale