Basic Flotr Example
by cesutherland
HTML
<script src="https://raw.github.com/HumbleSoftware/Flotr2/master/flotr2.min.js"></script>
<link rel="stylesheet" href="https://raw.github.com/HumbleSoftware/Flotr2/master/examples/examples.css">
<div id="example"></div>
CSS
#example {
width: 340px;
height: 220px;
}
JavaScript
(function basic(container) {
var
d1 = [],
price = 3.206,
graph,
i, a, b, c;
for (i = 0; i < 50; i++) {
a = Math.random();
b = Math.random();
c = (Math.random() * (a + b)) - b;
d1.push([i, price, price + a, price - b, price + c]);
price = price + c;
}
// Graph
graph = Flotr.draw(container, [ d1 ], {
candles : { show : true, candleWidth : 0.6 },
xaxis : { noTicks : 10 },
mouse : {
track : true,
relative : true
}
});
})(document.getElementById("example"));