-
Notifications
You must be signed in to change notification settings - Fork 1
/
chartjs.admin.inc
286 lines (279 loc) · 10.2 KB
/
chartjs.admin.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?php
/**
* @file
* Contains administrative tools for chartjs.
*/
/**
* Admin settings form for chartjs.
*
* @return array
* Render array for chartjs system settings form.
*/
function chartjs_admin() {
$form = array();
$form['chartjs_legend'] = array(
'#type' => 'fieldset',
'#title' => t('Legend'),
);
$form['chartjs_legend']['chartjs_hasLegend'] = array(
'#type' => 'radios',
'#title' => t('Legend'),
'#options' => array(
TRUE => t('On'),
FALSE => t('Off'),
),
'#default_value' => variable_get('chartjs_hasLegend', TRUE),
);
$form['chartjs_legend']['chartjs_legendTemplate'] = array(
'#type' => 'textarea',
'#title' => t('Legend Template'),
'#default_value' => variable_get('chartjs_legendTemplate', '<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'),
);
$form['chartjs_animations'] = array(
'#type' => 'fieldset',
'#title' => t('Animations'),
);
$form['chartjs_animations']['chartjs_animation'] = array(
'#type' => 'radios',
'#title' => t('Animation'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_animation', 'true'),
);
$form['chartjs_animations']['chartjs_animationSteps'] = array(
'#type' => 'textfield',
'#title' => t('Animation Steps'),
'#default_value' => variable_get('chartjs_animationSteps', '60'),
);
$form['chartjs_animations']['chartjs_animationEasing'] = array(
'#type' => 'textfield',
'#title' => t('Animation Easing'),
'#default_value' => variable_get('chartjs_animationEasing', 'easeOutQuart'),
);
$form['chartjs_scale'] = array(
'#type' => 'fieldset',
'#title' => t('Scale'),
);
$form['chartjs_scale']['chartjs_showScale'] = array(
'#type' => 'radios',
'#title' => t('Show Scale'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_showScale', 'true'),
);
$form['chartjs_scale']['chartjs_scaleOverride'] = array(
'#type' => 'radios',
'#title' => t('Scale Override'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_scaleOverride', 'true'),
);
$form['chartjs_scale']['chartjs_scaleSteps'] = array(
'#type' => 'textfield',
'#title' => t('Scale Steps'),
'#default_value' => variable_get('chartjs_scaleSteps', 'null'),
);
$form['chartjs_scale']['chartjs_scaleStepWidth'] = array(
'#type' => 'textfield',
'#title' => t('Scale Width'),
'#default_value' => variable_get('chartjs_scaleStepWidth', 'null'),
);
$form['chartjs_scale']['chartjs_scaleStartValue'] = array(
'#type' => 'textfield',
'#title' => t('Scale Start Value'),
'#default_value' => variable_get('chartjs_scaleStartValue', 'null'),
);
$form['chartjs_scale']['chartjs_scaleLineColor'] = array(
'#type' => 'textfield',
'#title' => t('Scale Line Color'),
'#default_value' => variable_get('chartjs_scaleLineColor', 'rgba(0,0,0,.1)'),
);
$form['chartjs_scale']['chartjs_scaleLineWidth'] = array(
'#type' => 'textfield',
'#title' => t('Scale Line Width'),
'#default_value' => variable_get('chartjs_scaleLineWidth', '1'),
);
$form['chartjs_scale']['chartjs_scaleShowLabels'] = array(
'#type' => 'radios',
'#title' => t('Scale Show Labels'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_scaleShowLabels', 'true'),
);
$form['chartjs_scale']['chartjs_scaleLabel'] = array(
'#type' => 'textfield',
'#title' => t('Scale Label'),
'#default_value' => variable_get('chartjs_scaleLabel', '<%=value%>'),
);
$form['chartjs_scale']['chartjs_scaleIntegersOnly'] = array(
'#type' => 'radios',
'#title' => t('Scale Integers Only'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_scaleIntegersOnly', 'true'),
);
$form['chartjs_scale']['chartjs_scaleBeginAtZero'] = array(
'#type' => 'radios',
'#title' => t('Scale Begin At Zero'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_scaleBeginAtZero', 'true'),
);
$form['chartjs_scale']['chartjs_scaleFontFamily'] = array(
'#type' => 'textfield',
'#title' => t('Scale Font Family'),
'#default_value' => variable_get('chartjs_scaleFontFamily', "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"),
);
$form['chartjs_scale']['chartjs_scaleFontSize'] = array(
'#type' => 'textfield',
'#title' => t('Scale Font Size'),
'#default_value' => variable_get('chartjs_scaleFontSize', '12'),
);
$form['chartjs_scale']['chartjs_scaleFontStyle'] = array(
'#type' => 'textfield',
'#title' => t('Scale Font Style'),
'#default_value' => variable_get('chartjs_scaleFontStyle', 'normal'),
);
$form['chartjs_scale']['chartjs_scaleFontColor'] = array(
'#type' => 'textfield',
'#title' => t('Scale Font Color'),
'#default_value' => variable_get('chartjs_scaleFontColor', '#fff'),
);
$form['chartjs_display'] = array(
'#type' => 'fieldset',
'#title' => t('Display Settings'),
);
$form['chartjs_display']['chartjs_responsive'] = array(
'#type' => 'radios',
'#title' => t('Responsive'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_responsive', 'true'),
);
$form['chartjs_display']['chartjs_maintainAspectRatio'] = array(
'#type' => 'radios',
'#title' => t('Mantain Aspect Ration'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_maintainAspectRatio', 'true'),
);
$form['chartjs_tooltips'] = array(
'#type' => 'fieldset',
'#title' => t('Tooltips'),
);
$form['chartjs_tooltips']['chartjs_showTooltips'] = array(
'#type' => 'radios',
'#title' => t('Show Tool Tips'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_showTooltips', 'true'),
);
$form['chartjs_tooltips']['chartjs_customTooltips'] = array(
'#type' => 'radios',
'#title' => t('Custom Tool Tips'),
'#options' => array(
'true' => t('On'),
'false' => t('Off'),
),
'#default_value' => variable_get('chartjs_customTooltips', 'false'),
);
$form['chartjs_tooltips']['chartjs_tooltipFillColor'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Fill Color'),
'#default_value' => variable_get('chartjs_tooltipFillColor', 'rgba(0,0,0,0.8)'),
);
$form['chartjs_tooltips']['chartjs_tooltipFontFamily'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Font Family'),
'#default_value' => variable_get('chartjs_tooltipFontFamily', "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"),
);
$form['chartjs_tooltips']['chartjs_tooltipFontSize'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Font Size'),
'#default_value' => variable_get('chartjs_tooltipFontSize', '14'),
);
$form['chartjs_tooltips']['chartjs_tooltipFontStyle'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Font Style'),
'#default_value' => variable_get('chartjs_tooltipFontStyle', 'normal'),
);
$form['chartjs_tooltips']['chartjs_tooltipFontColor'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Font Color'),
'#default_value' => variable_get('chartjs_tooltipFontColor', '#fff'),
);
$form['chartjs_tooltips']['chartjs_tooltipTitleFontFamily'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Title Font Family'),
'#default_value' => variable_get('chartjs_tooltipTitleFontFamily', "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"),
);
$form['chartjs_tooltips']['chartjs_tooltipTitleFontSize'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Title Font Size'),
'#default_value' => variable_get('chartjs_tooltipTitleFontSize', '14'),
);
$form['chartjs_tooltips']['chartjs_tooltipTitleFontStyle'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Title Font Style'),
'#default_value' => variable_get('chartjs_tooltipTitleFontStyle', 'bold'),
);
$form['chartjs_tooltips']['chartjs_tooltipTitleFontColor'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Title Font Color'),
'#default_value' => variable_get('chartjs_tooltipTitleFontColor', '#fff'),
);
$form['chartjs_tooltips']['chartjs_tooltipYPadding'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Y Padding'),
'#default_value' => variable_get('chartjs_tooltipYPadding', '6'),
);
$form['chartjs_tooltips']['chartjs_tooltipXPadding'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip X Padding'),
'#default_value' => variable_get('chartjs_tooltipXPadding', '6'),
);
$form['chartjs_tooltips']['chartjs_tooltipCaretSize'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Caret Size'),
'#default_value' => variable_get('chartjs_tooltipCaretSize', '8'),
);
$form['chartjs_tooltips']['chartjs_tooltipCornerRadius'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip Corner Radius'),
'#default_value' => variable_get('chartjs_tooltipCornerRadius', '6'),
);
$form['chartjs_tooltips']['chartjs_tooltipXOffset'] = array(
'#type' => 'textfield',
'#title' => t('Tool Tip X Offset'),
'#default_value' => variable_get('chartjs_tooltipXOffset', '10'),
);
$form['chartjs_tooltips']['chartjs_tooltipTemplate'] = array(
'#type' => 'textarea',
'#title' => t('Tool Tip Template'),
'#default_value' => variable_get('chartjs_tooltipTemplate', '<%if (label){%><%=label%>: <%}%><%= value %>'),
);
$form['chartjs_tooltips']['chartjs_multiTooltipTemplate'] = array(
'#type' => 'textarea',
'#title' => t('Multi Tool Tip Template'),
'#default_value' => variable_get('chartjs_multiTooltipTemplate', '<%= value %>'),
);
return system_settings_form($form);
}