Commit b8b962d9 authored by Sören Henning's avatar Sören Henning

added real-time test

parent 2337f4eb
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CanvasPlot Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="canvasplot.css">
<script src="dep/demo/jquery-2.2.3.min.js" charset="utf-8"></script>
<script src="dep/canvasplot/d3.min.js" charset="utf-8"></script>
<script src="canvasplot.js" charset="utf-8"></script>
</head>
<body>
<div id="maincontainer">
</div>
<script type="text/javascript">
function getDemoPlotSize() {
return [window.innerWidth-100, Math.round(0.45*(window.innerWidth-100))];
}
$(document).ready(function() {
var lastValue = Math.random()*1000;
var ts = [[new Date(), lastValue]];
var plot = new CanvasTimeSeriesPlot(d3.select("#maincontainer"), getDemoPlotSize(), {
yAxisLabel: "Stock Index"
});
plot.addDataSet("ds", "Stock Index", ts, "steelblue", true, true);
plot.setZoomYAxis(false);
$(window).resize(function() {
plot.resize(getDemoPlotSize());
});
setInterval(function() {
lastValue += ((Math.random() * 20) - 10);
var newDataPoint = [new Date(), lastValue];
plot.addDataPoint("ds", newDataPoint, true, true);
}, 100);
});
</script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment