Line chart with scrolling effect
This goes in the documents header:
<script src="RGraph.common.core.js"></script>
<script src="RGraph.line.js"></script>
Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250">
[No canvas support]
</canvas>
This is the code that generates the chart:
<script>
data = RGraph.arrayPad([], 500);
function DrawGraph ()
{
RGraph.clear(document.getElementById("cvs"));
RGraph.ObjectRegistry.clear();
var line = new RGraph.Line({
id: 'cvs',
data: data,
options: {
colors: ['green'],
linewidth: 1,
filled: true,
filledColors: 'rgba(128,255,128,0.5)',
yaxisScaleMax: 60,
tickmarksStyle: null,
shadow: false,
xaxisTickmarksCount: 5,
xaxisLabels: ['Now','25s','50s','75s','100s','125s'],
backgroundGridVlinesCount: 5
}
}).draw();
r = RGraph.random(45,55);
data = [r].concat(data);
data.pop();
setTimeout(DrawGraph, 250);
}
DrawGraph();
</script>