This Scatter chart shows sample financial data. It looks like it does because there are many datapoints.
This goes in the documents header:<script src="RGraph.common.core.js"></script> <script src="RGraph.scatter.js"></script>Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="200"> [No canvas support] </canvas>This is the code that generates the chart:
<script>
<// Generate the financial data
value = 5;
data = [];
for (var i=0; i<365; i+=1) {
data.push([i,value]);
value += RGraph.random(-1, 1);
value = Math.max(0, value)
value = Math.min(10, value)
}
new RGraph.Scatter({
id: 'cvs',
data: data,
options: {
yaxisScaleMax: 10,
xaxisScaleMin: 0,
xaxisScaleMax: data.length,
xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
tickmarksStyle: null,
line: true,
lineColors: ['red'],
yaxisScaleUnitsPre: '$',
marginTop: 40,
marginLeft: 40,
title: 'Sample financial data',
backgroundGridColor: '#eee',
backgroundGridVlinesCount: 64,
backgroundGridHlinesCount: 20,
xaxis: false
}
}).draw();
</script>