Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Bar Chart Interactivity
techsavvy
Hi,
I have a requirement to expand a bar chart(magnify the ultimate display of the chart) on mouse click.
I did the following steps:
1) Created a bar chart in PNG format and in the 'initialize' method, got a copy of it and tried to set the desired properties(height and width) in the duplicated chart instance.
2) Used the 'Invoke Script' option in the Interactivity tab of Chart area and tried to swap the original image with the duplicated image(whose properties are set)
But I could not expand the chart size though I could modify other properties like Unit spacing of the bar chart on mouse click.The chart size remains the same and is not increasing.
Please suggest..
Thanks.
Find more posts tagged with
Comments
Virgil Dodson
Hi techsavvy,<br />
<br />
I created a simple example that actually creates two different charts and then uses JavaScript to set the visibility of them based on a user clicking on a chart. I uploaded it to the DevShare area at <a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/1011-magnify-birt-chart-with-javascript/#description'>Magnify
BIRT Chart with JavaScript - Designs & Code - BIRT Exchange</a>.<br />
<br />
Hope this helps.
techsavvy
Hi Virgil,
Thanks a lot.Its really cool.
It worked without errors if a remove the below code in the xml source.
<list-property name="includeScripts">
<property>hideTest.js</property>
</list-property>
(where is hideTest.js file located?)
Actually,I used an other way to magnify the chart in a new window on click of it.
1) On mouse click ,invoke 'Hyperlink' and in the 'Drill-through' option set the value of report parameters(width and height)
2) And in the onRender event called the 'beforeGeneration' function with the following code:
function beforeGeneration( chart, icsc )
{
var rpcntx = icsc.getExternalContext().getScriptable();
chart.getBlock().getBounds().setWidth(rpcntx.getParameterValue("repWidth"));
chart.getBlock().getBounds().setHeight(rpcntx.getParameterValue("repHeight"));
}
But now ,I am facing a different issue.The chart opens up infinitely in a new (BIRT Report Viewer) window on click of it everytime.
Could you please tell if there is a way to disable the 'onclick' event after the initial mouse click.
Actually this issue does not occur if i select the 'Format the target report in' option and choose 'pdf'.(in Drill-through option)
But I need to open the chart in a default way(BIRT Report Viewer) or 'html'.(i am using BIRT 2.3.1)
Could you please suggest.
Thanks.
techsavvy
Hi Virgil,
I could find a solution to prevent chart opening every time of onclick event.
I disabled the chart interactivity after first click using a report parameter and checking its value in the 'beforeRendering' function:
function beforeRendering( gcs, icsc )
{
var rpcntx1 = icsc.getExternalContext().getScriptable();
if(rpcntx1.getParameterValue("newWin") == 1){
gcs.getChartModel().getInteractivity().setEnable(false);
}
}
I would like to know if the tooltip can be made visible in the magnified chart that is displayed in a new window.(since i have disabled the chart interactivity feature for the newly generated magnified chart instance)
Could you please suggest
Thanks.