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)
How can I force a chart to fill the entire view?
jshaw
<p>Hi, if I place a Chart object in a Grid, with the grid's horizontal setting as 100%, how can i force the chart to fill that whole space. There is no 100% on the Chart object, i have to specify a distinct width, say 10.5in, That looks ok on a PDF but poor on-screen since it might only fill 50% of the space available.</p>
<p> </p>
<p>Birt 4.4.0</p>
<p> </p>
Find more posts tagged with
Comments
JFreeman
<p>What you can do to work around this is use client side scripting to adjust the dimensions of the chart is the browsers DOM tree. You can do this using a text element in the report design.</p>
<p> </p>
<p>For example, if the chart is bookmarked as "myChart", the following code in a text element will adjust the charts size within the browser:</p>
<pre class="_prettyXprint _lang-html">
<script>
var myChart = document.getElementById("myChart");
myChart.style.width = "75%";
myChart.style.height = "75%";
</script>
</pre>
<p>One caveat is this is not going to re-render the chart to the specified dimensions it is just going to stretch/shrink the already rendered chart object. For best results, set the fixed dimensions on the chart to a larger size, such as 1600px/900px or larger.</p>
jshaw
<p>Hi, thanks a lot for your reply only I am not exactly sure how to implement what you describe. This is what i tried:</p>
<p> </p>
<p>- I named the chart, so in General tab, Name = MyChart</p>
<p> </p>
<p>- I added a text element, changed it to HTML, added your code.</p>
<p> </p>
<p>- When i run in the viewer i don't see any affect on Chart size due to the code, so it doesn't seem to be called. Any ideas? </p>
JFreeman
<p>The text element hooks the charted based on what is set for the bookmark and not the name. The value of the bookmark is what is used as the elements id in the DOM tree.</p>
<p> </p>
<p>If you set the charts bookmark to "myChart", the above code should run properly.</p>