Asynchronous processing can speed up the display of your graphs, because the browser gets to your code, sets it going and then continues on rendering the page. Particularly if you have a weighty page, it can make quite a difference. The RGraph.Async() function itself is very simple, but because it can make a significant difference to the speed of your page, it is documented here. There's an example of it below. The front page also uses it. One thing to remember is to ensure your canvas tag is defined first before you set the function that creates the graph going.
<script src="RGraph.common.js"><script> <script src="RGraph.line.js"><script> <canvas id="myCanvas" width="300" height="100">[No canvas support]<canvas> <script> /** * Create the line graph */ function CreateLineGraph () { line = new RGraph.Line('myCanvas', [1,2,4,2,1,3,5,6,6,5,3,5]); line.Set('chart.title', 'Sales for Acme Inc.'); line.Set('chart.labels', ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']); line.Draw(); } RGraph.Async(CreateLineGraph); <script>
Things to remember