Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21627 kshitij.so 1
<!doctype html>
2
<head>
3
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
4
  <script src="https://raw.github.com/DmitryBaranovskiy/raphael/300aa589f5a0ba7fce667cd62c7cdda0bd5ad904/raphael-min.js"></script>
5
  <script src="../morris.js"></script>
6
  <script src="lib/prettify.js"></script>
7
  <script src="lib/example.js"></script>
8
  <link rel="stylesheet" href="lib/example.css">
9
  <link rel="stylesheet" href="lib/prettify.css">
10
  <link rel="stylesheet" href="../morris.css">
11
</head>
12
<body>
13
<h1>Bar charts</h1>
14
<div id="graph"></div>
15
<pre id="code" class="prettyprint linenums">
16
// Use Morris.Bar
17
Morris.Bar({
18
  element: 'graph',
19
  data: [
20
    {x: '2011 Q1', y: 0},
21
    {x: '2011 Q2', y: 1},
22
    {x: '2011 Q3', y: 2},
23
    {x: '2011 Q4', y: 3},
24
    {x: '2012 Q1', y: 4},
25
    {x: '2012 Q2', y: 5},
26
    {x: '2012 Q3', y: 6},
27
    {x: '2012 Q4', y: 7},
28
    {x: '2013 Q1', y: 8}
29
  ],
30
  xkey: 'x',
31
  ykeys: ['y'],
32
  labels: ['Y'],
33
  barColors: function (row, series, type) {
34
    if (type === 'bar') {
35
      var red = Math.ceil(255 * row.y / this.ymax);
36
      return 'rgb(' + red + ',0,0)';
37
    }
38
    else {
39
      return '#000';
40
    }
41
  }
42
});
43
</pre>
44
</body>