Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21627 kshitij.so 1
function showmessage(){
2
	$.gritter.add({
3
		title: 'You Have Message!',
4
		text: 'You have some mesages from Anyone this time. To read any mesage <a href="#" style="color:#ccc">adn write some </a> letter, Send and Reaply.',
5
		image: 'img/user2.png',
6
		sticky: false,
7
		time: ''
8
	});
9
}
10
$(function () {
11
 
12
    setTimeout(showmessage,2000);
13
    $( "#inline-datepicker" ).datepicker();
14
    /* Bar Chart starts */
15
 
16
    var d1 = [];
17
    for (var i = 0; i <= 20; i += 1)
18
        d1.push([i, parseInt(Math.random() * 30)]);
19
 
20
    var d2 = [];
21
    for (var i = 0; i <= 20; i += 1)
22
        d2.push([i, parseInt(Math.random() * 30)]);
23
 
24
 
25
    var stack = 0, bars = true, lines = false, steps = false;
26
 
27
    function plotWithOptions() {
28
        $.plot($("#bar-chart"), [ d1, d2 ], {
29
            series: {
30
                stack: stack,
31
                lines: { show: lines, fill: true, steps: steps },
32
                bars: { show: bars, barWidth: 0.8 }
33
            },
34
            grid: {
35
                borderWidth: 0, hoverable: true, color: "#777"
36
            },
37
            colors: ["#7a4a39", "#7a4a39"],
38
            bars: {
39
                  show: true,
40
                  lineWidth: 0,
41
                  fill: true,
42
                  fillColor: { colors: [ { opacity: 0.9 }, { opacity: 0.8 } ] }
43
            }
44
        });
45
    }
46
 
47
    plotWithOptions();
48
 
49
    $(".stackControls input").click(function (e) {
50
        e.preventDefault();
51
        stack = $(this).val() == "With stacking" ? true : null;
52
        plotWithOptions();
53
    });
54
    $(".graphControls input").click(function (e) {
55
        e.preventDefault();
56
        bars = $(this).val().indexOf("Bars") != -1;
57
        lines = $(this).val().indexOf("Lines") != -1;
58
        steps = $(this).val().indexOf("steps") != -1;
59
        plotWithOptions();
60
    });
61
 
62
    /* Bar chart ends */
63
 
64
});
65
 
66
/* Curve chart starts */
67
 
