rgraph-rails 4.62 → 4.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3 -4
  3. data/lib/rgraph-rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/RGraph.bar.js +240 -3742
  5. data/vendor/assets/javascripts/RGraph.bipolar.js +165 -2005
  6. data/vendor/assets/javascripts/RGraph.common.annotate.js +35 -395
  7. data/vendor/assets/javascripts/RGraph.common.context.js +30 -595
  8. data/vendor/assets/javascripts/RGraph.common.core.js +418 -5359
  9. data/vendor/assets/javascripts/RGraph.common.csv.js +20 -276
  10. data/vendor/assets/javascripts/RGraph.common.deprecated.js +35 -450
  11. data/vendor/assets/javascripts/RGraph.common.dynamic.js +88 -1395
  12. data/vendor/assets/javascripts/RGraph.common.effects.js +90 -1545
  13. data/vendor/assets/javascripts/RGraph.common.key.js +52 -753
  14. data/vendor/assets/javascripts/RGraph.common.resizing.js +37 -563
  15. data/vendor/assets/javascripts/RGraph.common.sheets.js +29 -352
  16. data/vendor/assets/javascripts/RGraph.common.tooltips.js +32 -450
  17. data/vendor/assets/javascripts/RGraph.common.zoom.js +14 -219
  18. data/vendor/assets/javascripts/RGraph.cornergauge.js +71 -0
  19. data/vendor/assets/javascripts/RGraph.drawing.background.js +34 -570
  20. data/vendor/assets/javascripts/RGraph.drawing.circle.js +33 -544
  21. data/vendor/assets/javascripts/RGraph.drawing.image.js +51 -755
  22. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +37 -645
  23. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +36 -633
  24. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +35 -514
  25. data/vendor/assets/javascripts/RGraph.drawing.poly.js +37 -559
  26. data/vendor/assets/javascripts/RGraph.drawing.rect.js +33 -548
  27. data/vendor/assets/javascripts/RGraph.drawing.text.js +36 -664
  28. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +50 -812
  29. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +51 -856
  30. data/vendor/assets/javascripts/RGraph.fuel.js +58 -964
  31. data/vendor/assets/javascripts/RGraph.funnel.js +55 -984
  32. data/vendor/assets/javascripts/RGraph.gantt.js +77 -1354
  33. data/vendor/assets/javascripts/RGraph.gauge.js +85 -1421
  34. data/vendor/assets/javascripts/RGraph.hbar.js +162 -2788
  35. data/vendor/assets/javascripts/RGraph.hprogress.js +80 -1401
  36. data/vendor/assets/javascripts/RGraph.line.js +249 -4248
  37. data/vendor/assets/javascripts/RGraph.meter.js +74 -1280
  38. data/vendor/assets/javascripts/RGraph.modaldialog.js +19 -301
  39. data/vendor/assets/javascripts/RGraph.odo.js +71 -1264
  40. data/vendor/assets/javascripts/RGraph.pie.js +137 -2288
  41. data/vendor/assets/javascripts/RGraph.radar.js +110 -1847
  42. data/vendor/assets/javascripts/RGraph.rose.js +108 -1977
  43. data/vendor/assets/javascripts/RGraph.rscatter.js +80 -1432
  44. data/vendor/assets/javascripts/RGraph.scatter.js +172 -3163
  45. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +60 -1120
  46. data/vendor/assets/javascripts/RGraph.svg.bar.js +66 -1735
  47. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +21 -246
  48. data/vendor/assets/javascripts/RGraph.svg.common.core.js +255 -3937
  49. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +20 -276
  50. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +68 -1303
  51. data/vendor/assets/javascripts/RGraph.svg.common.key.js +19 -205
  52. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +29 -352
  53. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +22 -273
  54. data/vendor/assets/javascripts/RGraph.svg.funnel.js +32 -0
  55. data/vendor/assets/javascripts/RGraph.svg.hbar.js +59 -1400
  56. data/vendor/assets/javascripts/RGraph.svg.line.js +70 -1580
  57. data/vendor/assets/javascripts/RGraph.svg.pie.js +55 -1131
  58. data/vendor/assets/javascripts/RGraph.svg.radar.js +57 -1502
  59. data/vendor/assets/javascripts/RGraph.svg.rose.js +66 -1817
  60. data/vendor/assets/javascripts/RGraph.svg.scatter.js +58 -1261
  61. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +28 -865
  62. data/vendor/assets/javascripts/RGraph.svg.waterfall.js +45 -1252
  63. data/vendor/assets/javascripts/RGraph.thermometer.js +63 -1136
  64. data/vendor/assets/javascripts/RGraph.vprogress.js +83 -1470
  65. data/vendor/assets/javascripts/RGraph.waterfall.js +83 -1347
  66. metadata +5 -4
  67. data/vendor/assets/javascripts/financial-data.js +0 -1067
@@ -1,965 +1,59 @@
1
- // version: 2017-05-08
2
- /**
3
- * o--------------------------------------------------------------------------------o
4
- * | This file is part of the RGraph package - you can learn more at: |
5
- * | |
6
- * | http://www.rgraph.net |
7
- * | |
8
- * | RGraph is licensed under the Open Source MIT license. That means that it's |
9
- * | totally free to use! |
10
- * o--------------------------------------------------------------------------------o
11
- */
12
1
 
