This topic is locked

Make chart size variable

12/7/2009 9:18:48 AM
ASPRunnerPro General questions
M
monye author

Dear all,
If you build a chartpage the size of the chart is fixed.
I can change the size bij changing {$invoices_Chart_chart 380 308}

in for example {$invoices_Chart_chart 540 400}
what i prefer is to use something like width="90%" in this case it scale's with the page.

i tried several things without succes.
anyone an idea?

J
Jane 12/8/2009

Peter,
unfortunately you can use static sizes only for the charts.

B
Bert 1/6/2010

Hi all,
I had the same question and found a solution to resize the chart dynamically.

Here is how:

Open the chart page in HTML mode and add this just below the body tag:

<script>

$(document).ready(function(){

jQuery.each(jQuery.browser, function(i) {

if($.browser.msie){

$("#chart__0").css("width",$(window).width()-40);

}else{

$("#chart__0").css("width",$(window).width()-40);

}

});

});

</SCRIPT>



This sets the chart width via CSS to the maximum viewport size minus 40px (depends on your template margins). The chart CSS ID is chart__0. The same can be done with the height.

There is a way to redraw the page upon a resize which works for the HTML components, however I haven't found a way to resize the flash chart as well. Anybody?

I use the jQuery library which is included in PHPRunner.
See it in action on: http://www.maatoplossing.nl/phprtest/
Bert

http://www.maatoplossing.nl/

romaldus 1/6/2010



Hi all,
I had the same question and found a solution to resize the chart dynamically.

Here is how:

Open the chart page in HTML mode and add this just below the body tag:

<script>

$(document).ready(function(){

jQuery.each(jQuery.browser, function(i) {

if($.browser.msie){

$("#chart__0").css("width",$(window).width()-40);

}else{

$("#chart__0").css("width",$(window).width()-40);

}

});

});

</SCRIPT>



This sets the chart width via CSS to the maximum viewport size minus 40px (depends on your template margins). The chart CSS ID is chart__0. The same can be done with the height.

There is a way to redraw the page upon a resize which works for the HTML components, however I haven't found a way to resize the flash chart as well. Anybody?

I use the jQuery library which is included in PHPRunner.
See it in action on: http://www.maatoplossing.nl/phprtest/
Bert

http://www.maatoplossing.nl/




thanks...this is cool...

M
monye author 1/6/2010





thanks...this is cool...



Bert thanx/Bedankt
This is usefull/Hier kan ik iets mee

romaldus 1/7/2010

There was a big problem.... i use this script in PHPrunner and it affect the whole site including view, edit, add pages....

B
Bert 1/7/2010

Hi Romaldus,
Make sure you only add this to the chart page, this way it cannot influence the rest of the pages.
Bert



There was a big problem.... i use this script in PHPrunner and it affect the whole site including view, edit, add pages....

M
monye author 2/1/2010

Bert,
Any idea how to do this in ASP runner.
i'm now using
<BODY>{$invoices_Chart_chart 500 300}</BODY></HTML
regards,
Peter

B
Bert 2/2/2010

Hi Peter,
The resizing is done by manipulating css information after displaying the html/css. So if in asp the id's of the graph is identical, it should work.

If in doubt, please post the generated html data, so I can have a look.
Best, Bert



Bert,
Any idea how to do this in ASP runner.
i'm now using
<BODY>{$invoices_Chart_chart 500 300}</BODY></HTML
regards,
Peter