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)
Adjust chart size according with browser dimensions
reportBirt_user
<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
Clement Wong
<p>Have you look at the solutions posted in the other dynamic resize chart thread?</p>
<p> </p>
<p>Post #6 for OS BIRT:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/39379-dynamic-chart-size-html-windowinnerwidth-width-grid/?p=144490'>http://developer.actuate.com/community/forum/index.php?/topic/39379-dynamic-chart-size-html-windowinnerwidth-width-grid/?p=144490</a></p>
;
<p> </p>
<p>And also another solution in post #4 for OS BIRT:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/39379-dynamic-chart-size-html-windowinnerwidth-width-grid/?p=144470'>http://developer.actuate.com/community/forum/index.php?/topic/39379-dynamic-chart-size-html-windowinnerwidth-width-grid/?p=144470</a></p>
;
<p> </p>
<p>I was able to run those examples in OS BIRT 2.6.2 by modifying the report design's XML:</p>
<p> </p>
<p>Replace lines 2 and 3 with this:</p>
<p><span style="font-family:'courier new', courier, monospace;"><report xmlns="<a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/2005/design'>http://www.eclipse.org/birt/2005/design"</a>version="3.2.22"
; id="1"> <br>
<property name="createdBy">Eclipse BIRT Designer Version 2.6.2.r262_v20110209 Build <2.6.2.v20110219-1842></property></span></p>