68
$(function () {
69
    var sin = [], cos = [];
70
    for (var i = 0; i < 14; i += 0.5) {
71
        sin.push([i, Math.sin(i)]);
72
        cos.push([i, Math.cos(i)]);
73
    }
74
 
75
    // First Chart
76
    var chart1 = function(){
77
      $("#chart1").html("");
78
      var tax_data = [
79
         {"period": "2011 Q3", "licensed": 4369, "sorned": 3707},
80
         {"period": "2011 Q2", "licensed": 4756, "sorned": 3951},
81
         {"period": "2011 Q1", "licensed": 2146, "sorned": 1769},
82
         {"period": "2010 Q4", "licensed": 3746, "sorned": 3257},
83
         {"period": "2009 Q4", "licensed": 2185, "sorned": 1185},
84
         {"period": "2008 Q4", "licensed": 3155, "sorned": 2972},
85
         {"period": "2007 Q4", "licensed": 1813, "sorned": 1253},
86
         {"period": "2006 Q4", "licensed": 2974, "sorned": 2562},
87
         {"period": "2005 Q4", "licensed": 1235, "sorned": 150}
88
      ];
89
 
90
      Morris.Line({
91
        element: 'chart1',
92
        data: tax_data,
93
        xkey: 'period',
94
        hideHover: 'auto',
95
        ykeys: ['licensed', 'sorned'],
96
        labels: ['Licensed', 'Off the road']
97
      });
98
    }
99
    // Init First Chart
100
    chart1();
101
    // Resize First Chart on page resize
102
    $(window).resize(debounce(chart1,200));
103
 
104
    // Second Chart
105
    var graph2 = function(){
106
      $("#graph2").html("");
107
      Morris.Donut({
108
        element: 'graph2',
109
        data: [
110
          {label: "Internet Explorer", value: 12},
111
          {label: "Google Chrome", value: 30},
112
          {label: "Mozilla Firefox", value: 20},
113
          {label: "Other", value: 17}
114
        ],
115
        hideHover: 'auto',
116
        colors: ["#C5CED6", "#59646E","#384B5E", "#999"]
117
        //colors: ["#4BB5C1", "#96CA2D", "#7FC6BC","#EDF7F2"]
118
      });
119
    }
120
    // Init Second Chart
121
    graph2();
122
    // Resize Second Chart on page resize
123
    $(window).resize(debounce(graph2,200));
124
 
125
    // Third Chart
126
    var chart1 = function(){
127
      $("#bar-chart2").html("");
128
      Morris.Bar({
129
        element: 'bar-chart2',
130
        data: [
131
          { y: '2006', a: 100, b: 90 },
132
          { y: '2007', a: 75,  b: 65 },
133
          { y: '2008', a: 50,  b: 40 },
134
          { y: '2009', a: 75,  b: 65 },
135
          { y: '2010', a: 50,  b: 40 },
136
          { y: '2011', a: 75,  b: 65 },
137
          { y: '2012', a: 100, b: 90 }
138
        ],
139
        xkey: 'y',
140
        ykeys: ['a', 'b'],
141
        hideHover: 'auto',
142
        labels: ['Series A', 'Series B'],
143
        barColors: [ "#56626B","#486b60", "#999"]
144
      });
145
 
146
    }
147
    // Init Third Chart
148
    chart1();
149
    // Resize Third Chart on page resize
150
    $(window).resize(debounce(chart1,200));
151
 
152
    $("#pie-chart4").sparkline([55, 100, 120, 110], {
153
      type: 'pie',
154
      height: 300,
155
      sliceColors: ['#c5ced6','#486b60','#59646e','#C0CA55','#384b5e','#999999']
156
    });
157
 
158
    $("#pie-chart5").sparkline([55, 100, 44, 13], {
159
      type: 'pie',
160
      height: 70,
161
      sliceColors: ['#59646e','#999999','#c5ced6','#C0CA55','#384b5e','#486b60']
162
    });
163
 
164
    $("#pie-chart6").sparkline([55, 100, 120, 110], {
165
      type: 'pie',
166
      height: 70,
167
      sliceColors: ['#c5ced6','#486b60','#59646e','#C0CA55','#384b5e','#999999']
168
    });
169
 
170
    $('#reportrange').daterangepicker({
171
        startDate: moment().subtract('days', 29),
172
        endDate: moment(),
173
        minDate: '01/01/2012',
174
        maxDate: '12/31/2014',
175
        dateLimit: { days: 60 },
176
        showDropdowns: true,
177
        showWeekNumbers: true,
178
        timePicker: false,
179
        timePickerIncrement: 1,
180
        timePicker12Hour: true,
181
        ranges: {
182
           'Today': [moment(), moment()],
183
           'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
184
           'Last 7 Days': [moment().subtract('days', 6), moment()],
185
           'Last 30 Days': [moment().subtract('days', 29), moment()],
186
           'This Month': [moment().startOf('month'), moment().endOf('month')],
187
           'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
188
        },
189
        opens: 'left',
190
        buttonClasses: ['btn btn-default'],
191
        applyClass: 'btn-small btn-primary',
192
        cancelClass: 'btn-small',
193
        format: 'MM/DD/YYYY',
194
        separator: ' to ',
195
        locale: {
196
            applyLabel: 'Submit',
197
            fromLabel: 'From',
198
            toLabel: 'To',
199
            customRangeLabel: 'Custom Range',
200
            daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
201
            monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
202
            firstDay: 1
203
        }
204
     },
205
     function(start, end) {
206
      console.log("Callback has been called!");
207
      $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
208
     });
209
     $('#reportrange span').html(moment().subtract('days', 29).format('MMMM D, YYYY') + ' - ' + moment().format('MMMM D, YYYY'));
210
 
211
 
212
});