Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21627 kshitij.so 1
var Script = function () {
2
 
3
    //morris chart
4
 
5
    // Morris Line
6
    $(function () {
7
      // data from http://howmanyleft.co.uk/vehicle/jaguar_'e'_type
8
      var tax_data = [
9
           {"period": "2011 Q3", "licensed": 3407, "sorned": 660},
10
           {"period": "2011 Q2", "licensed": 3351, "sorned": 629},
11
           {"period": "2011 Q1", "licensed": 3269, "sorned": 618},
12
           {"period": "2010 Q4", "licensed": 3246, "sorned": 661},
13
           {"period": "2009 Q4", "licensed": 3171, "sorned": 676},
14
           {"period": "2008 Q4", "licensed": 3155, "sorned": 681},
15
           {"period": "2007 Q4", "licensed": 3226, "sorned": 620},
16
           {"period": "2006 Q4", "licensed": 3245, "sorned": null},
17
           {"period": "2005 Q4", "licensed": 3289, "sorned": null}
18
      ];
19
      Morris.Line({
20
        element: 'hero-graph',
21
        data: tax_data,
22
        xkey: 'period',
23
        ykeys: ['licensed', 'sorned'],
24
        labels: ['Licensed', 'Off the road'],
25
        lineColors:['#007AFF','#34aadc']
26
      });
27
 
28
      // Donut chart
29
      Morris.Donut({
30
        element: 'hero-donut',
31
        data: [
32
          {label: 'Internet Explorer', value: 12.1 },
33
          {label: 'Firefox', value: 27.8 },
34
          {label: 'Chrome', value: 52.3 },
35
          {label: 'Safari', value: 3.9 },
36
          {label: 'Opera', value: 1.7 }
37
        ],
38
          colors: ['#FFCC00', '#4CD964', '#007AFF','#fc3e39','#34AADC'],
39
        formatter: function (y) { return y + "%" }
40
      });
41
 
42
      Morris.Area({
43
        element: 'hero-area',
44
        data: [
45
          {period: '2010 Q1', iphone: 2666, ipad: null, itouch: 2647},
46
          {period: '2010 Q2', iphone: 2778, ipad: 2294, itouch: 2441},
47
          {period: '2010 Q3', iphone: 4912, ipad: 1969, itouch: 2501},
48
          {period: '2010 Q4', iphone: 3767, ipad: 3597, itouch: 5689},
49
          {period: '2011 Q1', iphone: 6810, ipad: 1914, itouch: 2293},
50
          {period: '2011 Q2', iphone: 5670, ipad: 4293, itouch: 1881},
51
          {period: '2011 Q3', iphone: 4820, ipad: 3795, itouch: 1588},
52
          {period: '2011 Q4', iphone: 15073, ipad: 5967, itouch: 5175},
53
          {period: '2012 Q1', iphone: 10687, ipad: 4460, itouch: 2028},
54
          {period: '2012 Q2', iphone: 8432, ipad: 5713, itouch: 1791}
55
        ],
56
 
57
          xkey: 'period',
58
          ykeys: ['iphone', 'ipad', 'itouch'],
59
          labels: ['iPhone', 'iPad', 'iPod Touch'],
60
          hideHover: 'auto',
61
          lineWidth: 1,
62
          pointSize: 5,
63
          lineColors: ['#4CD964', '#007AFF', '#FFCC00'],
64
          fillOpacity: 0.5,
65
          smooth: true
66
      });
67
 
68
      Morris.Bar({
69
        element: 'hero-bar',
70
        data: [
71
          {device: 'iPhone', geekbench: 136},
72
          {device: 'iPhone 3G', geekbench: 137},
73
          {device: 'iPhone 3GS', geekbench: 275},
74
          {device: 'iPhone 4', geekbench: 380},
75
          {device: 'iPhone 4S', geekbench: 655},
76
          {device: 'iPhone 5', geekbench: 1571}
77
        ],
78
        xkey: 'device',
79
        ykeys: ['geekbench'],
80
        labels: ['Geekbench'],
81
        barRatio: 0.4,
82
        xLabelAngle: 35,
83
        hideHover: 'auto',
84
        barColors: ['#007AFF']
85
      });
86
 
87
      new Morris.Line({
88
        element: 'examplefirst',
89
        xkey: 'year',
90
        ykeys: ['value'],
91
        labels: ['Value'],
92
        data: [
93
          {year: '2008', value: 20},
94
          {year: '2009', value: 10},
95
          {year: '2010', value: 5},
96
          {year: '2011', value: 5},
97
          {year: '2012', value: 20}
98
        ]
99
      });
100
 
101
      $('.code-example').each(function (index, el) {
102
        eval($(el).text());
103
      });
104
    });
105
 
106
}();
107
 
108
 
109
 
110