Flot Chart Examples
http://www.flotcharts.org/ source from https://github.com/flot/flot
by Andy Bulka
HTML
<script src="https://raw.github.com/flot/flot/master/jquery.flot.js"></script>
<h1>Flot Examples</h1>
<div id="placeholder" style="width:600px;height:300px;"></div>
<div id="placeholder2" style="width:550px;height:200px;"></div>
JavaScript
$(function () {
var d1 = [];
for (var i = 0; i < 14; i += 0.5)
d1.push([i, Math.sin(i)]);
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
// a null signifies separate line segments
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
$.plot($("#placeholder"), [ d1, d2, d3 ]);
});
$(function () {
var css_id = "#placeholder2";
var data = [
{label: 'foo', data: [[1,300], [2,300], [3,300], [4,300], [5,300]]},
{label: 'bar', data: [[1,800], [2,600], [3,400], [4,200], [5,0]]},
{label: 'baz', data: [[1,100], [2,200], [3,300], [4,400], [5,500]]},
];
var options = {
series: {stack: 0,
lines: {show: false, steps: false },
bars: {show: true, barWidth: 0.9, align: 'center',},},
xaxis: {ticks: [[1,'One'], [2,'Two'], [3,'Three'], [4,'Four'], [5,'Five']]},
};
$.plot($(css_id), data, options);
});