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)
Dinamic Y - Axis Title
aaraya
hello,
I have, a char in the header of a table group,
I need the axis Y text is changed dynamically,
I tested the following.
the column i need display in axis y is "unidad"
table group on create
var max = this.getRowData().getColumnValue("unidad");
reportContext.setPersistentGlobalVariable("unidad", max);
on char
function beforeGeneration( chart, icsc )
{
var ci = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("unidad");
xAxis = chart.getBaseAxes()[0];
yAxis = chart.getOrthogonalAxes( xAxis, true)[0];
yAxis.getTitle().getCaption().setValue(ci);
}
in the internal viewer works perfect,
but in tomcat viewer just repeats the same value for all group
using 3.7.2 version of birt.
tranks for your help.
Find more posts tagged with
Comments
icirillo
I had a look at this problem but I was not able to find a solution.
I was able to reproduce the problem in BIRT 3.7.2. Your code actually works and modify the yaxis title dynamically, but it seems that every time you try to change the yaxis value all the charts are affected (on every group header).
I attach my report as example. If anyone have any idea on how to solve this problem it would be really interesting.
I also find strange that you are able to get it working in the designer. I don't.
mwilliams
Can you recreate your issue with the sample database and attach the report in here?
Edit:
icirillo, I didn't see you had posted already before I did. Also, I don't see your example. Can you try reattaching it.
icirillo
<blockquote class='ipsBlockquote' data-author="'icirillo'" data-cid="106836" data-time="1341242342" data-date="02 July 2012 - 08:19 AM"><p>
I had a look at this problem but I was not able to find a solution.<br />
<br />
I was able to reproduce the problem in BIRT 3.7.2. Your code actually works and modify the yaxis title dynamically, but it seems that every time you try to change the yaxis value all the charts are affected (on every group header). <br />
<br />
I attach my report as example. If anyone have any idea on how to solve this problem it would be really interesting.<br />
<br />
<br />
I also find strange that you are able to get it working in the designer. I don't.<br /></p></blockquote>
<br />
<br />
The report...
mwilliams
If you move your onCreate code to the onRender, the attached report works as expected.
icirillo
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="106839" data-time="1341243109" data-date="02 July 2012 - 08:31 AM"><p>
If you move your onCreate code to the onRender, the attached report works as expected.<br /></p></blockquote>
<br />
<br />
<br />
Really surprising!<br />
<br />
But I'm still not able to figure out why this change let it working correctly.
mwilliams
When you use the viewer frameset, the run and render tasks are ran separately, so if you only use one global variable, whatever the value of the last row is, will be the value when the run task is complete. Now, you run the render task and it calls the appropriate variable that you've requested. And as I said, since the onCreate scripts have already ran, you're stuck with the one value that happens to be the last value. That's why you saw USA in all of them.
If you were to run the original report in preview or run modes, where the runAndRender task is used, it probably would have worked just fine. Hope this makes sense!
icirillo
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="106842" data-time="1341244289" data-date="02 July 2012 - 08:51 AM"><p>
When you use the viewer frameset, the run and render tasks are ran separately, so if you only use one global variable, whatever the value of the last row is, will be the value when the run task is complete. Now, you run the render task and it calls the appropriate variable that you've requested. And as I said, since the onCreate scripts have already ran, you're stuck with the one value that happens to be the last value. That's why you saw USA in all of them.<br />
<br />
If you were to run the original report in preview or run modes, where the runAndRender task is used, it probably would have worked just fine. Hope this makes sense!<br /></p></blockquote>
<br />
<br />
Yes, much better, thanks !!
aaraya
now it works perfect,
move oncreate to onrender .. and works !!
var max = this.getRowData().getColumnValue("unidad");
reportContext.setPersistentGlobalVariable("unidad", max);
thanks for the help
mwilliams
You're welcome. Let us know whenever you have questions!
icirillo
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="106842" data-time="1341244289" data-date="02 July 2012 - 08:51 AM"><p>
When you use the viewer frameset, the run and render tasks are ran separately, so if you only use one global variable, whatever the value of the last row is, will be the value when the run task is complete. Now, you run the render task and it calls the appropriate variable that you've requested. And as I said, since the onCreate scripts have already ran, you're stuck with the one value that happens to be the last value. That's why you saw USA in all of them.<br />
<br />
If you were to run the original report in preview or run modes, where the runAndRender task is used, it probably would have worked just fine. Hope this makes sense!<br /></p></blockquote>
<br />
I have found the official explanation on <a class='bbc_url' href='
http://eclipse.org/birt/phoenix/deploy/viewerUsageMain.php'>http://eclipse.org/birt/phoenix/deploy/viewerUsageMain.php</a>
; paragraph "Servlet Mappings".<br />
<br />
Thanks again for the clarification.