Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
776 lars 1
var Index = function () {
2
 
3
	var handleColumnLine = function() {
4
		var chart = AmCharts.makeChart("columnLine", {
5
		  "type": "serial",
6
		  "addClassNames": true,
7
		  "theme": "light",
8
		  "path": "../../assets/global/plugins/amcharts/ammap/images/",
9
		  "autoMargins": false,
10
		  "marginLeft": 30,
11
		  "marginRight": 8,
12
		  "marginTop": 10,
13
		  "marginBottom": 26,
14
		  "balloon": {
15
		    "adjustBorderColor": false,
16
		    "horizontalPadding": 10,
17
		    "verticalPadding": 8,
18
		    "color": "#ffffff"
19
		  },
20
 
21
		  "dataProvider": [{
22
		    "year": 2009,
23
		    "income": 23.5,
24
		    "expenses": 21.1
25
		  }, {
26
		    "year": 2010,
27
		    "income": 26.2,
28
		    "expenses": 30.5
29
		  }, {
30
		    "year": 2011,
31
		    "income": 30.1,
32
		    "expenses": 34.9
33
		  }, {
34
		    "year": 2012,
35
		    "income": 29.5,
36
		    "expenses": 31.1
37
		  }, {
38
		    "year": 2013,
39
		    "income": 30.6,
40
		    "expenses": 28.2,
41
		  }, {
42
		    "year": 2014,
43
		    "income": 34.1,
44
		    "expenses": 32.9,
45
		    "dashLengthColumn": 5,
46
		    "alpha": 0.2,
47
		    "additional": "(projection)"
48
		  }],
49
		  "valueAxes": [{
50
		    "axisAlpha": 0,
51
		    "position": "left"
52
		  }],
53
		  "startDuration": 1,
54
		  "graphs": [{
55
		    "alphaField": "alpha",
56
		    "balloonText": "<span style='font-size:12px;'>[[title]] in [[category]]:<br><span style='font-size:20px;'>[[value]]</span> [[additional]]</span>",
57
		    "fillAlphas": 1,
58
		    "title": "Income",
59
		    "type": "column",
60
		    "valueField": "income",
61
		    "dashLengthField": "dashLengthColumn"
62
		  }, {
63
		    "id": "graph2",
64
		    "balloonText": "<span style='font-size:12px;'>[[title]] in [[category]]:<br><span style='font-size:20px;'>[[value]]</span> [[additional]]</span>",
65
		    "bullet": "round",
66
		    "lineThickness": 3,
67
		    "bulletSize": 7,
68
		    "bulletBorderAlpha": 1,
69
		    "bulletColor": "#FFFFFF",
70
		    "useLineColorForBulletBorder": true,
71
		    "bulletBorderThickness": 3,
72
		    "fillAlphas": 0,
73
		    "lineAlpha": 1,
74
		    "title": "Expenses",
75
		    "valueField": "expenses"
76
		  }],
77
		  "categoryField": "year",
78
		  "categoryAxis": {
79
		    "gridPosition": "start",
80
		    "axisAlpha": 0,
81
		    "tickLength": 0
82
		  },
83
		  "export": {
84
		    "enabled": true
85
		  }
86
		});
87
	}
88
 
89
	var handleAnimatedPieChart = function() {
90
		var chart = AmCharts.makeChart( "animated-pie-chart", {
91
		  "type": "pie",
92
		  "theme": "light",
93
		  "path": "../../assets/global/plugins/amcharts/ammap/images/",
94
		  "dataProvider": [ {
95
		    "country": "Lithuania",
96
		    "value": 260
97
		  }, {
98
		    "country": "Ireland",
99
		    "value": 201
100
		  }, {
101
		    "country": "Germany",
102
		    "value": 65
103
		  }, {
104
		    "country": "Australia",
105
		    "value": 39
106
		  }, {
107
		    "country": "UK",
108
		    "value": 19
109
		  }, {
110
		    "country": "Latvia",
111
		    "value": 10
112
		  } ],
113
		  "valueField": "value",
114
		  "titleField": "country",
115
		  "outlineAlpha": 0.4,
116
		  "depth3D": 15,
117
		  "balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
118
		  "angle": 30,
119
		  "export": {
120
		    "enabled": true
121
		  }
122
		} );
123
		jQuery( '.chart-input' ).off().on( 'input change', function() {
124
		  var property = jQuery( this ).data( 'property' );
125
		  var target = chart;
126
		  var value = Number( this.value );
127
		  chart.startDuration = 0;
128
 
129
		  if ( property == 'innerRadius' ) {
130
		    value += "%";
131
		  }
132
 
133
		  target[ property ] = value;
134
		  chart.validateNow();
135
		} );
136
	}
137
 
138
	var handleMorrisCharts = function() {
139
        if (Morris.EventEmitter) {
140
            // Use Morris.Area instead of Morris.Line
141
            dashboardMainChart = Morris.Area({
142
                element: 'sales_statistics',
143
                padding: 0,
144
                behaveLikeLine: false,
145
                gridEnabled: false,
146
                gridLineColor: false,
147
                axes: false,
148
                fillOpacity: 1,
149
                data: [{
150
                    period: '2011 Q1',
151
                    sales: 1400,
152
                    profit: 400
153
                }, {
154
                    period: '2011 Q2',
155
                    sales: 1100,
156
                    profit: 600
157
                }, {
158
                    period: '2011 Q3',
159
                    sales: 1600,
160
                    profit: 500
161
                }, {
162
                    period: '2011 Q4',
163
                    sales: 1200,
164
                    profit: 400
165
                }, {
166
                    period: '2012 Q1',
167
                    sales: 1550,
168
                    profit: 800
169
                }],
170
                lineColors: ['#399a8c', '#92e9dc'],
171
                xkey: 'period',
172
                ykeys: ['sales', 'profit'],
173
                labels: ['Sales', 'Profit'],
174
                pointSize: 0,
175
                lineWidth: 0,
176
                hideHover: 'auto',
177
                resize: true
178
            });
179
 
180
        }
181
    }
182
 
183
	var handleSparklineCharts = function() {
184
        $("#sparkline_bar").sparkline([8, 9, 10, 11, 10, 10, 12, 10, 10, 11, 9, 12, 11], {
185
            type: 'bar',
186
            width: '100',
187
            barWidth: 6,
188
            height: '45',
189
            barColor: '#F36A5B',
190
            negBarColor: '#e02222'
191
        });
192
 
193
        $("#sparkline_bar2").sparkline([9, 11, 12, 13, 12, 13, 10, 14, 13, 11, 11, 12, 11], {
194
            type: 'bar',
195
            width: '100',
196
            barWidth: 6,
197
            height: '45',
198
            barColor: '#5C9BD1',
199
            negBarColor: '#e02222'
200
        });
201
    }
202
 
203
    return {
204
 
205
        //main function
206
        init: function () {
207
            handleColumnLine();
208
            handleAnimatedPieChart();
209
            handleSparklineCharts();
210
            handleMorrisCharts();
211
        }
212
 
213
    };
214
 
215
}();
216
 
217
jQuery(document).ready(function() {
218
   Index.init(); // init metronic core componets
219
});