Tweet about RGraph
Follow for HTML5 news
Bookmark and share:

# RGraph: HTML5 canvas graph library - Resizing your graphs

RGraph has the facility to allow you to resize your graphs. 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 graph.

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:

- Graphs can only be enlarged down and to the right, so you will get better results if your graph is not placed at the right of the page.
- The minimum you can resize your graphs to is 50% of the original graph 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 for example) positioning changes. These can be mitigated by turning off table borders, setting the cellspacing to 0 and also setting the cellpadding to 0.