A basic example of clearing your canvas

This is a demonstration of how the RGraph.reset(canvas) function may be preferable to the RGraph.clear() function. It's particularly apt if you're using the same canvas to show multiple charts. Because RGraph tracks objects so that it can redraw them you may find that old charts are redrawn. In this case you can use the RGraph.reset(canvas) function instead of the RGraph.clear(canvas) function to eliminate traces of prior charts.

[No canvas support]

This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.dynamic.js"></script>
<script src="RGraph.common.tooltips.js"></script>
<script src="RGraph.line.js"></script>
<script src="RGraph.bar.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">[No canvas support]</canvas>

<button onclick="drawBar()">Draw the Bar chart</button>
<button onclick="drawLine()">Draw the Line chart</button>
<button onclick="RGraph.clear(document.getElementById('cvs'))">Clear the canvas</button>
<button onclick="RGraph.reset(document.getElementById('cvs'))">Reset the canvas</button>
<button onclick="RGraph.redraw()">Redraw the canvas</button>
This is the code that generates the chart: