Basic Flotr Example
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 = [[0, 3], [4, 8], [8, 5], [9, 13]], // First data series
d2 = [], // Second data series
i, graph;
// Generate first data set
for (i = 0; i < 14; i += 0.5) {
d2.push([i, Math.sin(i)*5 + 5]);
}
// Draw Graph
graph = Flotr.draw(container, [
{label: 'd1', data: d1},
{label: 'd2', data: d2, hide: true}
],
{
xaxis: {
minorTickFreq: 4
},
grid: {
minorVerticalLines: true
},
mouse: {
track:true,
sensibility: 5
}
});
})(document.getElementById("example"));