Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2954 mathias 1
document.addEventListener('DOMContentLoaded', function() {
2
	console.log('savapa, savapa !!!');
3
 
4
	Chart.defaults.global = {
5
		// Boolean - Whether to animate the chart
6
		animation: true,
7
 
8
		// Number - Number of animation steps
9
		animationSteps: 60,
10
 
11
		// String - Animation easing effect
12
		// Possible effects are:
13
		// [easeInOutQuart, linear, easeOutBounce, easeInBack, easeInOutQuad,
14
		//  easeOutQuart, easeOutQuad, easeInOutBounce, easeOutSine, easeInOutCubic,
15
		//  easeInExpo, easeInOutBack, easeInCirc, easeInOutElastic, easeOutBack,
16
		//  easeInQuad, easeInOutExpo, easeInQuart, easeOutQuint, easeInOutCirc,
17
		//  easeInSine, easeOutExpo, easeOutCirc, easeOutCubic, easeInQuint,
18
		//  easeInElastic, easeInOutSine, easeInOutQuint, easeInBounce,
19
		//  easeOutElastic, easeInCubic]
20
		animationEasing: "easeOutQuart",
21
 
22
		// Boolean - If we should show the scale at all
23
		showScale: true,
24
 
25
		// Boolean - If we want to override with a hard coded scale
26
		scaleOverride: false,
27
 
28
		// ** Required if scaleOverride is true **
29
		// Number - The number of steps in a hard coded scale
30
		scaleSteps: null,
31
		// Number - The value jump in the hard coded scale
32
		scaleStepWidth: null,
33
		// Number - The scale starting value
34
		scaleStartValue: null,
35
 
36
		// String - Colour of the scale line
37
		scaleLineColor: "rgba(0,0,0,.1)",
38
 
39
		// Number - Pixel width of the scale line
40
		scaleLineWidth: 1,
41
 
42
		// Boolean - Whether to show labels on the scale
43
		scaleShowLabels: true,
44
 
45
		// Interpolated JS string - can access value
46
		scaleLabel: "<%=value%>",
47
 
48
		// Boolean - Whether the scale should stick to integers, not floats even if drawing space is there
49
		scaleIntegersOnly: true,
50
 
51
		// Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
52
		scaleBeginAtZero: false,
53
 
54
		// String - Scale label font declaration for the scale label
55
		scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
56
 
57
		// Number - Scale label font size in pixels
58
		scaleFontSize: 12,
59
 
60
		// String - Scale label font weight style
61
		scaleFontStyle: "normal",
62
 
63
		// String - Scale label font colour
64
		scaleFontColor: "#666",
65
 
66
		// Boolean - whether or not the chart should be responsive and resize when the browser does.
67
		responsive: false,
68
 
69
		// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
70
		maintainAspectRatio: true,
71
 
72
		// Boolean - Determines whether to draw tooltips on the canvas or not
73
		showTooltips: true,
74
 
75
		// Function - Determines whether to execute the customTooltips function instead of drawing the built in tooltips (See [Advanced - External Tooltips](#advanced-usage-custom-tooltips))
76
		customTooltips: false,
77
 
78
		// Array - Array of string names to attach tooltip events
79
		tooltipEvents: ["mousemove", "touchstart", "touchmove"],
80
 
81
		// String - Tooltip background colour
82
		tooltipFillColor: "rgba(0,0,0,0.8)",
83
 
84
		// String - Tooltip label font declaration for the scale label
85
		tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
86
 
87
		// Number - Tooltip label font size in pixels
88
		tooltipFontSize: 14,
89
 
90
		// String - Tooltip font weight style
91
		tooltipFontStyle: "normal",
92
 
93
		// String - Tooltip label font colour
94
		tooltipFontColor: "#fff",
95
 
96
		// String - Tooltip title font declaration for the scale label
97
		tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
98
 
99
		// Number - Tooltip title font size in pixels
100
		tooltipTitleFontSize: 14,
101
 
102
		// String - Tooltip title font weight style
103
		tooltipTitleFontStyle: "bold",
104
 
105
		// String - Tooltip title font colour
106
		tooltipTitleFontColor: "#fff",
107
 
108
		// Number - pixel width of padding around tooltip text
109
		tooltipYPadding: 6,
110
 
111
		// Number - pixel width of padding around tooltip text
112
		tooltipXPadding: 6,
113
 
114
		// Number - Size of the caret on the tooltip
115
		tooltipCaretSize: 8,
116
 
117
		// Number - Pixel radius of the tooltip border
118
		tooltipCornerRadius: 6,
119
 
120
		// Number - Pixel offset from point x to tooltip edge
121
		tooltipXOffset: 10,
122
 
123
		// String - Template string for single tooltips
124
		tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
125
 
126
		// String - Template string for multiple tooltips
127
		multiTooltipTemplate: "<%= value %>",
128
 
129
		// Function - Will fire on animation progression.
130
		onAnimationProgress: function(){},
131
 
132
		// Function - Will fire on animation completion.
133
		onAnimationComplete: function(){}
134
	}
135
 
136
	$(".canvas-graphique").each(function() {
137
		var ctx = $(this).get(0).getContext("2d");
138
		// This will get the first returned node in the jQuery collection.
139
		var chart = new Chart(ctx),
140
			chartId = $(this).attr('id'),
141
			dataId = chartId.substr(10),
142
			dataVar = eval('donnees_' + dataId);
143
		chart.Line(dataVar);
144
	});
145
 
146
});