Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 lars 1
var Index = function () {
2
 
3
	var handleAmChart = function() {
4
		var chartData = [
5
		    {
6
		        "date": "2012-01-05",
7
		        "distance": 480,
8
		        "townName": "Miami",
9
		        "townName2": "Miami",
10
		        "townSize": 10,
11
		        "latitude": 25.83,
12
		        "duration": 501
13
		    },
14
		    {
15
		        "date": "2012-01-06",
16
		        "distance": 386,
17
		        "townName": "Tallahassee",
18
		        "townSize": 7,
19
		        "latitude": 30.46,
20
		        "duration": 443
21
		    },
22
		    {
23
		        "date": "2012-01-07",
24
		        "distance": 348,
25
		        "townName": "New Orleans",
26
		        "townSize": 10,
27
		        "latitude": 29.94,
28
		        "duration": 405
29
		    },
30
		    {
31
		        "date": "2012-01-08",
32
		        "distance": 238,
33
		        "townName": "Houston",
34
		        "townName2": "Houston",
35
		        "townSize": 16,
36
		        "latitude": 29.76,
37
		        "duration": 309
38
		    },
39
		    {
40
		        "date": "2012-01-09",
41
		        "distance": 218,
42
		        "townName": "Dalas",
43
		        "townSize": 17,
44
		        "latitude": 32.8,
45
		        "duration": 287
46
		    },
47
		    {
48
		        "date": "2012-01-10",
49
		        "distance": 349,
50
		        "townName": "Oklahoma City",
51
		        "townSize": 11,
52
		        "latitude": 35.49,
53
		        "duration": 485
54
		    },
55
		    {
56
		        "date": "2012-01-11",
57
		        "distance": 603,
58
		        "townName": "Kansas City",
59
		        "townSize": 10,
60
		        "latitude": 39.1,
61
		        "duration": 890
62
		    },
63
		    {
64
		        "date": "2012-01-12",
65
		        "distance": 534,
66
		        "townName": "Denver",
67
		        "townName2": "Denver",
68
		        "townSize": 18,
69
		        "latitude": 39.74,
70
		        "duration": 810
71
		    },
72
		    {
73
		        "date": "2012-01-13",
74
		        "townName": "Salt Lake City",
75
		        "townSize": 12,
76
		        "distance": 425,
77
		        "duration": 670,
78
		        "latitude": 40.75,
79
		        "alpha":0.4
80
		    },
81
		    {
82
		        "date": "2012-01-14",
83
		        "latitude": 36.1,
84
		        "duration": 470,
85
		        "townName": "Las Vegas",
86
		        "townName2": "Las Vegas",
87
		        "bulletClass": "lastBullet"
88
		    },
89
		    {
90
		        "date": "2012-01-15"
91
		    }
92
		];
93
		var chart = AmCharts.makeChart("CSSAnimationChart", {
94
			type: "serial",
95
			fontSize: 12,
96
			fontFamily: "Open Sans",
97
			dataDateFormat: "YYYY-MM-DD",
98
			dataProvider: chartData,
99
 
100
			addClassNames: true,
101
			startDuration: 1,
102
			color: "#6c7b88",
103
			marginLeft: 0,
104
 
105
			categoryField: "date",
106
			categoryAxis: {
107
			    parseDates: true,
108
			    minPeriod: "DD",
109
			    autoGridCount: false,
110
			    gridCount: 50,
111
			    gridAlpha: 0.1,
112
			    gridColor: "#FFFFFF",
113
			    axisColor: "#555555",
114
			    dateFormats: [{
115
			        period: 'DD',
116
			        format: 'DD'
117
			    }, {
118
			        period: 'WW',
119
			        format: 'MMM DD'
120
			    }, {
121
			        period: 'MM',
122
			        format: 'MMM'
123
			    }, {
124
			        period: 'YYYY',
125
			        format: 'YYYY'
126
			    }]
127
			},
128
 
129
			valueAxes: [{
130
			    id: "a1",
131
			    title: "distance",
132
			    gridAlpha: 0,
133
			    axisAlpha: 0
134
			},{
135
			    id: "a2",
136
			    position: "right",
137
			    gridAlpha: 0,
138
			    axisAlpha: 0,
139
			    labelsEnabled: false
140
			},{
141
			    id: "a3",
142
			    title: "duration",
143
			    position: "right",
144
			    gridAlpha: 0,
145
			    axisAlpha: 0,
146
			    inside: true,
147
			    duration: "mm",
148
			    durationUnits: {
149
			        DD: "d. ",
150
			        hh: "h ",
151
			        mm: "min",
152
			        ss: ""
153
			    }
154
			}],
155
			graphs: [{
156
			    id: "g1",
157
			    valueField:  "distance",
158
			    title:  "distance",
159
			    type:  "column",
160
			    fillAlphas:  0.7,
161
			    valueAxis:  "a1",
162
			    balloonText:  "[[value]] miles",
163
			    legendValueText:  "[[value]] mi",
164
			    legendPeriodValueText:  "total: [[value.sum]] mi",
165
			    lineColor:  "#08a3cc",
166
			    alphaField:  "alpha",
167
			},{
168
			    id: "g2",
169
			    valueField: "latitude",
170
			    classNameField: "bulletClass",
171
			    title: "latitude/city",
172
			    type: "line",
173
			    valueAxis: "a2",
174
			    lineColor: "#786c56",
175
			    lineThickness: 1,
176
			    legendValueText: "[[description]]/[[value]]",
177
			    descriptionField: "townName",
178
			    bullet: "round",
179
			    bulletSizeField: "townSize",
180
			    bulletBorderColor: "#02617a",
181
			    bulletBorderAlpha: 1,
182
			    bulletBorderThickness: 2,
183
			    bulletColor: "#89c4f4",
184
			    labelText: "[[townName2]]",
185
			    labelPosition: "right",
186
			    balloonText: "latitude:[[value]]",
187
			    showBalloon: true,
188
			    animationPlayed: true,
189
			},{
190
			    id: "g3",
191
			    title: "duration",
192
			    valueField: "duration",
193
			    type: "line",
194
			    valueAxis: "a3",
195
			    lineAlpha: 0.8,
196
			    lineColor: "#e26a6a",
197
			    balloonText: "[[value]]",
198
			    lineThickness: 1,
199
			    legendValueText: "[[value]]",
200
			    bullet: "square",
201
			    bulletBorderColor: "#e26a6a",
202
			    bulletBorderThickness: 1,
203
			    bulletBorderAlpha: 0.8,
204
			    dashLengthField: "dashLength",
205
			    animationPlayed: true
206
			}],
207
 
208
			chartCursor: {
209
			    zoomable: false,
210
			    categoryBalloonDateFormat: "DD",
211
			    cursorAlpha: 0,
212
			    categoryBalloonColor: "#e26a6a",
213
			    categoryBalloonAlpha: 0.8,
214
			    valueBalloonsEnabled: false
215
			},
216
			legend: {
217
			    bulletType: "round",
218
			    equalWidths: false,
219
			    valueWidth: 120,
220
			    useGraphSettings: true,
221
			    color: "#6c7b88"
222
		  	}
223
		});
224
	}
225
 
226
	var handleAmChartMap = function() {
227
		// svg path for target icon
228
		var targetSVG = "M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z";
229
		// svg path for plane icon
230
		var planeSVG = "M19.671,8.11l-2.777,2.777l-3.837-0.861c0.362-0.505,0.916-1.683,0.464-2.135c-0.518-0.517-1.979,0.278-2.305,0.604l-0.913,0.913L7.614,8.804l-2.021,2.021l2.232,1.061l-0.082,0.082l1.701,1.701l0.688-0.687l3.164,1.504L9.571,18.21H6.413l-1.137,1.138l3.6,0.948l1.83,1.83l0.947,3.598l1.137-1.137V21.43l3.725-3.725l1.504,3.164l-0.687,0.687l1.702,1.701l0.081-0.081l1.062,2.231l2.02-2.02l-0.604-2.689l0.912-0.912c0.326-0.326,1.121-1.789,0.604-2.306c-0.452-0.452-1.63,0.101-2.135,0.464l-0.861-3.838l2.777-2.777c0.947-0.947,3.599-4.862,2.62-5.839C24.533,4.512,20.618,7.163,19.671,8.11z";
231
 
232
		var map = AmCharts.makeChart( "mapChart", {
233
		  type: "map",
234
		  "theme": "light",
235
		  pathToImages: "../../assets/global/plugins/amcharts/ammap/images/",
236
 
237
		  dataProvider: {
238
		    map: "worldLow",
239
		    linkToObject: "london",
240
		    images: [ {
241
		        id: "london",
242
		        color: "#009dc7",
243
		        svgPath: targetSVG,
244
		        title: "London",
245
		        latitude: 51.5002,
246
		        longitude: -0.1262,
247
		        scale: 1.5,
248
		        zoomLevel: 2.74,
249
		        zoomLongitude: -20.1341,
250
		        zoomLatitude: 49.1712,
251
 
252
		        lines: [ {
253
		          latitudes: [ 51.5002, 50.4422 ],
254
		          longitudes: [ -0.1262, 30.5367 ]
255
		        }, {
256
		          latitudes: [ 51.5002, 46.9480 ],
257
		          longitudes: [ -0.1262, 7.4481 ]
258
		        }, {
259
		          latitudes: [ 51.5002, 59.3328 ],
260
		          longitudes: [ -0.1262, 18.0645 ]
261
		        }, {
262
		          latitudes: [ 51.5002, 40.4167 ],
263
		          longitudes: [ -0.1262, -3.7033 ]
264
		        }, {
265
		          latitudes: [ 51.5002, 46.0514 ],
266
		          longitudes: [ -0.1262, 14.5060 ]
267
		        }, {
268
		          latitudes: [ 51.5002, 48.2116 ],
269
		          longitudes: [ -0.1262, 17.1547 ]
270
		        }, {
271
		          latitudes: [ 51.5002, 44.8048 ],
272
		          longitudes: [ -0.1262, 20.4781 ]
273
		        }, {
274
		          latitudes: [ 51.5002, 55.7558 ],
275
		          longitudes: [ -0.1262, 37.6176 ]
276
		        }, {
277
		          latitudes: [ 51.5002, 38.7072 ],
278
		          longitudes: [ -0.1262, -9.1355 ]
279
		        }, {
280
		          latitudes: [ 51.5002, 54.6896 ],
281
		          longitudes: [ -0.1262, 25.2799 ]
282
		        }, {
283
		          latitudes: [ 51.5002, 64.1353 ],
284
		          longitudes: [ -0.1262, -21.8952 ]
285
		        }, {
286
		          latitudes: [ 51.5002, 40.4300 ],
287
		          longitudes: [ -0.1262, -74.0000 ]
288
		        } ],
289
 
290
		        images: [ {
291
		          label: "Flights from London",
292
		          svgPath: planeSVG,
293
		          left: 100,
294
		          top: 45,
295
		          labelShiftY: 5,
296
		          color: "#d93d5e",
297
		          labelColor: "#d93d5e",
298
		          labelRollOverColor: "#d93d5e",
299
		          labelFontSize: 20
300
		        }, {
301
		          label: "show flights from Vilnius",
302
		          left: 106,
303
		          top: 70,
304
		          labelColor: "#6c7b88",
305
		          labelRollOverColor: "#d93d5e",
306
		          labelFontSize: 11,
307
		          linkToObject: "vilnius"
308
		        } ]
309
		      },
310
 
311
		      {
312
		        id: "vilnius",
313
		        color: "#009dc7",
314
		        svgPath: targetSVG,
315
		        title: "Vilnius",
316
		        latitude: 54.6896,
317
		        longitude: 25.2799,
318
		        scale: 1.5,
319
		        zoomLevel: 4.92,
320
		        zoomLongitude: 15.4492,
321
		        zoomLatitude: 50.2631,
322
 
323
		        lines: [ {
324
		          latitudes: [ 54.6896, 50.8371 ],
325
		          longitudes: [ 25.2799, 4.3676 ]
326
		        }, {
327
		          latitudes: [ 54.6896, 59.9138 ],
328
		          longitudes: [ 25.2799, 10.7387 ]
329
		        }, {
330
		          latitudes: [ 54.6896, 40.4167 ],
331
		          longitudes: [ 25.2799, -3.7033 ]
332
		        }, {
333
		          latitudes: [ 54.6896, 50.0878 ],
334
		          longitudes: [ 25.2799, 14.4205 ]
335
		        }, {
336
		          latitudes: [ 54.6896, 48.2116 ],
337
		          longitudes: [ 25.2799, 17.1547 ]
338
		        }, {
339
		          latitudes: [ 54.6896, 44.8048 ],
340
		          longitudes: [ 25.2799, 20.4781 ]
341
		        }, {
342
		          latitudes: [ 54.6896, 55.7558 ],
343
		          longitudes: [ 25.2799, 37.6176 ]
344
		        }, {
345
		          latitudes: [ 54.6896, 37.9792 ],
346
		          longitudes: [ 25.2799, 23.7166 ]
347
		        }, {
348
		          latitudes: [ 54.6896, 54.6896 ],
349
		          longitudes: [ 25.2799, 25.2799 ]
350
		        }, {
351
		          latitudes: [ 54.6896, 51.5002 ],
352
		          longitudes: [ 25.2799, -0.1262 ]
353
		        }, {
354
		          latitudes: [ 54.6896, 53.3441 ],
355
		          longitudes: [ 25.2799, -6.2675 ]
356
		        } ],
357
 
358
		        images: [ {
359
		          label: "Flights from Vilnius",
360
		          svgPath: planeSVG,
361
		          left: 100,
362
		          top: 45,
363
		          labelShiftY: 5,
364
		          color: "#d93d5e",
365
		          labelColor: "#d93d5e",
366
		          labelRollOverColor: "#d93d5e",
367
		          labelFontSize: 20
368
		        }, {
369
		          label: "show flights from London",
370
		          left: 106,
371
		          top: 70,
372
		          labelColor: "#009dc7",
373
		          labelRollOverColor: "#d93d5e",
374
		          labelFontSize: 11,
375
		          linkToObject: "london"
376
		        } ]
377
		      }, {
378
		        svgPath: targetSVG,
379
		        title: "Brussels",
380
		        latitude: 50.8371,
381
		        longitude: 4.3676
382
		      }, {
383
		        svgPath: targetSVG,
384
		        title: "Prague",
385
		        latitude: 50.0878,
386
		        longitude: 14.4205
387
		      }, {
388
		        svgPath: targetSVG,
389
		        title: "Athens",
390
		        latitude: 37.9792,
391
		        longitude: 23.7166
392
		      }, {
393
		        svgPath: targetSVG,
394
		        title: "Reykjavik",
395
		        latitude: 64.1353,
396
		        longitude: -21.8952
397
		      }, {
398
		        svgPath: targetSVG,
399
		        title: "Dublin",
400
		        latitude: 53.3441,
401
		        longitude: -6.2675
402
		      }, {
403
		        svgPath: targetSVG,
404
		        title: "Oslo",
405
		        latitude: 59.9138,
406
		        longitude: 10.7387
407
		      }, {
408
		        svgPath: targetSVG,
409
		        title: "Lisbon",
410
		        latitude: 38.7072,
411
		        longitude: -9.1355
412
		      }, {
413
		        svgPath: targetSVG,
414
		        title: "Moscow",
415
		        latitude: 55.7558,
416
		        longitude: 37.6176
417
		      }, {
418
		        svgPath: targetSVG,
419
		        title: "Belgrade",
420
		        latitude: 44.8048,
421
		        longitude: 20.4781
422
		      }, {
423
		        svgPath: targetSVG,
424
		        title: "Bratislava",
425
		        latitude: 48.2116,
426
		        longitude: 17.1547
427
		      }, {
428
		        svgPath: targetSVG,
429
		        title: "Ljubljana",
430
		        latitude: 46.0514,
431
		        longitude: 14.5060
432
		      }, {
433
		        svgPath: targetSVG,
434
		        title: "Madrid",
435
		        latitude: 40.4167,
436
		        longitude: -3.7033
437
		      }, {
438
		        svgPath: targetSVG,
439
		        title: "Stockholm",
440
		        latitude: 59.3328,
441
		        longitude: 18.0645
442
		      }, {
443
		        svgPath: targetSVG,
444
		        title: "Bern",
445
		        latitude: 46.9480,
446
		        longitude: 7.4481
447
		      }, {
448
		        svgPath: targetSVG,
449
		        title: "Kiev",
450
		        latitude: 50.4422,
451
		        longitude: 30.5367
452
		      }, {
453
		        svgPath: targetSVG,
454
		        title: "Paris",
455
		        latitude: 48.8567,
456
		        longitude: 2.3510
457
		      }, {
458
		        svgPath: targetSVG,
459
		        title: "New York",
460
		        latitude: 40.43,
461
		        longitude: -74
462
		      }
463
		    ]
464
		  },
465
 
466
		  zoomControl: {
467
		        buttonFillColor: "#15A892"
468
		    },
469
 
470
		  areasSettings: {
471
		    unlistedAreasColor: "#15A892"
472
		  },
473
 
474
		  imagesSettings: {
475
		    color: "#d93d5e",
476
		    rollOverColor: "#d93d5e",
477
		    selectedColor: "#009dc7"
478
		  },
479
 
480
		  linesSettings: {
481
		    color: "#d93d5e",
482
		    alpha: 0.4
483
		  },
484
 
485
 
486
		  backgroundZoomsToTop: true,
487
		  linesAboveImages: true,
488
 
489
		  "export": {
490
		    "enabled": true,
491
		    "libs": {
492
		      "path": "http://www.amcharts.com/lib/3/plugins/export/libs/"
493
		    }
494
		  }
495
		} );
496
	}
497
 
498
	var handleMorrisCharts = function() {
499
        if (Morris.EventEmitter) {
500
            // Use Morris.Area instead of Morris.Line
501
            dashboardMainChart = Morris.Area({
502
                element: 'sales_statistics',
503
                padding: 0,
504
                behaveLikeLine: false,
505
                gridEnabled: false,
506
                gridLineColor: false,
507
                axes: false,
508
                fillOpacity: 1,
509
                data: [{
510
                    period: '2011 Q1',
511
                    sales: 1400,
512
                    profit: 400
513
                }, {
514
                    period: '2011 Q2',
515
                    sales: 1100,
516
                    profit: 600
517
                }, {
518
                    period: '2011 Q3',
519
                    sales: 1600,
520
                    profit: 500
521
                }, {
522
                    period: '2011 Q4',
523
                    sales: 1200,
524
                    profit: 400
525
                }, {
526
                    period: '2012 Q1',
527
                    sales: 1550,
528
                    profit: 800
529
                }],
530
                lineColors: ['#399a8c', '#92e9dc'],
531
                xkey: 'period',
532
                ykeys: ['sales', 'profit'],
533
                labels: ['Sales', 'Profit'],
534
                pointSize: 0,
535
                lineWidth: 0,
536
                hideHover: 'auto',
537
                resize: true
538
            });
539
 
540
        }
541
    }
542
 
543
	var handleSparklineCharts = function() {
544
        $("#sparkline_bar").sparkline([8, 9, 10, 11, 10, 10, 12, 10, 10, 11, 9, 12, 11], {
545
            type: 'bar',
546
            width: '100',
547
            barWidth: 6,
548
            height: '45',
549
            barColor: '#F36A5B',
550
            negBarColor: '#e02222'
551
        });
552
 
553
        $("#sparkline_bar2").sparkline([9, 11, 12, 13, 12, 13, 10, 14, 13, 11, 11, 12, 11], {
554
            type: 'bar',
555
            width: '100',
556
            barWidth: 6,
557
            height: '45',
558
            barColor: '#5C9BD1',
559
            negBarColor: '#e02222'
560
        });
561
    }
562
 
563
    return {
564
 
565
        //main function
566
        init: function () {
567
            handleAmChart();
568
            handleAmChartMap();
569
            handleSparklineCharts();
570
            handleMorrisCharts();
571
        }
572
 
573
    };
574
 
575
}();
576
 
577
jQuery(document).ready(function() {
578
   Index.init(); // init metronic core componets
579
});