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)
Group charts and dynamic setting of axis and labels
karis
I have a a report where we are reporting bar charts for different variables. I am using a table with a Table group to generate the data set for each individual chart, which is placed in the Group Header. The binding to the table is to the Dataset and the charts inherit data from their container.
What I am trying to do is to set the Y axis label to the unit value ("testUnits") in the data set dynamically. I also want to set the Y axis scale to certain values depending on the measure ("testName") which is what the grouping is done by. I am trying to set global variables in the onPrepare method of the group header row so I can access these in the beforeGeneration method of the charts. Unfortunately I can't seem to access the row bindings this way.
reportContext.setPersistentGlobalVariable("unit", row["testUnits"]);
ReferenceError: "row" is not defined. I also get the same trying dataSetRow, data etc.
I don't think I can set these global variables in the onFetch method of the dataSet as it won't change for the various groupings, am I correct?
How can I access these values in the group?
Find more posts tagged with
Comments
Hans_vd
Hi Karis,
Try the onCreate method on the header row instead of the onPrepare method to set the global variable.
Does that work?
karis
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="114474" data-time="1361784930" data-date="25 February 2013 - 02:35 AM"><p>
Hi Karis,<br />
Try the onCreate method on the header row instead of the onPrepare method to set the global variable.<br />
Does that work?<br /></p></blockquote>
<br />
That did the trick, thanks!
Hans_vd
This is a source that has often helped me in cases like this:
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php
Take a look at the event firing order representation of the generation phase. You'll see that the onPrepare events occur before any data is fetched.