Home
Designing Analytics Reports
Adjust chart size according with browser dimensions
Migrateduser
<p>Hi Everyone, <br><br>
I work with Birt 2.6 OS version and i tried to turn the dimensions of chart dynamic according with the height and width of each browser that run my report. I use this HTML code and i can have the dimensions: <br>
</p>
<div>
<pre class="_prettyXprint">
<html>
<head>
<title>Hier steht der Seitentitel</title>
<script language="JavaScript">
var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
alert(width);
alert(height);
<html>
<head>
<title>Hier steht der Seitentitel</title>
<script language="JavaScript">
var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
alert(width);
alert(height);
//reportContext.setPersistentGlobalVariable("width_global",width);
//reportContext.setPersistentGlobalVariable("height_global",height);
</script>
</head></pre>
<p>The problem is i can't save this on two global variables to after that it will be possible to use this script on onRender event of chart like this code: <br>
</p>
<div>
<pre class="_prettyXprint">
function afterDataSetFilled( series, dataSet, icsc, params )
{
</pre>
<div>//icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("width_global")</div>
<div>//icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("height_global")</div>
icsc.getChartInstance().getBlock().getBounds().setWidth("width_global"); // width icsc.getChartInstance().getBlock().getBounds().setHeight("height_global"); // heigth }
<p>This is possible to do on Birt OS version or exists some workaround to do that ?</p>
<p> </p>
<p>I already consult your forum many times and all the times you helped me. </p>
<p> </p>
<p>Thanks for your work and for the help. </p>
</div>
</div>
<div> </div>
<div>Best Regards</div>
Find more posts tagged with
Comments
There are no comments yet