13
- RGraph = window.RGraph || {isRGraph: true};
14
-
15
- /**
16
- * The Fuel widget constructor
17
- *
18
- * @param object canvas The canvas object
19
- * @param int min The minimum value
20
- * @param int max The maximum value
21
- * @param int value The indicated value
22
- */
23
- RGraph.Fuel = function (conf)
24
- {
25
- /**
26
- * Allow for object config style
27
- */
28
- if ( typeof conf === 'object'
29
- && typeof conf.id === 'string') {
30
-
31
- var id = conf.id,
32
- canvas = document.getElementById(id),
33
- min = conf.min,
34
- max = conf.max,
35
- value = conf.value,
36
- parseConfObjectForOptions = true; // Set this so the config is parsed (at the end of the constructor)
37
-
38
- } else {
39
-
40
- var id = conf,
41
- canvas = document.getElementById(id),
42
- min = arguments[1],
43
- max = arguments[2],
44
- value = arguments[3];
45
- }
46
-
47
- // Get the canvas and context objects
48
- this.id = id;
49
- this.canvas = canvas;
50
- this.context = this.canvas.getContext ? this.canvas.getContext("2d", {alpha: (typeof id === 'object' && id.alpha === false) ? false : true}) : null;
51
- this.canvas.__object__ = this;
52
- this.type = 'fuel';
53
- this.isRGraph = true;
54
- this.min = RGraph.stringsToNumbers(min);
55
- this.max = RGraph.stringsToNumbers(max);
56
- this.value = RGraph.stringsToNumbers(value);
57
- this.angles = {};
58
- this.currentValue = null;
59
- this.uid = RGraph.CreateUID();
60
- this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.CreateUID();
61
- this.coordsText = [];
62
- this.original_colors = [];
63
- this.firstDraw = true; // After the first draw this will be false
64
-
65
-
66
- /**
67
- * Compatibility with older browsers
68
- */
69
- //RGraph.OldBrowserCompat(this.context);
70
-
71
-
72
- // Check for support
73
- if (!this.canvas) {
74
- alert('[FUEL] No canvas support');
75
- return;
76
- }
77
-
78
- /**
79
- * The funnel charts properties
80
- */
81
- this.properties =
82
- {
83
- 'chart.colors': ['Gradient(white:red)'],
84
- 'chart.needle.color': 'red',
85
- 'chart.gutter.left': 5,
86
- 'chart.gutter.right': 5,
87
- 'chart.gutter.top': 5,
88
- 'chart.gutter.bottom': 5,
89
- 'chart.text.size': 12,
90
- 'chart.text.color': 'black', // Does not support gradients
91
- 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
92
- 'chart.text.accessible': true,
93
- 'chart.text.accessible.overflow': 'visible',
94
- 'chart.text.accessible.pointerevents': true,
95
- 'chart.contextmenu': null,
96
- 'chart.annotatable': false,
97
- 'chart.annotate.color': 'black',
98
- 'chart.zoom.factor': 1.5,
99
- 'chart.zoom.fade.in': true,
100
- 'chart.zoom.fade.out': true,
101
- 'chart.zoom.factor': 1.5,
102
- 'chart.zoom.fade.in': true,
103
- 'chart.zoom.fade.out': true,
104
- 'chart.zoom.hdir': 'right',
105
- 'chart.zoom.vdir': 'down',
106
- 'chart.zoom.frames': 25,
107
- 'chart.zoom.delay': 16.666,
108
- 'chart.zoom.shadow': true,
109
- 'chart.zoom.background': true,
110
- 'chart.zoom.action': 'zoom',
111
- 'chart.adjustable': false,
112
- 'chart.resizable': false,
113
- 'chart.resize.handle.background': null,
114
- 'chart.icon': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAfCAYAAAD0ma06AAAEGElEQVRIS7VXSyhtYRT+jnfe5FEMjAwUBiQGHikzRWIkkgy8YyDK+xnJK5JCeZSUGKBMiAyYkMxMJAMpSfJ+2/d8695/33NunSPnHqt2Z5+91/9/' + '/' + '/et9a/1b8Pn56dmMBhg/IWDgwNoNzc38PHxkXtN0+Tiexp9eH18fIDj1Bj63N/fw8vLS/wsmcHoqKmXT09PuL29RVFREU5OTvTJ6UIAgioQ+vLe09MTb29v8PX1RWBgICYnJ+XXIqDRWXN0dJT3nIDsWlpadP+lpSWZlD4KmL/8/' + '/7+Ls/S09N1/7y8PISHh+sK/QssDJWcHEyGCnB1dRUDAwPIzMzUx5GpAnZ1dcXy8jK2trbM5j06OsLc3JzISx8q4OzsLOOsAq6treHg4AAeHh4WJbq7u0Nzc7P+PiYmBnt7ezg9PcXExAQCAgLg5OSEx8dHuLu7Wwfc3t7G/v6+yEcjO8rIROGKaWdnZ+jr6zMDjI6OxvT0tDzr6uqS2KtksspwZ2cHjY2NuqSUhnHmilUCraysmElaWloKJpQCjI2NRX5+Pl5eXr6WlCv08/MTEMVOZDH+Zzw4CdlfX1/rDHt7ezE1NQXGkcYEKi4ulkVKYlpLGouBs/JiaGgIZL25uSlecXFxohAz/ccAz8/P4e/vj7q6Ojw8PMje5DNRy94MQ0JCUFtbK2wqKipE+sHBQbi4uPwMQ86ak5ODxMREVFdXIywsDCUlJRJDXnZlmJqaip6eHuTm5kqikGlycjIyMjL+ZrY9JSUgMzQiIgINDQ2ypaqqqkCZWXHsnjQEHB8fR0pKigAxabq7uyWOlJNxtLukTJDs7GxUVlZKDNl5oqKi8Pr6+jOAIyMjiI+Pl5JGQG4F1Qy+LN7f3fiUdGZmBsHBwRgbG8Pw8LD01ba2NmlX0rTtnTQLCwvSjEdHR3FxcSExLCwsRGRkpBR9vePzeMDyw3bT1NT0XXLiT4a7u7s4Pj4GGzd7K8GCgoKEsRR8I4Cm6hwHXV5eiv62GAE5npMTmFuBTCkzmzT7qs5Q9TlW/o6ODlvwhCHPM5SVPZIxYzNeXFxEa2srvL29YTC2GI3aMm3Zeq6urv4LMC0tDRsbG1K8k5KS9DgS0IwhKVFjSsJA22r9/f0oKCgQdvPz83JEmZ2dlcpD9maSshow0KZnlO8Csx9yK3BLKCMJPpf2xGMigdi9WXooaWdn53dxdP+amhrZh4eHh1hfX5cTW319vZyBnp+ffzNkBWBmhYaGysB/j322oCckJCArK0uGMlsJ5ubmBoPxRiMzFlomjr2MGdne3i5ANILRJEtJt6ysTG8h9gDl4am8vFwSUWron1O9LulXIOqk9pWftfdSS40yyj5Uh101wPRryuR7R1ZMX/U1pfy5IF40xcgUnGAc9wsGYxsFhy87kwAAAABJRU5ErkJggg==',
115
- 'chart.icon.redraw': true,
116
- 'chart.background.image.stretch': false,
117
- 'chart.background.image.x': null,
118
- 'chart.background.image.y': null,
119
- 'chart.labels.full': 'F',
120
- 'chart.labels.empty': 'E',
121
- 'chart.labels.count': 5,
122
- 'chart.centerx': null,
123
- 'chart.centery': null,
124
- 'chart.radius': null,
125
- 'chart.scale.visible': false,
126
- 'chart.scale.decimals': 0,
127
- 'chart.units.pre': '',
128
- 'chart.units.post': '',
129
- 'chart.clearto': 'rgba(0,0,0,0)'
130
- }
131
-
132
- /**
133
- * Bounds checking - if the value is outside the scale
134
- */
135
- if (this.value > this.max) this.value = this.max;
136
- if (this.value < this.min) this.value = this.min;
137
-
138
-
139
-
140
-
141
-
142
- /*
143
- * Translate half a pixel for antialiasing purposes - but only if it hasn't beeen
144
- * done already
145
- */
146
- if (!this.canvas.__rgraph_aa_translated__) {
147
- this.context.translate(0.5,0.5);
148
-
149
- this.canvas.__rgraph_aa_translated__ = true;
150
- }
151
-
152
-
153
-
154
- // Short variable names
155
- var RG = RGraph,
156
- ca = this.canvas,
157
- co = ca.getContext('2d'),
158
- prop = this.properties,
159
- pa2 = RG.path2,
160
- win = window,
161
- doc = document,
162
- ma = Math
163
-
164
-
165
-
166
- /**
167
- * "Decorate" the object with the generic effects if the effects library has been included
168
- */
169
- if (RG.Effects && typeof RG.Effects.decorate === 'function') {
170
- RG.Effects.decorate(this);
171
- }
172
-
173
-
174
- /**
175
- * A setter
176
- *
177
- * @param name string The name of the property to set
178
- * @param value mixed The value of the property
179
- */
180
- this.set =
181
- this.Set = function (name)
182
- {
183
- var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
184
-
185
- /**
186
- * the number of arguments is only one and it's an
187
- * object - parse it for configuration data and return.
188
- */
189
- if (arguments.length === 1 && typeof name === 'object') {
190
- RG.parseObjectStyleConfig(this, name);
191
- return this;
192
- }
193
-
194
-
195
-
196
-
197
-
198
- /**
199
- * This should be done first - prepend the propertyy name with "chart." if necessary
200
- */
201
- if (name.substr(0,6) != 'chart.') {
202
- name = 'chart.' + name;
203
- }
204
-
205
-
206
-
207
-
208
- // Convert uppercase letters to dot+lower case letter
209
- while(name.match(/([A-Z])/)) {
210
- name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
211
- }
212
-
213
-
214
-
215
-
216
-
217
-
218
- prop[name] = value;
219
-
220
- return this;
221
- };
222
-
223
-
224
-
225
-
226
- /**
227
- * A getter
228
- *
229
- * @param name string The name of the property to get
230
- */
231
- this.get =
232
- this.Get = function (name)
233
- {
234
- /**
235
- * This should be done first - prepend the property name with "chart." if necessary
236
- */
237
- if (name.substr(0,6) != 'chart.') {
238
- name = 'chart.' + name;
239
- }
240
-
241
- // Convert uppercase letters to dot+lower case letter
242
- while(name.match(/([A-Z])/)) {
243
- name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
244
- }
245
-
246
- return prop[name.toLowerCase()];
247
- };
248
-
249
-
250
-
251
-
252
- /**
253
- * The function you call to draw the bar chart
254
- */
255
- this.draw =
256
- this.Draw = function ()
257
- {
258
- /**
259
- * Fire the onbeforedraw event
260
- */
261
- RG.FireCustomEvent(this, 'onbeforedraw');
262
-
263
-
264
-
265
- /**
266
- * Set the current value
267
- */
268
- this.currentValue = this.value;
269
-
270
-
271
-
272
- /**
273
- * This is new in May 2011 and facilitates indiviual gutter settings,
274
- * eg chart.gutter.left
275
- */
276
- this.gutterLeft = prop['chart.gutter.left'];
277
- this.gutterRight = prop['chart.gutter.right'];
278
- this.gutterTop = prop['chart.gutter.top'];
279
- this.gutterBottom = prop['chart.gutter.bottom'];
280
-
281
-
282
-
283
- /**
284
- * Get the center X and Y of the chart. This is the center of the needle bulb
285
- */
286
- this.centerx = ((ca.width - this.gutterLeft - this.gutterRight) / 2) + this.gutterLeft;
287
- this.centery = ca.height - 20 - this.gutterBottom
288
-
289
-
290
-
291
- /**
292
- * Work out the radius of the chart
293
- */
294
- this.radius = ca.height - this.gutterTop - this.gutterBottom - 20;
295
-
296
- /**
297
- * Stop this growing uncntrollably
298
- */
299
- this.coordsText = [];
300
-
301
-
302
-
303
- /**
304
- * You can now specify chart.centerx, chart.centery and chart.radius
305
- */
306
- if (typeof(prop['chart.centerx']) == 'number') this.centerx = prop['chart.centerx'];
307
- if (typeof(prop['chart.centery']) == 'number') this.centery = prop['chart.centery'];
308
- if (typeof(prop['chart.radius']) == 'number') this.radius = prop['chart.radius'];
309
-
310
-
311
-
312
-
313
- /**
314
- * Parse the colors. This allows for simple gradient syntax
315
- */
316
- if (!this.colorsParsed) {
317
- this.parseColors();
318
-
319
- // Don't want to do this again
320
- this.colorsParsed = true;
321
- }
322
-
323
-
324
- /**
325
- * The start and end angles of the chart
326
- */
327
- this.angles.start = (RG.PI + RG.HALFPI) - 0.5;
328
- this.angles.end = (RG.PI + RG.HALFPI) + 0.5;
329
- this.angles.needle = this.getAngle(this.value);
330
-
331
-
332
-
333
- /**
334
- * Draw the labels on the chart
335
- */
336
- this.DrawLabels();
337
-
338
-
339
- /**
340
- * Draw the fuel guage
341
- */
342
- this.DrawChart();
343
-
344
-
345
-
346
-
347
-
348
- /**
349
- * Setup the context menu if required
350
- */
351
- if (prop['chart.contextmenu']) {
352
- RG.ShowContext(this);
353
- }
354
-
355
-
356
- /**
357
- * This function enables resizing
358
- */
359
- if (prop['chart.resizable']) {
360
- RG.AllowResizing(this);
361
- }
362
-
363
-
364
- /**
365
- * This installs the event listeners
366
- */
367
- RG.InstallEventListeners(this);
368
-
369
-
370
-
371
- /**
372
- * Fire the onfirstdraw event
373
- */
374
- if (this.firstDraw) {
375
- RG.fireCustomEvent(this, 'onfirstdraw');
376
- this.firstDraw = false;
377
- this.firstDrawFunc();
378
- }
379
-
380
-
381
-
382
- /**
383
- * Fire the RGraph ondraw event
384
- */
385
- RG.FireCustomEvent(this, 'ondraw');
386
-
387
- return this;
388
- };
389
-
390
-
391
-
392
- /**
393
- * Used in chaining. Runs a function there and then - not waiting for
394
- * the events to fire (eg the onbeforedraw event)
395
- *
396
- * @param function func The function to execute
397
- */
398
- this.exec = function (func)
399
- {
400
- func(this);
401
-
402
- return this;
403
- };
404
-
405
-
406
-
407
-
408
- /**
409
- * This function actually draws the chart
410
- */
411
- this.drawChart =
412
- this.DrawChart = function ()
413
- {
414
- /**
415
- * Draw the "Scale"
416
- */
417
- this.DrawScale();
418
-
419
- /**
420
- * Place the icon on the canvas
421
- */
422
- if (!RG.ISOLD) {
423
- this.DrawIcon();
424
- }
425
-
426
-
427
-
428
- /**
429
- * Draw the needle
430
- */
431
- this.DrawNeedle();
432
- };
433
-
434
-
435
-
436
-
437
- /**
438
- * Draws the labels
439
- */
440
- this.drawLabels =
441
- this.DrawLabels = function ()
442
- {
443
- if (!prop['chart.scale.visible']) {
444
- var radius = (this.radius - 20);
445
- co.fillStyle = prop['chart.text.color'];
446
-
447
- // Draw the left label
448
- var y = this.centery - Math.sin(this.angles.start - RG.PI) * (this.radius - 25);
449
- var x = this.centerx - Math.cos(this.angles.start - RG.PI) * (this.radius - 25);
450
- RG.Text2(this, {'font':prop['chart.text.font'],
451
- 'size':prop['chart.text.size'],
452
- 'x':x,
453
- 'y':y,
454
- 'text':prop['chart.labels.empty'],
455
- 'halign': 'center',
456
- 'valign':'center',
457
- 'tag': 'labels'
458
- });
459
-
460
- // Draw the right label
461
- var y = this.centery - Math.sin(this.angles.start - RG.PI) * (this.radius - 25);
462
- var x = this.centerx + Math.cos(this.angles.start - RG.PI) * (this.radius - 25);
463
- RG.Text2(this, {'font':prop['chart.text.font'],
464
- 'size':prop['chart.text.size'],
465
- 'x':x,
466
- 'y':y,
467
- 'text':prop['chart.labels.full'],
468
- 'halign': 'center',
469
- 'valign':'center',
470
- 'tag': 'labels'
471
- });
472
- }
473
- };
474
-
475
-
476
-
477
-
478
-
479
- /**
480
- * Draws the needle
481
- */
482
- this.drawNeedle =
483
- this.DrawNeedle = function ()
484
- {
485
- // Draw the actual needle
486
- co.beginPath();
487
- co.lineWidth = 5;
488
- co.lineCap = 'round';
489
- co.strokeStyle = prop['chart.needle.color'];
490
-
491
- /**
492
- * The angle for the needle
493
- */
494
- var angle = this.angles.needle;
495
-
496
- co.arc(this.centerx, this.centery, this.radius - 30, angle, angle + 0.0001, false);
497
- co.lineTo(this.centerx, this.centery);
498
- co.stroke();
499
-
500
- co.lineWidth = 1;
501
-
502
- // Create the gradient for the bulb
503
- var cx = this.centerx + 10;
504
- var cy = this.centery - 10
505
-
506
- var grad = co.createRadialGradient(cx, cy, 35, cx, cy, 0);
507
- grad.addColorStop(0, 'black');
508
- grad.addColorStop(1, '#eee');
509
-
510
- if (navigator.userAgent.indexOf('Firefox/6.0') > 0) {
511
- grad = co.createLinearGradient(cx + 10, cy - 10, cx - 10, cy + 10);
512
- grad.addColorStop(1, '#666');
513
- grad.addColorStop(0.5, '#ccc');
514
- }
515
-
516
- // Draw the bulb
517
- co.beginPath();
518
- co.fillStyle = grad;
519
- co.moveTo(this.centerx, this.centery);
520
- co.arc(this.centerx, this.centery, 20, 0, RG.TWOPI, 0);
521
- co.fill();
522
- };
523
-
524
-
525
- /**
526
- * Draws the "scale"
527
- */
528
- this.drawScale =
529
- this.DrawScale = function ()
530
- {
531
- var a, x, y;
532
-
533
- //First draw the fill background
534
- co.beginPath();
535
- co.strokeStyle = 'black';
536
- co.fillStyle = 'white';
537
- co.arc(this.centerx, this.centery, this.radius, this.angles.start, this.angles.end, false);
538
- co.arc(this.centerx, this.centery, this.radius - 10, this.angles.end, this.angles.start, true);
539
- co.closePath();
540
- co.stroke();
541
- co.fill();
542
-
543
- //First draw the fill itself
544
- var start = this.angles.start;
545
- var end = this.angles.needle;
546
-
547
- co.beginPath();
548
- co.fillStyle = prop['chart.colors'][0];
549
- co.arc(this.centerx, this.centery, this.radius, start, end, false);
550
- co.arc(this.centerx, this.centery, this.radius - 10, end, start, true);
551
- co.closePath();
552
- //co.stroke();
553
- co.fill();
554
-
555
- // This draws the tickmarks
556
- for (a = this.angles.start; a<=this.angles.end+0.01; a+=((this.angles.end - this.angles.start) / 5)) {
557
- co.beginPath();
558
- co.arc(this.centerx, this.centery, this.radius - 10, a, a + 0.0001, false);
559
- co.arc(this.centerx, this.centery, this.radius - 15, a + 0.0001, a, true);
560
- co.stroke();
561
- }
562
-
563
- /**
564
- * If chart.scale.visible is specified draw the textual scale
565
- */
566
- if (prop['chart.scale.visible']) {
567
-
568
- co.fillStyle = prop['chart.text.color'];
569
-
570
- // The labels
571
- var numLabels = prop['chart.labels.count'];
572
- var decimals = prop['chart.scale.decimals'];
573
- var font = prop['chart.text.font'];
574
- var size = prop['chart.text.size'];
575
- var units_post = prop['chart.units.post'];
576
- var units_pre = prop['chart.units.pre'];
577
-
578
- for (var i=0; i<=numLabels; ++i) {
579
- a = ((this.angles.end - this.angles.start) * (i/numLabels)) + this.angles.start;
580
- y = this.centery - Math.sin(a - RG.PI) * (this.radius - 25);
581
- x = this.centerx - Math.cos(a - RG.PI) * (this.radius - 25);
582
-
583
-
584
- RG.Text2(this, {'font':font,
585
- 'size':size,
586
- 'x':x,
587
- 'y':y,
588
- 'text': RG.number_format(this, (this.min + ((this.max - this.min) * (i/numLabels))).toFixed(decimals),units_pre,units_post),
589
- 'halign': 'center',
590
- 'valign':'center',
591
- 'tag': 'scale'
592
- });
593
- }
594
- }
595
- };
596
-
597
-
598
-
599
-
600
- /**
601
- * A placeholder function that is here to prevent errors
602
- */
603
- this.getShape = function (e) {};
604
-
605
-
606
-
607
-
608
- /**
609
- * This function returns the pertinent value based on a click
610
- *
611
- * @param object e An event object
612
- * @return number The relevant value at the point of click
613
- */
614
- this.getValue = function (e)
615
- {
616
- var mouseXY = RG.getMouseXY(e);
617
- var angle = RG.getAngleByXY(this.centerx, this.centery, mouseXY[0], mouseXY[1]);
618
-
619
- /**
620
- * Boundary checking
621
- */
622
- if (angle >= this.angles.end) {
623
- return this.max;
624
- } else if (angle <= this.angles.start) {
625
- return this.min;
626
- }
627
-
628
- var value = (angle - this.angles.start) / (this.angles.end - this.angles.start);
629
- value = value * (this.max - this.min);
630
- value = value + this.min;
631
-
632
- return value;
633
- };
634
-
635
-
636
-
637
-
638
- /**
639
- * The getObjectByXY() worker method. Don't call this call:
640
- *
641
- * RG.ObjectRegistry.getObjectByXY(e)
642
- *
643
- * @param object e The event object
644
- */
645
- this.getObjectByXY = function (e)
646
- {
647
- var mouseXY = RG.getMouseXY(e);
648
- var angle = RG.getAngleByXY(this.centerx, this.centery, mouseXY[0], mouseXY[1]);
649
- var accuracy = 15;
650
-
651
- var leftMin = this.centerx - this.radius;
652
- var rightMax = this.centerx + this.radius;
653
- var topMin = this.centery - this.radius;
654
- var bottomMax = this.centery + this.radius;
655
-
656
- if (
657
- mouseXY[0] > leftMin
658
- && mouseXY[0] < rightMax
659
- && mouseXY[1] > topMin
660
- && mouseXY[1] < bottomMax
661
- ) {
662
-
663
- return this;
664
- }
665
- };
666
-
667
-
668
-
669
-
670
- /**
671
- * Draws the icon
672
- */
673
- this.drawIcon =
674
- this.DrawIcon = function ()
675
- {
676
- if (!RG.ISOLD) {
677
-
678
- if (!this.__icon__ || !this.__icon__.__loaded__) {
679
- var img = new Image();
680
- img.src = prop['chart.icon'];
681
- img.__object__ = this;
682
- this.__icon__ = img;
683
-
684
-
685
- img.onload = function (e)
686
- {
687
- img.__loaded__ = true;
688
- var obj = img.__object__;
689
- //var co = obj.context;
690
- //var prop = obj.properties;
691
-
692
- co.drawImage(img,obj.centerx - (img.width / 2), obj.centery - obj.radius + 35);
693
-
694
- obj.DrawNeedle();
695
-
696
- if (prop['chart.icon.redraw']) {
697
- obj.Set('chart.icon.redraw', false);
698
- RG.Clear(obj.canvas);
699
- RG.RedrawCanvas(ca);
700
- }
701
- }
702
- } else {
703
- var img = this.__icon__;
704
- co.drawImage(img,this.centerx - (img.width / 2), this.centery - this.radius + 35);
705
- }
706
- }
707
-
708
- this.DrawNeedle();
709
- };
710
-
711
-
712
-
713
-
714
- /**
715
- * This method handles the adjusting calculation for when the mouse is moved
716
- *
717
- * @param object e The event object
718
- */
719
- this.adjusting_mousemove =
720
- this.Adjusting_mousemove = function (e)
721
- {
722
- /**
723
- * Handle adjusting for the Fuel gauge
724
- */
725
- if (prop['chart.adjustable'] && RG.Registry.Get('chart.adjusting') && RG.Registry.Get('chart.adjusting').uid == this.uid) {
726
- this.value = this.getValue(e);
727
- //RG.Clear(ca);
728
- RG.redrawCanvas(ca);
729
- RG.fireCustomEvent(this, 'onadjust');
730
- }
731
- };
732
-
733
-
734
-
735
-
736
- /**
737
- * This method gives you the relevant angle (in radians) that a particular value is
738
- *
739
- * @param number value The relevant angle
740
- */
741
- this.getAngle = function (value)
742
- {
743
- // Range checking
744
- if (value < this.min || value > this.max) {
745
- return null;
746
- }
747
-
748
- var angle = (((value - this.min) / (this.max - this.min)) * (this.angles.end - this.angles.start)) + this.angles.start;
749
-
750
- return angle;
751
- };
752
-
753
-
754
-
755
-
756
- /**
757
- * This allows for easy specification of gradients
758
- */
759
- this.parseColors = function ()
760
- {
761
- // Save the original colors so that they can be restored when the canvas is reset
762
- if (this.original_colors.length === 0) {
763
- this.original_colors['chart.colors'] = RG.array_clone(prop['chart.colors']);
764
- this.original_colors['chart.needle.color'] = RG.array_clone(prop['chart.needle.color']);
765
- }
766
-
767
- var props = this.properties;
768
- var colors = props['chart.colors'];
769
-
770
- for (var i=0; i<colors.length; ++i) {
771
- colors[i] = this.parseSingleColorForLinearGradient(colors[i]);
772
- }
773
-
774
- props['chart.needle.color'] = this.parseSingleColorForRadialGradient(props['chart.needle.color']);
775
- };
776
-
777
-
778
-
779
-
780
- /**
781
- * Use this function to reset the object to the post-constructor state. Eg reset colors if
782
- * need be etc
783
- */
784
- this.reset = function ()
785
- {
786
- };
787
-
788
-
789
-
790
-
791
- /**
792
- * This parses a single color value
793
- */
794
- this.parseSingleColorForLinearGradient = function (color)
795
- {
796
- if (!color || typeof(color) != 'string') {
797
- return color;
798
- }
799
-
800
- if (color.match(/^gradient\((.*)\)$/i)) {
801
-
802
- var parts = RegExp.$1.split(':');
803
-
804
- // Create the gradient
805
- var grad = co.createLinearGradient(prop['chart.gutter.left'],0,ca.width - prop['chart.gutter.right'],0);
806
-
807
- var diff = 1 / (parts.length - 1);
808
-
809
- grad.addColorStop(0, RG.trim(parts[0]));
810
-
811
- for (var j=1; j<parts.length; ++j) {
812
- grad.addColorStop(j * diff, RG.trim(parts[j]));
813
- }
814
- }
815
-
816
- return grad ? grad : color;
817
- };
818
-
819
-
820
-
821
-
822
- /**
823
- * This parses a single color value
824
- */
825
- this.parseSingleColorForRadialGradient = function (color)
826
- {
827
- if (!color || typeof color != 'string') {
828
- return color;
829
- }
830
-
831
- if (color.match(/^gradient\((.*)\)$/i)) {
832
-
833
- var parts = RegExp.$1.split(':');
834
-
835
- // Create the gradient
836
- var grad = co.createRadialGradient(this.centerx, this.centery, 0, this.centerx, this.centery, this.radius);
837
-
838
- var diff = 1 / (parts.length - 1);
839
-
840
- grad.addColorStop(0, RG.trim(parts[0]));
841
-
842
- for (var j=1; j<parts.length; ++j) {
843
- grad.addColorStop(j * diff, RG.trim(parts[j]));
844
- }
845
- }
846
-
847
- return grad ? grad : color;
848
- };
849
-
850
-
851
-
852
-
853
- /**
854
- * Using a function to add events makes it easier to facilitate method chaining
855
- *
856
- * @param string type The type of even to add
857
- * @param function func
858
- */
859
- this.on = function (type, func)
860
- {
861
- if (type.substr(0,2) !== 'on') {
862
- type = 'on' + type;
863
- }
864
-
865
- if (typeof this[type] !== 'function') {
866
- this[type] = func;
867
- } else {
868
- RG.addCustomEventListener(this, type, func);
869
- }
870
-
871
- return this;
872
- };
873
-
874
-
875
-
876
-
877
- /**
878
- * This function runs once only
879
- * (put at the end of the file (before any effects))
880
- */
881
- this.firstDrawFunc = function ()
882
- {
883
- };
884
-
885
-
886
-
887
-
888
- /**
889
- * Grow
890
- *
891
- * The Fuel chart Grow effect gradually increases the values of the Fuel chart
892
- *
893
- * @param object obj The graph object
894
- */
895
- this.grow = function ()
896
- {
897
- var callback = arguments[1] || function () {};
898
- var opt = arguments[0] || {};
899
- var numFrames = opt.frames || 30;
900
- var frame = 0;
901
- var obj = this;
902
- var origValue = Number(this.currentValue);
903
-
904
- if (this.currentValue == null) {
905
- this.currentValue = this.min;
906
- origValue = this.min;
907
- }
908
-
909
- var newValue = this.value;
910
- var diff = newValue - origValue;
911
- var step = (diff / numFrames);
912
- var frame = 0;
913
-
914
-
915
- function iterator ()
916
- {
917
- frame++;
918
-
919
- obj.value = ((frame / numFrames) * diff) + origValue
920
-
921
- if (obj.value > obj.max) obj.value = obj.max;
922
- if (obj.value < obj.min) obj.value = obj.min;
923
-
924
- RGraph.clear(obj.canvas);
925
- RGraph.redrawCanvas(obj.canvas);
926
-
927
- if (frame < numFrames) {
928
- RGraph.Effects.updateCanvas(iterator);
929
-
930
- // The callback variable is always function
931
- } else {
932
- callback(obj);
933
- }
934
- }
935
-
936
- iterator();
937
-
938
- return this;
939
- };
940
-
941
-
942
-
943
- RG.att(ca);
944
-
945
-
946
-
947
-
948
- /**
949
- * Now need to register all chart types. MUST be after the setters/getters are defined
950
- *
951
- * *** MUST BE LAST IN THE CONSTRUCTOR ***
952
- */
953
- RG.Register(this);
954
-
955
-
956
-
957
-
958
- /**
959
- * This is the 'end' of the constructor so if the first argument
960
- * contains configuration data - handle that.
961
- */
962
- if (parseConfObjectForOptions) {
963
- RG.parseObjectStyleConfig(this, conf.options);
964
- }
965
- };
2
+ RGraph=window.RGraph||{isRGraph:true};RGraph.Fuel=function(conf)
3
+ {if(typeof conf==='object'&&typeof conf.id==='string'){var id=conf.id,canvas=document.getElementById(id),min=conf.min,max=conf.max,value=conf.value,parseConfObjectForOptions=true;}else{var id=conf,canvas=document.getElementById(id),min=arguments[1],max=arguments[2],value=arguments[3];}
4
+ this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='fuel';this.isRGraph=true;this.min=RGraph.stringsToNumbers(min);this.max=RGraph.stringsToNumbers(max);this.value=RGraph.stringsToNumbers(value);this.angles={};this.currentValue=null;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.coordsText=[];this.original_colors=[];this.firstDraw=true;if(!this.canvas){alert('[FUEL] No canvas support');return;}
5
+ this.properties={'chart.colors':['Gradient(white:red)'],'chart.needle.color':'red','chart.gutter.left':5,'chart.gutter.right':5,'chart.gutter.top':5,'chart.gutter.bottom':5,'chart.text.size':12,'chart.text.color':'black','chart.text.font':'Segoe UI, Arial, Verdana, sans-serif','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':true,'chart.contextmenu':null,'chart.annotatable':false,'chart.annotate.color':'black','chart.zoom.factor':1.5,'chart.zoom.fade.in':true,'chart.zoom.fade.out':true,'chart.zoom.factor':1.5,'chart.zoom.fade.in':true,'chart.zoom.fade.out':true,'chart.zoom.hdir':'right','chart.zoom.vdir':'down','chart.zoom.frames':25,'chart.zoom.delay':16.666,'chart.zoom.shadow':true,'chart.zoom.background':true,'chart.zoom.action':'zoom','chart.adjustable':false,'chart.resizable':false,'chart.resize.handle.background':null,'chart.icon':'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAfCAYAAAD0ma06AAAEGElEQVRIS7VXSyhtYRT+jnfe5FEMjAwUBiQGHikzRWIkkgy8YyDK+xnJK5JCeZSUGKBMiAyYkMxMJAMpSfJ+2/d8695/33NunSPnHqt2Z5+91/9/'+'/'+'/et9a/1b8Pn56dmMBhg/IWDgwNoNzc38PHxkXtN0+Tiexp9eH18fIDj1Bj63N/fw8vLS/wsmcHoqKmXT09PuL29RVFREU5OTvTJ6UIAgioQ+vLe09MTb29v8PX1RWBgICYnJ+XXIqDRWXN0dJT3nIDsWlpadP+lpSWZlD4KmL/8/'+'/7+Ls/S09N1/7y8PISHh+sK/QssDJWcHEyGCnB1dRUDAwPIzMzUx5GpAnZ1dcXy8jK2trbM5j06OsLc3JzISx8q4OzsLOOsAq6treHg4AAeHh4WJbq7u0Nzc7P+PiYmBnt7ezg9PcXExAQCAgLg5OSEx8dHuLu7Wwfc3t7G/v6+yEcjO8rIROGKaWdnZ+jr6zMDjI6OxvT0tDzr6uqS2KtksspwZ2cHjY2NuqSUhnHmilUCraysmElaWloKJpQCjI2NRX5+Pl5eXr6WlCv08/MTEMVOZDH+Zzw4CdlfX1/rDHt7ezE1NQXGkcYEKi4ulkVKYlpLGouBs/JiaGgIZL25uSlecXFxohAz/ccAz8/P4e/vj7q6Ojw8PMje5DNRy94MQ0JCUFtbK2wqKipE+sHBQbi4uPwMQ86ak5ODxMREVFdXIywsDCUlJRJDXnZlmJqaip6eHuTm5kqikGlycjIyMjL+ZrY9JSUgMzQiIgINDQ2ypaqqqkCZWXHsnjQEHB8fR0pKigAxabq7uyWOlJNxtLukTJDs7GxUVlZKDNl5oqKi8Pr6+jOAIyMjiI+Pl5JGQG4F1Qy+LN7f3fiUdGZmBsHBwRgbG8Pw8LD01ba2NmlX0rTtnTQLCwvSjEdHR3FxcSExLCwsRGRkpBR9vePzeMDyw3bT1NT0XXLiT4a7u7s4Pj4GGzd7K8GCgoKEsRR8I4Cm6hwHXV5eiv62GAE5npMTmFuBTCkzmzT7qs5Q9TlW/o6ODlvwhCHPM5SVPZIxYzNeXFxEa2srvL29YTC2GI3aMm3Zeq6urv4LMC0tDRsbG1K8k5KS9DgS0IwhKVFjSsJA22r9/f0oKCgQdvPz83JEmZ2dlcpD9maSshow0KZnlO8Csx9yK3BLKCMJPpf2xGMigdi9WXooaWdn53dxdP+amhrZh4eHh1hfX5cTW319vZyBnp+ffzNkBWBmhYaGysB/j322oCckJCArK0uGMlsJ5ubmBoPxRiMzFlomjr2MGdne3i5ANILRJEtJt6ysTG8h9gDl4am8vFwSUWron1O9LulXIOqk9pWftfdSS40yyj5Uh101wPRryuR7R1ZMX/U1pfy5IF40xcgUnGAc9wsGYxsFhy87kwAAAABJRU5ErkJggg==','chart.icon.redraw':true,'chart.background.image.stretch':false,'chart.background.image.x':null,'chart.background.image.y':null,'chart.labels.full':'F','chart.labels.empty':'E','chart.labels.count':5,'chart.centerx':null,'chart.centery':null,'chart.radius':null,'chart.scale.visible':false,'chart.scale.decimals':0,'chart.units.pre':'','chart.units.post':'','chart.clearto':'rgba(0,0,0,0)'}
6
+ if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
7
+ var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
8
+ if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
9
+ this.set=this.Set=function(name)
10
+ {var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
11
+ if(name.substr(0,6)!='chart.'){name='chart.'+name;}
12
+ while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
13
+ prop[name]=value;return this;};this.get=this.Get=function(name)
14
+ {if(name.substr(0,6)!='chart.'){name='chart.'+name;}
15
+ while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
16
+ return prop[name.toLowerCase()];};this.draw=this.Draw=function()
17
+ {RG.FireCustomEvent(this,'onbeforedraw');this.currentValue=this.value;this.gutterLeft=prop['chart.gutter.left'];this.gutterRight=prop['chart.gutter.right'];this.gutterTop=prop['chart.gutter.top'];this.gutterBottom=prop['chart.gutter.bottom'];this.centerx=((ca.width-this.gutterLeft-this.gutterRight)/2)+this.gutterLeft;this.centery=ca.height-20-this.gutterBottom
18
+ this.radius=ca.height-this.gutterTop-this.gutterBottom-20;this.coordsText=[];if(typeof(prop['chart.centerx'])=='number')this.centerx=prop['chart.centerx'];if(typeof(prop['chart.centery'])=='number')this.centery=prop['chart.centery'];if(typeof(prop['chart.radius'])=='number')this.radius=prop['chart.radius'];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
19
+ this.angles.start=(RG.PI+RG.HALFPI)-0.5;this.angles.end=(RG.PI+RG.HALFPI)+0.5;this.angles.needle=this.getAngle(this.value);this.DrawLabels();this.DrawChart();if(prop['chart.contextmenu']){RG.ShowContext(this);}
20
+ if(prop['chart.resizable']){RG.AllowResizing(this);}
21
+ RG.InstallEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
22
+ RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
23
+ {func(this);return this;};this.drawChart=this.DrawChart=function()
24
+ {this.DrawScale();if(!RG.ISOLD){this.DrawIcon();}
25
+ this.DrawNeedle();};this.drawLabels=this.DrawLabels=function()
26
+ {if(!prop['chart.scale.visible']){var radius=(this.radius-20);co.fillStyle=prop['chart.text.color'];var y=this.centery-Math.sin(this.angles.start-RG.PI)*(this.radius-25);var x=this.centerx-Math.cos(this.angles.start-RG.PI)*(this.radius-25);RG.Text2(this,{'font':prop['chart.text.font'],'size':prop['chart.text.size'],'x':x,'y':y,'text':prop['chart.labels.empty'],'halign':'center','valign':'center','tag':'labels'});var y=this.centery-Math.sin(this.angles.start-RG.PI)*(this.radius-25);var x=this.centerx+Math.cos(this.angles.start-RG.PI)*(this.radius-25);RG.Text2(this,{'font':prop['chart.text.font'],'size':prop['chart.text.size'],'x':x,'y':y,'text':prop['chart.labels.full'],'halign':'center','valign':'center','tag':'labels'});}};this.drawNeedle=this.DrawNeedle=function()
27
+ {co.beginPath();co.lineWidth=5;co.lineCap='round';co.strokeStyle=prop['chart.needle.color'];var angle=this.angles.needle;co.arc(this.centerx,this.centery,this.radius-30,angle,angle+0.0001,false);co.lineTo(this.centerx,this.centery);co.stroke();co.lineWidth=1;var cx=this.centerx+10;var cy=this.centery-10
28
+ var grad=co.createRadialGradient(cx,cy,35,cx,cy,0);grad.addColorStop(0,'black');grad.addColorStop(1,'#eee');if(navigator.userAgent.indexOf('Firefox/6.0')>0){grad=co.createLinearGradient(cx+10,cy-10,cx-10,cy+10);grad.addColorStop(1,'#666');grad.addColorStop(0.5,'#ccc');}
29
+ co.beginPath();co.fillStyle=grad;co.moveTo(this.centerx,this.centery);co.arc(this.centerx,this.centery,20,0,RG.TWOPI,0);co.fill();};this.drawScale=this.DrawScale=function()
30
+ {var a,x,y;co.beginPath();co.strokeStyle='black';co.fillStyle='white';co.arc(this.centerx,this.centery,this.radius,this.angles.start,this.angles.end,false);co.arc(this.centerx,this.centery,this.radius-10,this.angles.end,this.angles.start,true);co.closePath();co.stroke();co.fill();var start=this.angles.start;var end=this.angles.needle;co.beginPath();co.fillStyle=prop['chart.colors'][0];co.arc(this.centerx,this.centery,this.radius,start,end,false);co.arc(this.centerx,this.centery,this.radius-10,end,start,true);co.closePath();co.fill();for(a=this.angles.start;a<=this.angles.end+0.01;a+=((this.angles.end-this.angles.start)/5)){co.beginPath();co.arc(this.centerx,this.centery,this.radius-10,a,a+0.0001,false);co.arc(this.centerx,this.centery,this.radius-15,a+0.0001,a,true);co.stroke();}
31
+ if(prop['chart.scale.visible']){co.fillStyle=prop['chart.text.color'];var numLabels=prop['chart.labels.count'];var decimals=prop['chart.scale.decimals'];var font=prop['chart.text.font'];var size=prop['chart.text.size'];var units_post=prop['chart.units.post'];var units_pre=prop['chart.units.pre'];for(var i=0;i<=numLabels;++i){a=((this.angles.end-this.angles.start)*(i/numLabels))+this.angles.start;y=this.centery-Math.sin(a-RG.PI)*(this.radius-25);x=this.centerx-Math.cos(a-RG.PI)*(this.radius-25);RG.Text2(this,{'font':font,'size':size,'x':x,'y':y,'text':RG.number_format(this,(this.min+((this.max-this.min)*(i/numLabels))).toFixed(decimals),units_pre,units_post),'halign':'center','valign':'center','tag':'scale'});}}};this.getShape=function(e){};this.getValue=function(e)
32
+ {var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(this.centerx,this.centery,mouseXY[0],mouseXY[1]);if(angle>=this.angles.end){return this.max;}else if(angle<=this.angles.start){return this.min;}
33
+ var value=(angle-this.angles.start)/(this.angles.end-this.angles.start);value=value*(this.max-this.min);value=value+this.min;return value;};this.getObjectByXY=function(e)
34
+ {var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(this.centerx,this.centery,mouseXY[0],mouseXY[1]);var accuracy=15;var leftMin=this.centerx-this.radius;var rightMax=this.centerx+this.radius;var topMin=this.centery-this.radius;var bottomMax=this.centery+this.radius;if(mouseXY[0]>leftMin&&mouseXY[0]<rightMax&&mouseXY[1]>topMin&&mouseXY[1]<bottomMax){return this;}};this.drawIcon=this.DrawIcon=function()
35
+ {if(!RG.ISOLD){if(!this.__icon__||!this.__icon__.__loaded__){var img=new Image();img.src=prop['chart.icon'];img.__object__=this;this.__icon__=img;img.onload=function(e)
36
+ {img.__loaded__=true;var obj=img.__object__;co.drawImage(img,obj.centerx-(img.width/2),obj.centery-obj.radius+35);obj.DrawNeedle();if(prop['chart.icon.redraw']){obj.Set('chart.icon.redraw',false);RG.Clear(obj.canvas);RG.RedrawCanvas(ca);}}}else{var img=this.__icon__;co.drawImage(img,this.centerx-(img.width/2),this.centery-this.radius+35);}}
37
+ this.DrawNeedle();};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
38
+ {if(prop['chart.adjustable']&&RG.Registry.Get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){this.value=this.getValue(e);RG.redrawCanvas(ca);RG.fireCustomEvent(this,'onadjust');}};this.getAngle=function(value)
39
+ {if(value<this.min||value>this.max){return null;}
40
+ var angle=(((value-this.min)/(this.max-this.min))*(this.angles.end-this.angles.start))+this.angles.start;return angle;};this.parseColors=function()
41
+ {if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.array_clone(prop['chart.colors']);this.original_colors['chart.needle.color']=RG.array_clone(prop['chart.needle.color']);}
42
+ var props=this.properties;var colors=props['chart.colors'];for(var i=0;i<colors.length;++i){colors[i]=this.parseSingleColorForLinearGradient(colors[i]);}
43
+ props['chart.needle.color']=this.parseSingleColorForRadialGradient(props['chart.needle.color']);};this.reset=function()
44
+ {};this.parseSingleColorForLinearGradient=function(color)
45
+ {if(!color||typeof(color)!='string'){return color;}
46
+ if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(prop['chart.gutter.left'],0,ca.width-prop['chart.gutter.right'],0);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1;j<parts.length;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
47
+ return grad?grad:color;};this.parseSingleColorForRadialGradient=function(color)
48
+ {if(!color||typeof color!='string'){return color;}
49
+ if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createRadialGradient(this.centerx,this.centery,0,this.centerx,this.centery,this.radius);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1;j<parts.length;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
50
+ return grad?grad:color;};this.on=function(type,func)
51
+ {if(type.substr(0,2)!=='on'){type='on'+type;}
52
+ if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
53
+ return this;};this.firstDrawFunc=function()
54
+ {};this.grow=function()
55
+ {var callback=arguments[1]||function(){};var opt=arguments[0]||{};var numFrames=opt.frames||30;var frame=0;var obj=this;var origValue=Number(this.currentValue);if(this.currentValue==null){this.currentValue=this.min;origValue=this.min;}
56
+ var newValue=this.value;var diff=newValue-origValue;var step=(diff/numFrames);var frame=0;function iterator()
57
+ {frame++;obj.value=((frame/numFrames)*diff)+origValue
58
+ if(obj.value>obj.max)obj.value=obj.max;if(obj.value<obj.min)obj.value=obj.min;RGraph.clear(obj.canvas);RGraph.redrawCanvas(obj.canvas);if(frame<numFrames){RGraph.Effects.updateCanvas(iterator);}else{callback(obj);}}
59
+ iterator();return this;};RG.att(ca);RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};