If you're making a single-page-application you can put the
libraries inline if you want to. Simply copy the contents
of the RGraph library files (all of the necessary libraries
to make your chart) in a <script>
tag at either the
top or bottom of your page. If you put the tags at the
bottom of the page (like this example) you'll most likely
need to use the
DOMContentLoaded
or window.onload
events to create the chart.
<script> // Put the source code of the RGraph.common.core.js file // here - all 10,000+ lines of it. </script> <script> // Put the source code of the RGraph.bar.js file // here. </script>Put this where you want the chart to show up:
<div style="display: inline-block; margin: 35px"> <canvas id="cvs" width="600" height="300">[No canvas support]</canvas> </div>This is the code that generates the chart - it uses the
window.onload
event so you can put it anywhere:
<script> window.onload = function () { new RGraph.Bar({ id: 'cvs', data: [45,23,56,15,58,59,45], options: { xaxisLabels: ['Jill','Joseph','Joe','Jim','July','Jake','John'], textSize: 20, backgroundGridVlines: false, backgroundGridBorder: false, xaxis: false, yaxis: false } }).draw(); }; </script>