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 {
    margin-top: 20px;
    width: 480px;
    height: 360px;
}

JavaScript

(function basic(container) {

  var
    d1 = [],                                // Second data series
    i, graph;

  // Generate first data set
  for (i = 0; i < 14; i += 0.5) {
    d1.push([i, 10 + Math.sin(i) / 2]);
  }

  // Draw Graph
  graph = Flotr.draw(container, [ d1 ], {
    xaxis: {
      minorTickFreq: 4
    },
    yaxis: {
      min: 0,
      autoscale : true,
      noTicks : 11
    },
    grid: {
      minorVerticalLines: true
    }
  });
})(document.getElementById("example"));