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 {
margin-top: 20px;
width: 480px;
height: 360px;
}
JavaScript
(function basic(container) {
var
d1 = [[0, 33], [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)]);
}
// Draw Graph
graph = Flotr.draw(container, [
{
lines : {
show : true
},
data : d1
},
{
lines : {
show : true,
steps : true
},
data : d2
}
], {
xaxis: {
minorTickFreq: 4
},
yaxis: {
autoscale: true
},
grid: {
minorVerticalLines: true
},
mouse : {
track : true,
relative : true
}
});
})(document.getElementById("example"));