Flotr2

Flotr2 is a library for drawing HTML5 charts and graphs.

(function () {
var
container = document.getElementById(‘container’),
start = (new Date).getTime(),
data, graph, offset, i;
// Draw a sine curve at time t
function animate (t) {
data = [];
offset = 2 * Math.PI * (t – start) / 10000;
// Sample the sine function
for (i = -2.0; i <= 2.05; i += 0.1) {
data.push([i, Math.sin(i – offset) * Math.exp (-i*i)]);
}
// Draw Graph
graph = Flotr.draw(container, [ data ], {
xaxis : { max : 2.0, min : -2.0 },
yaxis : { max : 1.0, min : -1.0 }
});
// Animate
setTimeout(function () {
animate((new Date).getTime());
}, 50);
}
animate(start);
})();

Leave a Reply

Your email address will not be published. Required fields are marked *