RGraph: HTML5 Javascript charts library - Resizing your charts
RGraph has the facility to allow you to resize your charts. This is new as of 10th April 2010. Because of the
numerous events it has to install code on, it is unlikely to work with other dynamic features. The context
menu does though, and now that tooltips use DOM2 events, so do they. It can be useful if you are,
for example, doing a presentation and need to enlarge the chart.
All you need to do to enable it is set chart.resizable to true. There are certain caveats that you should be aware of though:
-
Charts can only be enlarged down and to the right, so you will get better results if your chart is not placed at the
right of the page.
-
The minimum you can resize your charts to is 50% of the original chart width/height.
-
Note: Resizing can change the layout of your page (reflows). As such you will need to be careful when laying out your
page, and you may need to experiment with things like CSS float:, width, height etc so that the effect is either not apparent
or is minimal.
-
If your canvas is nested within a table, resizing can result in very minor (1-2px) positioning changes. These
can be mitigated by turning off table borders, setting the cellspacing to 0 and also setting the cellpadding to 0.