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,1121 +1,61 @@
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
-
17
-
18
- /**
19
- * The progress bar constructor
20
- *
21
- * @param mixed conf This can either be an object that contains all of the configuration data
22
- * (the updated way of configuring the object) or it can be a string consisting of the
23
- * canvas ID
24
- * @param number The minimum value (if using the older configuration style)
25
- * @param number The maximum value (if using the older configuration style)
26
- * @param number The represented value (if using the older configuration style)
27
- */
28
- RGraph.SemiCircularProgress = function (conf)
29
- {
30
- /**
31
- * Allow for object config style
32
- */
33
- if ( typeof conf === 'object'
34
- && typeof conf.id === 'string') {
35
-
36
- var parseConfObjectForOptions = true; // Set this so the config is parsed (at the end of the constructor)
37
-
38
- } else {
39
-
40
- var conf = {
41
- id: arguments[0],
42
- min: arguments[1],
43
- max: arguments[2],
44
- value: arguments[3]
45
- }
46
- }
47
-
48
-
49
-
50
-
51
- this.id = conf.id;
52
- this.canvas = document.getElementById(this.id);
53
- this.context = this.canvas.getContext('2d');
54
- this.canvas.__object__ = this;
55
-
56
- this.min = RGraph.stringsToNumbers(conf.min);
57
- this.max = RGraph.stringsToNumbers(conf.max);
58
- this.value = RGraph.stringsToNumbers(conf.value);
59
- this.type = 'semicircularprogress';
60
- this.coords = [];
61
- this.isRGraph = true;
62
- this.currentValue = null;
63
- this.uid = RGraph.createUID();
64
- this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.CreateUID();
65
- this.colorsParsed = false;
66
- this.coordsText = [];
67
- this.original_colors = [];
68
- this.firstDraw = true; // After the first draw this will be false
69
-
70
-
71
- /**
72
- * Compatibility with older browsers
73
- */
74
- //RGraph.OldBrowserCompat(this.context);
75
-
76
- this.properties =
77
- {
78
- 'chart.background.color': 'rgba(0,0,0,0)',
79
- 'chart.colors': ['#0c0'],
80
- 'chart.linewidth': 2,
81
- 'chart.strokestyle': '#666',
82
- 'chart.gutter.left': 25,
83
- 'chart.gutter.right': 25,
84
- 'chart.gutter.top': 25,
85
- 'chart.gutter.bottom': 35,
86
- 'chart.radius': null,
87
- 'chart.centerx': null,
88
- 'chart.centery': null,
89
- 'chart.width': null,
90
- 'chart.angles.start': Math.PI,
91
- 'chart.angles.end': (2 * Math.PI),
92
- 'chart.scale.decimals': 0,
93
- 'chart.scale.point': '.',
94
- 'chart.scale.thousand': ',',
95
- 'chart.scale.formatter': null,
96
- 'chart.scale.round': false,
97
- 'chart.shadow': false,
98
- 'chart.shadow.color': 'rgba(220,220,220,1)',
99
- 'chart.shadow.blur': 2,
100
- 'chart.shadow.offsetx': 2,
101
- 'chart.shadow.offsety': 2,
102
- 'chart.labels.center': true,
103
- 'chart.labels.center.font': null,
104
- 'chart.labels.center.bold': false,
105
- 'chart.labels.center.italic': false,
106
- 'chart.labels.center.fade': false,
107
- 'chart.labels.center.size': 40,
108
- 'chart.labels.center.color':'black',
109
- 'chart.labels.center.valign':'bottom',
110
- 'chart.labels.min.color': null,
111
- 'chart.labels.min.font': null,
112
- 'chart.labels.min.bold': false,
113
- 'chart.labels.min.size': null,
114
- 'chart.labels.min.italic': false,
115
- 'chart.labels.min.offset.angle': 0,
116
- 'chart.labels.min.offsetx': 0,
117
- 'chart.labels.min.offsety': 0,
118
- 'chart.labels.max.color': null,
119
- 'chart.labels.max.font': null,
120
- 'chart.labels.max.bold': false,
121
- 'chart.labels.max.size': null,
122
- 'chart.labels.max.italic': false,
123
- 'chart.labels.max.offset.angle': 0,
124
- 'chart.labels.max.offsetx': 0,
125
- 'chart.labels.max.offsety': 0,
126
- 'chart.title': '',
127
- 'chart.title.bold': true,
128
- 'chart.title.italic': false,
129
- 'chart.title.font': null,
130
- 'chart.title.size': null,
131
- 'chart.title.color': 'black',
132
- 'chart.text.size': 12,
133
- 'chart.text.color': 'black',
134
- 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
135
- 'chart.text.accessible': true,
136
- 'chart.text.accessible.overflow': 'visible',
137
- 'chart.text.accessible.pointerevents': true,
138
- 'chart.contextmenu': null,
139
- 'chart.units.pre': '',
140
- 'chart.units.post': '',
141
- 'chart.tooltips': null,
142
- 'chart.tooltips.effect': 'fade',
143
- 'chart.tooltips.css.class': 'RGraph_tooltip',
144
- 'chart.tooltips.highlight': true,
145
- 'chart.tooltips.event': 'onclick',
146
- 'chart.tooltips.coords.page':true,
147
- 'chart.highlight.stroke': 'rgba(0,0,0,0)',
148
- 'chart.highlight.fill': 'rgba(255,255,255,0.7)',
149
- 'chart.annotatable': false,
150
- 'chart.annotate.color': 'black',
151
- 'chart.zoom.factor': 1.5,
152
- 'chart.zoom.fade.in': true,
153
- 'chart.zoom.fade.out': true,
154
- 'chart.zoom.hdir': 'right',
155
- 'chart.zoom.vdir': 'down',
156
- 'chart.zoom.frames': 25,
157
- 'chart.zoom.delay': 16.666,
158
- 'chart.zoom.shadow': true,
159
- 'chart.zoom.background': true,
160
- 'chart.zoom.action': 'zoom',
161
- 'chart.resizable': false,
162
- 'chart.resize.handle.adjust': [0,0],
163
- 'chart.resize.handle.background': null,
164
- 'chart.adjustable': false,
165
- 'chart.events.click': null,
166
- 'chart.events.mousemove': null,
167
- 'chart.clearto': 'rgba(0,0,0,0)'
168
- }
169
-
170
- // Check for support
171
- if (!this.canvas) {
172
- alert('[SEMICIRCULARPROGRESS] No canvas support');
173
- return;
174
- }
175
-
176
-
177
-
178
-
179
- /**
180
- * Translate half a pixel for antialiasing purposes - but only if it hasn't beeen
181
- * done already
182
- */
183
- if (!this.canvas.__rgraph_aa_translated__) {
184
- this.context.translate(0.5,0.5);
185
-
186
- this.canvas.__rgraph_aa_translated__ = true;
187
- }
188
-
189
-
190
-
191
-
192
- // Short variable names
193
- var RG = RGraph,
194
- ca = this.canvas,
195
- co = ca.getContext('2d'),
196
- prop = this.properties,
197
- pa2 = RG.path2,
198
- win = window,
199
- doc = document,
200
- ma = Math
201
-
202
-
203
-
204
- /**
205
- * "Decorate" the object with the generic effects if the effects library has been included
206
- */
207
- if (RG.Effects && typeof RG.Effects.decorate === 'function') {
208
- RG.Effects.decorate(this);
209
- }
210
-
211
-
212
-
213
-
214
- /**
215
- * A generic setter
216
- *
217
- * @param string name The name of the property to set or it can also be an object containing
218
- * object style configuration
219
- */
220
- this.set =
221
- this.Set = function (name)
222
- {
223
- var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
224
-
225
- /**
226
- * the number of arguments is only one and it's an
227
- * object - parse it for configuration data and return.
228
- */
229
- if (arguments.length === 1 && typeof name === 'object') {
230
- RG.parseObjectStyleConfig(this, name);
231
- return this;
232
- }
233
-
234
-
235
-
236
- /**
237
- * This should be done first - prepend the propertyy name with "chart." if necessary
238
- */
239
- if (name.substr(0,6) != 'chart.') {
240
- name = 'chart.' + name;
241
- }
242
-
243
-
244
-
245
- // Convert uppercase letters to dot+lower case letter
246
- while(name.match(/([A-Z])/)) {
247
- name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
248
- }
249
-
250
-
251
-
252
-
253
- prop[name.toLowerCase()] = value;
254
-
255
- return this;
256
- };
257
-
258
-
259
-
260
-
261
- /**
262
- * A generic getter
263
- *
264
- * @param string name The name of the property to get
265
- */
266
- this.get =
267
- this.Get = function (name)
268
- {
269
- /**
270
- * This should be done first - prepend the property name with "chart." if necessary
271
- */
272
- if (name.substr(0,6) != 'chart.') {
273
- name = 'chart.' + name;
274
- }
275
-
276
- // Convert uppercase letters to dot+lower case letter
277
- while(name.match(/([A-Z])/)) {
278
- name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
279
- }
280
-
281
- return prop[name.toLowerCase()];
282
- };
283
-
284
-
285
-
286
-
287
- /**
288
- * Draws the progress bar
289
- */
290
- this.draw =
291
- this.Draw = function ()
292
- {
293
- /**
294
- * Fire the onbeforedraw event
295
- */
296
- RG.fireCustomEvent(this, 'onbeforedraw');
297
-
298
-
299
-
300
- /**
301
- * Parse the colors. This allows for simple gradient syntax
302
- */
303
- if (!this.colorsParsed) {
304
-
305
- this.parseColors();
306
-
307
-
308
- // Don't want to do this again
309
- this.colorsParsed = true;
310
- }
311
-
312
-
313
- /**
314
- * Set the current value
315
- */
316
- this.currentValue = this.value;
317
-
318
- /**
319
- * This is new in May 2011 and facilitates indiviual gutter settings,
320
- * eg chart.gutter.left
321
- */
322
- this.gutterLeft = prop['chart.gutter.left'];
323
- this.gutterRight = prop['chart.gutter.right'];
324
- this.gutterTop = prop['chart.gutter.top'];
325
- this.gutterBottom = prop['chart.gutter.bottom'];
326
-
327
- // Figure out the width and height
328
- this.radius = ma.min(
329
- (ca.width - prop['chart.gutter.left'] - prop['chart.gutter.right']) / 2,
330
- ca.height - prop['chart.gutter.top'] - prop['chart.gutter.bottom']
331
- );
332
- this.centerx = ((ca.width - this.gutterLeft - this.gutterRight) / 2) + this.gutterLeft;
333
- this.centery = ca.height - this.gutterBottom;
334
- this.width = this.radius / 3;
335
-
336
- // User specified centerx/y/radius
337
- if (typeof prop['chart.radius'] === 'number') this.radius = prop['chart.radius'];
338
- if (typeof prop['chart.centerx'] === 'number') this.centerx = prop['chart.centerx'];
339
- if (typeof prop['chart.centery'] === 'number') this.centery = prop['chart.centery'];
340
- if (typeof prop['chart.width'] === 'number') this.width = prop['chart.width'];
341
-
342
- this.coords = [];
343
-
344
-
345
-
346
- /**
347
- * Stop this growing uncontrollably
348
- */
349
- this.coordsText = [];
350
-
351
-
352
-
353
-
354
-
355
- //
356
- // Draw the meter
357
- //
358
- this.drawMeter();
359
- this.drawLabels();
360
-
361
-
362
-
363
- /**
364
- * Setup the context menu if required
365
- */
366
- if (prop['chart.contextmenu']) {
367
- RG.showContext(this);
368
- }
369
-
370
-
371
- /**
372
- * This installs the event listeners
373
- */
374
- RG.installEventListeners(this);
375
-
376
-
377
-
378
-
379
- /**
380
- * This function enables resizing
381
- */
382
- if (prop['chart.resizable']) {
383
- RG.allowResizing(this);
384
- }
385
-
386
- /**
387
- * Instead of using RGraph.common.adjusting.js, handle them here
388
- */
389
- this.allowAdjusting();
390
-
391
-
392
- /**
393
- * Fire the onfirstdraw event
394
- */
395
- if (this.firstDraw) {
396
- RG.fireCustomEvent(this, 'onfirstdraw');
397
- this.firstDraw = false;
398
- this.firstDrawFunc();
399
- }
400
-
401
-
402
-
403
-
404
- /**
405
- * Fire the RGraph ondraw event
406
- */
407
- RG.fireCustomEvent(this, 'ondraw');
408
-
409
- return this;
410
- };
411
-
412
-
413
-
414
-
415
- /**
416
- * Draw the bar itself
417
- */
418
- this.drawMeter =
419
- this.DrawMeter = function ()
420
- {
421
- //
422
- // The start/end angles
423
- //
424
- var start = prop['chart.angles.start'],
425
- end = prop['chart.angles.end'];
426
-
427
- //
428
- // Calculate a scale (though only two labels are shown)
429
- //
430
-
431
- this.scale2 = RG.getScale2(this, {
432
- 'max': this.max,
433
- 'strict': true,//prop['chart.scale.round'] ? false : true,
434
- 'min': this.min,
435
- 'scale.thousand': prop['chart.scale.thousand'],
436
- 'scale.point': prop['chart.scale.point'],
437
- 'scale.decimals': prop['chart.scale.decimals'],
438
- 'ylabels.count': 5,
439
- 'units.pre': prop['chart.units.pre'],
440
- 'units.post': prop['chart.units.post']
441
- });
442
-
443
- // Draw the backgrundColor
444
- if (prop['chart.background.color'] !== 'rgba(0,0,0,0)') {
445
- pa2(co, 'fs % fr % % % %',
446
- prop['chart.background.color'],
447
- 0,0,ca.width, ca.height
448
- );
449
- }
450
-
451
-
452
- // Draw the main semi-circle background and then lighten it by filling it again
453
- // in semi-transparent white
454
- pa2(
455
- co,
456
- 'lw % b a % % % % % false a % % % % % true c s % f % sx % sy % sc % sb % f % sx 0 sy 0 sb 0 sc rgba(0,0,0,0) lw 1',
457
- prop['chart.linewidth'],
458
- this.centerx, this.centery, this.radius, start, end,
459
- this.centerx, this.centery, this.radius - this.width, end, start,
460
- prop['chart.strokestyle'],
461
- typeof prop['chart.colors'][1] !== 'undefined' ? prop['chart.colors'][1] : prop['chart.colors'][0],
462
- prop['chart.shadow.offsetx'], prop['chart.shadow.offsety'], prop['chart.shadow'] ? prop['chart.shadow.color'] : 'rgba(0,0,0,0)', prop['chart.shadow.blur'],
463
- typeof prop['chart.colors'][1] !== 'undefined' ? 'rgba(0,0,0,0)' : 'rgba(255,255,255,0.85)'
464
- );
465
-
466
- var angle = start + ((end - start) * ((this.value - this.scale2.min) / (this.max - this.scale2.min)));
467
-
468
- // Draw the meter
469
- pa2(
470
- co,
471
- 'b a % % % % % false a % % % % % true c f %',
472
- this.centerx, this.centery, this.radius, start, angle,
473
- this.centerx, this.centery, this.radius - this.width, start + ((end - start) * ((this.value - this.scale2.min) / (this.max - this.scale2.min))), start,
474
- prop['chart.colors'][0]
475
- );
476
-
477
- this.coords = [[
478
- this.centerx,
479
- this.centery,
480
- this.radius,
481
- start,
482
- end,
483
- this.width,
484
- angle
485
- ]];
486
- };
487
-
488
-
489
-
490
-
491
- /**
492
- * The function that draws the labels
493
- */
494
- this.drawLabels =
495
- this.DrawLabels = function ()
496
- {
497
- var min = RG.numberFormat(
498
- this,
499
- this.scale2.min,
500
- prop['chart.units.pre'],
501
- prop['chart.units.post']
502
- )
503
-
504
- var max = RG.numberFormat(
505
- this,
506
- this.scale2.max,
507
- prop['chart.units.pre'],
508
- prop['chart.units.post']
509
- )
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
- // Determine the horizontal and vertical alignment for the text
523
- if (prop['chart.angles.start'] === RGraph.PI) {
524
- var halign = 'center';
525
- var valign = 'top';
526
- } else if (prop['chart.angles.start'] <= RGraph.PI) {
527
- var halign = 'left';
528
- var valign = 'center';
529
- } else if (prop['chart.angles.start'] >= RGraph.PI) {
530
- var halign = 'right';
531
- var valign = 'center';
532
- }
533
-
534
- // Get the X/Y for the min label
535
- // cx, cy, angle, radius
536
- var xy = RG.getRadiusEndPoint(
537
- this.centerx,
538
- this.centery,
539
- prop['chart.angles.start'] + prop['chart.labels.min.offset.angle'],
540
- this.radius - (this.width / 2)
541
- );
542
-
543
- // Draw the min label
544
- RG.text2(this, {
545
- font: prop['chart.labels.min.font'] || prop['chart.text.font'],
546
- bold: prop['chart.labels.min.bold'] || prop['chart.text.bold'],
547
- size: prop['chart.labels.min.size'] || prop['chart.text.size'],
548
- x: xy[0] + prop['chart.labels.min.offsetx'],
549
- y: xy[1] + prop['chart.labels.min.offsety'],
550
- valign: valign,
551
- halign: halign,
552
- text: min,
553
- color: prop['chart.labels.min.color'] || prop['chart.text.color'],
554
- italic: prop['chart.labels.min.italic']
555
- });
556
-
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
- // Determine the horizontal and vertical alignment for the text
567
- if (prop['chart.angles.end'] === RGraph.TWOPI) {
568
- var halign = 'center';
569
- var valign = 'top';
570
- } else if (prop['chart.angles.end'] >= RGraph.TWOPI) {
571
- var halign = 'right';
572
- var valign = 'center';
573
- } else if (prop['chart.angles.end'] <= RGraph.TWOPI) {
574
- var halign = 'left';
575
- var valign = 'center';
576
- }
577
-
578
- // Get the X/Y for the max label
579
- // cx, cy, angle, radius
580
- var xy = RG.getRadiusEndPoint(
581
- this.centerx,
582
- this.centery,
583
- prop['chart.angles.end'] + prop['chart.labels.max.offset.angle'],
584
- this.radius - (this.width / 2)
585
- );
586
-
587
- // Draw the max label
588
- RG.text2(this, {
589
- font: prop['chart.labels.max.font'] || prop['chart.text.font'],
590
- bold: prop['chart.labels.max.bold'] || prop['chart.text.bold'],
591
- size: prop['chart.labels.max.size'] || prop['chart.text.size'],
592
- x: xy[0] + prop['chart.labels.max.offsetx'],
593
- y: xy[1] + prop['chart.labels.max.offsety'],
594
- valign: valign,
595
- halign: halign,
596
- text: max,
597
- color: prop['chart.labels.max.color'] || prop['chart.text.color'],
598
- italic: prop['chart.labels.max.italic']
599
- });
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
- // Draw the big label in the center
615
- if (prop['chart.labels.center']) {
616
- var ret = RG.text2(this, {
617
- font: prop['chart.labels.center.font'] || prop['chart.text.font'],
618
- size: prop['chart.labels.center.size'] || 50,
619
- bold: prop['chart.labels.center.bold'],
620
- italic: prop['chart.labels.center.italic'],
621
- x: this.centerx,
622
- y: this.centery,
623
- valign: prop['chart.labels.center.valign'],
624
- halign: 'center',
625
- text: RG.numberFormat(
626
- this,
627
- this.value.toFixed(prop['chart.scale.decimals']),
628
- prop['chart.units.pre'],
629
- prop['chart.units.post']
630
- ),
631
- color: prop['chart.labels.center.color'] || prop['chart.text.color']
632
- });
633
-
634
- // Allows the center label to fade in
635
- if (prop['chart.labels.center.fade'] && ret.node) {
636
- ret.node.style.opacity = 0;
637
-
638
- var delay = 25,
639
- incr = 0.1;
640
-
641
- for (var i=0; i<10; ++i) {
642
- (function (index)
643
- {
644
- setTimeout(function ()
645
- {
646
- ret.node.style.opacity = incr * index;
647
- }, delay * (index + 1));
648
- })(i);
649
- }
650
- }
651
- }
652
-
653
- // Draw the title
654
- RG.drawTitle(
655
- this,
656
- prop['chart.title'],
657
- this.gutterTop,
658
- null,
659
- prop['chart.title.size']
660
- );
661
- };
662
-
663
-
664
-
665
-
666
- /**
667
- * Returns the focused bar
668
- *
669
- * @param event e The event object
670
- */
671
- this.getShape = function (e)
672
- {
673
- var mouseXY = RG.getMouseXY(e),
674
- mouseX = mouseXY[0],
675
- mouseY = mouseXY[1]
676
-
677
- // Draw the meter here but don't stroke or fill it
678
- // so that it can be tested with isPointInPath()
679
- pa2(
680
- co,
681
- 'b a % % % % % false a % % % % % true',
682
- this.coords[0][0], this.coords[0][1], this.coords[0][2], this.coords[0][3], this.coords[0][6],
683
- this.coords[0][0], this.coords[0][1], this.coords[0][2] - this.coords[0][5], this.coords[0][6], this.coords[0][3]
684
- );
685
-
686
-
687
-
688
- if (co.isPointInPath(mouseX, mouseY)) {
689
-
690
- return {
691
- object: this, 0: this,
692
- x: this.coords[0][0], 1: this.coords[0][0],
693
- y: this.coords[0][1], 2: this.coords[0][1],
694
- radius: this.coords[0][2], 3: this.coords[0][2],
695
- width: this.coords[0][5], 4: this.coords[0][5],
696
- start: this.coords[0][3], 5: this.coords[0][3],
697
- end: this.coords[0][6], 6: this.coords[0][6],
698
- index: 0,
699
- tooltip: !RG.isNull(prop['chart.tooltips']) ? prop['chart.tooltips'][0] : null
700
- };
701
- }
702
- };
703
-
704
-
705
-
706
-
707
- /**
708
- * This function returns the value that the mouse is positioned at, regardless of
709
- * the actual indicated value.
710
- *
711
- * @param object e The event object
712
- */
713
- this.getValue = function (e)
714
- {
715
- var mouseXY = RG.getMouseXY(e),
716
- mouseX = mouseXY[0],
717
- mouseY = mouseXY[1],
718
- angle = RG.getAngleByXY(
719
- this.centerx,
720
- this.centery,
721
- mouseX,
722
- mouseY
723
- );
724
-
725
- if (
726
- angle &&
727
- mouseX >= this.centerx
728
- && mouseY > this.centery
729
- ) {
730
-
731
- angle += RGraph.TWOPI;
732
- }
733
-
734
- if (angle < prop['chart.angles.start'] && mouseX > this.centerx) { angle = prop['chart.angles.end']; }
735
- if (angle < prop['chart.angles.start']) { angle = prop['chart.angles.start']; }
736
-
737
- var value = (((angle - prop['chart.angles.start']) / (prop['chart.angles.end'] - prop['chart.angles.start'])) * (this.max - this.min)) + this.min;
738
-
739
- value = ma.max(value, this.min);
740
- value = ma.min(value, this.max);
741
-
742
- return value;
743
- };
744
-
745
-
746
-
747
-
748
- /**
749
- * Each object type has its own Highlight() function which highlights the appropriate shape
750
- *
751
- * @param object shape The shape to highlight
752
- */
753
- this.highlight =
754
- this.Highlight = function (shape)
755
- {
756
- if (typeof prop['chart.highlight.style'] === 'function') {
757
- (prop['chart.highlight.style'])(shape);
758
- } else {
759
- pa2(co, 'lw 5 b a % % % % % false a % % % % % true c s % f % lw 1',
760
- shape.x, shape.y, shape.radius, shape.start, shape.end,
761
- shape.x, shape.y, shape.radius - shape.width, shape.end, shape.start,
762
- prop['chart.highlight.stroke'],
763
- prop['chart.highlight.fill']
764
- );
765
- }
766
- };
767
-
768
-
769
-
770
-
771
- /**
772
- * The getObjectByXY() worker method. Don't call this call:
773
- *
774
- * RGraph.ObjectRegistry.getObjectByXY(e)
775
- *
776
- * @param object e The event object
777
- */
778
- this.getObjectByXY = function (e)
779
- {
780
- var mouseXY = RG.getMouseXY(e);
781
-
782
- // Draw a Path so that the coords can be tested
783
- // (but don't stroke/fill it
784
- pa2(co,
785
- 'b a % % % % % false',
786
- this.centerx,
787
- this.centery,
788
- this.radius,
789
- prop['chart.angles.start'],
790
- prop['chart.angles.end']
791
- );
792
-
793
- pa2(co,
794
- 'a % % % % % true',
795
- this.centerx,
796
- this.centery,
797
- this.radius - this.width,
798
- prop['chart.angles.end'],
799
- prop['chart.angles.start']
800
- );
801
-
802
- return co.isPointInPath(mouseXY[0], mouseXY[1]) ? this : null;
803
- };
804
-
805
-
806
-
807
-
808
- /**
809
- * This function allows the VProgress to be adjustable.
810
- * UPDATE: Not any more
811
- */
812
- this.allowAdjusting =
813
- this.AllowAdjusting = function () {};
814
-
815
-
816
-
817
-
818
- /**
819
- * This method handles the adjusting calculation for when the mouse is moved
820
- *
821
- * @param object e The event object
822
- */
823
- this.adjusting_mousemove =
824
- this.Adjusting_mousemove = function (e)
825
- {
826
- /**
827
- * Handle adjusting for the HProgress
828
- */
829
- if (prop['chart.adjustable'] && RG.Registry.Get('chart.adjusting') && RG.Registry.Get('chart.adjusting').uid == this.uid) {
830
-
831
- var value = this.getValue(e);
832
-
833
- if (typeof value === 'number') {
834
-
835
- // Fire the onadjust event
836
- RG.fireCustomEvent(this, 'onadjust');
837
-
838
- this.value = Number(value.toFixed(prop['chart.scale.decimals']));
839
- RG.redrawCanvas(this.canvas);
840
- }
841
- }
842
- };
843
-
844
-
845
-
846
-
847
- /**
848
- * This function positions a tooltip when it is displayed
849
- *
850
- * @param obj object The chart object
851
- * @param int x The X coordinate specified for the tooltip
852
- * @param int y The Y coordinate specified for the tooltip
853
- * @param objec tooltip The tooltips DIV element
854
- *
855
- this.positionTooltip = function (obj, x, y, tooltip, idx)
856
- {
857
- var coordX = obj.coords[tooltip.__index__][0],
858
- coordY = obj.coords[tooltip.__index__][1],
859
- coordW = obj.coords[tooltip.__index__][2],
860
- coordH = obj.coords[tooltip.__index__][3],
861
- canvasXY = RG.getCanvasXY(obj.canvas),
862
- mouseXY = RG.getMouseXY(window.event),
863
- gutterLeft = obj.gutterLeft,
864
- gutterTop = obj.gutterTop,
865
- width = tooltip.offsetWidth,
866
- height = tooltip.offsetHeight
867
- /*
868
- // Set the top position
869
- tooltip.style.left = 0;
870
- tooltip.style.top = window.event.pageY - height - 5 + 'px';
871
-
872
- // By default any overflow is hidden
873
- tooltip.style.overflow = '';
874
-
875
- // Reposition the tooltip if at the edges:
876
-
877
- // LEFT edge
878
- if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
879
- tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
880
-
881
- // RIGHT edge
882
- } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
883
- tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
884
-
885
- // Default positioning - CENTERED
886
- } else {
887
- tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
888
- }
889
- };*/
890
-
891
-
892
-
893
-
894
- /**
895
- * This function returns the appropriate angle (in radians) for the given
896
- * Y value
897
- *
898
- * @param int value The Y value you want the angle for
899
- * @returm int The angle
900
- */
901
- this.getAngle = function (value)
902
- {
903
- if (value > this.max || value < this.min) {
904
- return null;
905
- }
906
-
907
- var angle = (value / this.max) * (prop['chart.angles.end'] - prop['chart.angles.start'])
908
- angle += prop['chart.angles.start'];
909
-
910
- return angle;
911
- };
912
-
913
-
914
-
915
-
916
- /**
917
- * This returns true/false as to whether the cursor is over the chart area.
918
- * The cursor does not necessarily have to be over the bar itself.
919
- */
920
- this.overChartArea = function (e)
921
- {
922
- var mouseXY = RGraph.getMouseXY(e),
923
- mouseX = mouseXY[0],
924
- mouseY = mouseXY[1]
925
-
926
- // Draw the background to the Progress but don't stroke or fill it
927
- // so that it can be tested with isPointInPath()
928
- pa2(
929
- co,
930
- 'b a % % % % % false a % % % % % true',
931
- this.coords[0][0], this.coords[0][1], this.coords[0][2], prop['chart.angles.start'], prop['chart.angles.end'],
932
- this.coords[0][0], this.coords[0][1], this.coords[0][2] - this.coords[0][5], prop['chart.angles.end'], prop['chart.angles.start']
933
- );
934
-
935
- return co.isPointInPath(mouseX, mouseY);
936
- };
937
-
938
-
939
-
940
-
941
- /**
942
- *
943
- */
944
- this.parseColors = function ()
945
- {
946
- // Save the original colors so that they can be restored when the canvas is reset
947
- if (this.original_colors.length === 0) {
948
- this.original_colors['chart.colors'] = RG.arrayClone(prop['chart.colors']);
949
- }
950
-
951
- prop['chart.colors'][0] = this.parseSingleColorForGradient(prop['chart.colors'][0]);
952
- prop['chart.colors'][1] = this.parseSingleColorForGradient(prop['chart.colors'][1]);
953
-
954
- prop['chart.strokestyle'] = this.parseSingleColorForGradient(prop['chart.strokestyle']);
955
- prop['chart.background.color'] = this.parseSingleColorForGradient(prop['chart.background.color']);
956
- };
957
-
958
-
959
-
960
-
961
- /**
962
- * Use this function to reset the object to the post-constructor state. Eg reset colors if
963
- * need be etc
964
- */
965
- this.reset = function ()
966
- {
967
- };
968
-
969
-
970
-
971
-
972
- /**
973
- * This parses a single color value
974
- */
975
- this.parseSingleColorForGradient = function (color)
976
- {
977
- if (!color || typeof color != 'string') {
978
- return color;
979
- }
980
-
981
- if (color.match(/^gradient\((.*)\)$/i)) {
982
- var parts = RegExp.$1.split(':');
983
-
984
- // Create the gradient
985
- var grad = co.createLinearGradient(prop['chart.gutter.left'],0,ca.width - prop['chart.gutter.right'],0);
986
-
987
- var diff = 1 / (parts.length - 1);
988
-
989
- grad.addColorStop(0, RG.trim(parts[0]));
990
-
991
- for (var j=1,len=parts.length; j<len; ++j) {
992
- grad.addColorStop(j * diff, RG.trim(parts[j]));
993
- }
994
-
995
- return grad ? grad : color;
996
- }
997
-
998
- return grad ? grad : color;
999
- };
1000
-
1001
-
1002
-
1003
-
1004
- /**
1005
- * Using a function to add events makes it easier to facilitate method chaining
1006
- *
1007
- * @param string type The type of even to add
1008
- * @param function func
1009
- */
1010
- this.on = function (type, func)
1011
- {
1012
- if (type.substr(0,2) !== 'on') {
1013
- type = 'on' + type;
1014
- }
1015
-
1016
- if (typeof this[type] !== 'function') {
1017
- this[type] = func;
1018
- } else {
1019
- RG.addCustomEventListener(this, type, func);
1020
- }
1021
-
1022
- return this;
1023
- };
1024
-
1025
-
1026
-
1027
-
1028
- /**
1029
- * Used in chaining. Runs a function there and then - not waiting for
1030
- * the events to fire (eg the onbeforedraw event)
1031
- *
1032
- * @param function func The function to execute
1033
- */
1034
- this.exec = function (func)
1035
- {
1036
- func(this);
1037
-
1038
- return this;
1039
- };
1040
-
1041
-
1042
-
1043
-
1044
- /**
1045
- * This function runs once only
1046
- * (put at the end of the file (before any effects))
1047
- */
1048
- this.firstDrawFunc = function ()
1049
- {
1050
- };
1051
-
1052
-
1053
-
1054
-
1055
- /**
1056
- * HProgress Grow effect (which is also the VPogress Grow effect)
1057
- *
1058
- * @param object obj The chart object
1059
- */
1060
- this.grow = function ()
1061
- {
1062
- var obj = this,
1063
- initial_value = this.currentValue,
1064
- opt = arguments[0] || {},
1065
- numFrames = opt.frames || 30,
1066
- frame = 0,
1067
- callback = arguments[1] || function () {},
1068
- diff = this.value - Number(this.currentValue),
1069
- increment = diff / numFrames
1070
-
1071
- //if (prop['chart.labels.center']) {
1072
- // var labelsCenter = true;
1073
- // this.set('labelsCenter', false);
1074
- //}
1075
-
1076
-
1077
-
1078
- function iterator ()
1079
- {
1080
- frame++;
1081
-
1082
- if (frame <= numFrames) {
1083
-
1084
- obj.value = initial_value + (increment * frame);
1085
-
1086
- RG.clear(ca);
1087
- RG.redrawCanvas(ca);
1088
-
1089
- RG.Effects.updateCanvas(iterator);
1090
- } else {
1091
- //if (labelsCenter) {
1092
- // obj.set('labelsCenter', true);
1093
- // RG.redrawCanvas(ca);
1094
- //}
1095
- callback();
1096
- }
1097
- }
1098
-
1099
- iterator();
1100
-
1101
- return this;
1102
- };
1103
-
1104
-
1105
-
1106
- /**
1107
- * The chart is now always registered
1108
- */
1109
- RG.Register(this);
1110
-
1111
-
1112
-
1113
-
1114
- /**
1115
- * This is the 'end' of the constructor so if the first argument
1116
- * contains configuration data - handle that.
1117
- */
1118
- if (parseConfObjectForOptions) {
1119
- RG.parseObjectStyleConfig(this, conf.options);
1120
- }
1121
- };
2
+ RGraph=window.RGraph||{isRGraph:true};RGraph.SemiCircularProgress=function(conf)
3
+ {if(typeof conf==='object'&&typeof conf.id==='string'){var parseConfObjectForOptions=true;}else{var conf={id:arguments[0],min:arguments[1],max:arguments[2],value:arguments[3]}}
4
+ this.id=conf.id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.min=RGraph.stringsToNumbers(conf.min);this.max=RGraph.stringsToNumbers(conf.max);this.value=RGraph.stringsToNumbers(conf.value);this.type='semicircularprogress';this.coords=[];this.isRGraph=true;this.currentValue=null;this.uid=RGraph.createUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.properties={'chart.background.color':'rgba(0,0,0,0)','chart.colors':['#0c0'],'chart.linewidth':2,'chart.strokestyle':'#666','chart.gutter.left':25,'chart.gutter.right':25,'chart.gutter.top':25,'chart.gutter.bottom':35,'chart.radius':null,'chart.centerx':null,'chart.centery':null,'chart.width':null,'chart.angles.start':Math.PI,'chart.angles.end':(2*Math.PI),'chart.scale.decimals':0,'chart.scale.point':'.','chart.scale.thousand':',','chart.scale.formatter':null,'chart.scale.round':false,'chart.shadow':false,'chart.shadow.color':'rgba(220,220,220,1)','chart.shadow.blur':2,'chart.shadow.offsetx':2,'chart.shadow.offsety':2,'chart.labels.center':true,'chart.labels.center.font':null,'chart.labels.center.bold':false,'chart.labels.center.italic':false,'chart.labels.center.fade':false,'chart.labels.center.size':40,'chart.labels.center.color':'black','chart.labels.center.valign':'bottom','chart.labels.min.color':null,'chart.labels.min.font':null,'chart.labels.min.bold':false,'chart.labels.min.size':null,'chart.labels.min.italic':false,'chart.labels.min.offset.angle':0,'chart.labels.min.offsetx':0,'chart.labels.min.offsety':0,'chart.labels.max.color':null,'chart.labels.max.font':null,'chart.labels.max.bold':false,'chart.labels.max.size':null,'chart.labels.max.italic':false,'chart.labels.max.offset.angle':0,'chart.labels.max.offsetx':0,'chart.labels.max.offsety':0,'chart.title':'','chart.title.bold':true,'chart.title.italic':false,'chart.title.font':null,'chart.title.size':null,'chart.title.color':'black','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.units.pre':'','chart.units.post':'','chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.highlight':true,'chart.tooltips.event':'onclick','chart.tooltips.coords.page':true,'chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.annotatable':false,'chart.annotate.color':'black','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.resizable':false,'chart.resize.handle.adjust':[0,0],'chart.resize.handle.background':null,'chart.adjustable':false,'chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
5
+ if(!this.canvas){alert('[SEMICIRCULARPROGRESS] No canvas support');return;}
6
+ 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.toLowerCase()]=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');if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
18
+ 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.radius=ma.min((ca.width-prop['chart.gutter.left']-prop['chart.gutter.right'])/2,ca.height-prop['chart.gutter.top']-prop['chart.gutter.bottom']);this.centerx=((ca.width-this.gutterLeft-this.gutterRight)/2)+this.gutterLeft;this.centery=ca.height-this.gutterBottom;this.width=this.radius/3;if(typeof prop['chart.radius']==='number')this.radius=prop['chart.radius'];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.width']==='number')this.width=prop['chart.width'];this.coords=[];this.coordsText=[];this.drawMeter();this.drawLabels();if(prop['chart.contextmenu']){RG.showContext(this);}
19
+ RG.installEventListeners(this);if(prop['chart.resizable']){RG.allowResizing(this);}
20
+ this.allowAdjusting();if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
21
+ RG.fireCustomEvent(this,'ondraw');return this;};this.drawMeter=this.DrawMeter=function()
22
+ {var start=prop['chart.angles.start'],end=prop['chart.angles.end'];this.scale2=RG.getScale2(this,{'max':this.max,'strict':true,'min':this.min,'scale.thousand':prop['chart.scale.thousand'],'scale.point':prop['chart.scale.point'],'scale.decimals':prop['chart.scale.decimals'],'ylabels.count':5,'units.pre':prop['chart.units.pre'],'units.post':prop['chart.units.post']});if(prop['chart.background.color']!=='rgba(0,0,0,0)'){pa2(co,'fs % fr % % % %',prop['chart.background.color'],0,0,ca.width,ca.height);}
23
+ pa2(co,'lw % b a % % % % % false a % % % % % true c s % f % sx % sy % sc % sb % f % sx 0 sy 0 sb 0 sc rgba(0,0,0,0) lw 1',prop['chart.linewidth'],this.centerx,this.centery,this.radius,start,end,this.centerx,this.centery,this.radius-this.width,end,start,prop['chart.strokestyle'],typeof prop['chart.colors'][1]!=='undefined'?prop['chart.colors'][1]:prop['chart.colors'][0],prop['chart.shadow.offsetx'],prop['chart.shadow.offsety'],prop['chart.shadow']?prop['chart.shadow.color']:'rgba(0,0,0,0)',prop['chart.shadow.blur'],typeof prop['chart.colors'][1]!=='undefined'?'rgba(0,0,0,0)':'rgba(255,255,255,0.85)');var angle=start+((end-start)*((this.value-this.scale2.min)/(this.max-this.scale2.min)));pa2(co,'b a % % % % % false a % % % % % true c f %',this.centerx,this.centery,this.radius,start,angle,this.centerx,this.centery,this.radius-this.width,start+((end-start)*((this.value-this.scale2.min)/(this.max-this.scale2.min))),start,prop['chart.colors'][0]);this.coords=[[this.centerx,this.centery,this.radius,start,end,this.width,angle]];};this.drawLabels=this.DrawLabels=function()
24
+ {var min=RG.numberFormat(this,this.scale2.min,prop['chart.units.pre'],prop['chart.units.post'])
25
+ var max=RG.numberFormat(this,this.scale2.max,prop['chart.units.pre'],prop['chart.units.post'])
26
+ if(prop['chart.angles.start']===RGraph.PI){var halign='center';var valign='top';}else if(prop['chart.angles.start']<=RGraph.PI){var halign='left';var valign='center';}else if(prop['chart.angles.start']>=RGraph.PI){var halign='right';var valign='center';}
27
+ var xy=RG.getRadiusEndPoint(this.centerx,this.centery,prop['chart.angles.start']+prop['chart.labels.min.offset.angle'],this.radius-(this.width/2));RG.text2(this,{font:prop['chart.labels.min.font']||prop['chart.text.font'],bold:prop['chart.labels.min.bold']||prop['chart.text.bold'],size:prop['chart.labels.min.size']||prop['chart.text.size'],x:xy[0]+prop['chart.labels.min.offsetx'],y:xy[1]+prop['chart.labels.min.offsety'],valign:valign,halign:halign,text:min,color:prop['chart.labels.min.color']||prop['chart.text.color'],italic:prop['chart.labels.min.italic']});if(prop['chart.angles.end']===RGraph.TWOPI){var halign='center';var valign='top';}else if(prop['chart.angles.end']>=RGraph.TWOPI){var halign='right';var valign='center';}else if(prop['chart.angles.end']<=RGraph.TWOPI){var halign='left';var valign='center';}
28
+ var xy=RG.getRadiusEndPoint(this.centerx,this.centery,prop['chart.angles.end']+prop['chart.labels.max.offset.angle'],this.radius-(this.width/2));RG.text2(this,{font:prop['chart.labels.max.font']||prop['chart.text.font'],bold:prop['chart.labels.max.bold']||prop['chart.text.bold'],size:prop['chart.labels.max.size']||prop['chart.text.size'],x:xy[0]+prop['chart.labels.max.offsetx'],y:xy[1]+prop['chart.labels.max.offsety'],valign:valign,halign:halign,text:max,color:prop['chart.labels.max.color']||prop['chart.text.color'],italic:prop['chart.labels.max.italic']});if(prop['chart.labels.center']){var ret=RG.text2(this,{font:prop['chart.labels.center.font']||prop['chart.text.font'],size:prop['chart.labels.center.size']||50,bold:prop['chart.labels.center.bold'],italic:prop['chart.labels.center.italic'],x:this.centerx,y:this.centery,valign:prop['chart.labels.center.valign'],halign:'center',text:RG.numberFormat(this,this.value.toFixed(prop['chart.scale.decimals']),prop['chart.units.pre'],prop['chart.units.post']),color:prop['chart.labels.center.color']||prop['chart.text.color']});if(prop['chart.labels.center.fade']&&ret.node){ret.node.style.opacity=0;var delay=25,incr=0.1;for(var i=0;i<10;++i){(function(index)
29
+ {setTimeout(function()
30
+ {ret.node.style.opacity=incr*index;},delay*(index+1));})(i);}}}
31
+ RG.drawTitle(this,prop['chart.title'],this.gutterTop,null,prop['chart.title.size']);};this.getShape=function(e)
32
+ {var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1]
33
+ pa2(co,'b a % % % % % false a % % % % % true',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],this.coords[0][6],this.coords[0][0],this.coords[0][1],this.coords[0][2]-this.coords[0][5],this.coords[0][6],this.coords[0][3]);if(co.isPointInPath(mouseX,mouseY)){return{object:this,0:this,x:this.coords[0][0],1:this.coords[0][0],y:this.coords[0][1],2:this.coords[0][1],radius:this.coords[0][2],3:this.coords[0][2],width:this.coords[0][5],4:this.coords[0][5],start:this.coords[0][3],5:this.coords[0][3],end:this.coords[0][6],6:this.coords[0][6],index:0,tooltip:!RG.isNull(prop['chart.tooltips'])?prop['chart.tooltips'][0]:null};}};this.getValue=function(e)
34
+ {var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1],angle=RG.getAngleByXY(this.centerx,this.centery,mouseX,mouseY);if(angle&&mouseX>=this.centerx&&mouseY>this.centery){angle+=RGraph.TWOPI;}
35
+ if(angle<prop['chart.angles.start']&&mouseX>this.centerx){angle=prop['chart.angles.end'];}
36
+ if(angle<prop['chart.angles.start']){angle=prop['chart.angles.start'];}
37
+ var value=(((angle-prop['chart.angles.start'])/(prop['chart.angles.end']-prop['chart.angles.start']))*(this.max-this.min))+this.min;value=ma.max(value,this.min);value=ma.min(value,this.max);return value;};this.highlight=this.Highlight=function(shape)
38
+ {if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{pa2(co,'lw 5 b a % % % % % false a % % % % % true c s % f % lw 1',shape.x,shape.y,shape.radius,shape.start,shape.end,shape.x,shape.y,shape.radius-shape.width,shape.end,shape.start,prop['chart.highlight.stroke'],prop['chart.highlight.fill']);}};this.getObjectByXY=function(e)
39
+ {var mouseXY=RG.getMouseXY(e);pa2(co,'b a % % % % % false',this.centerx,this.centery,this.radius,prop['chart.angles.start'],prop['chart.angles.end']);pa2(co,'a % % % % % true',this.centerx,this.centery,this.radius-this.width,prop['chart.angles.end'],prop['chart.angles.start']);return co.isPointInPath(mouseXY[0],mouseXY[1])?this:null;};this.allowAdjusting=this.AllowAdjusting=function(){};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
40
+ {if(prop['chart.adjustable']&&RG.Registry.Get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){var value=this.getValue(e);if(typeof value==='number'){RG.fireCustomEvent(this,'onadjust');this.value=Number(value.toFixed(prop['chart.scale.decimals']));RG.redrawCanvas(this.canvas);}}};this.getAngle=function(value)
41
+ {if(value>this.max||value<this.min){return null;}
42
+ var angle=(value/this.max)*(prop['chart.angles.end']-prop['chart.angles.start'])
43
+ angle+=prop['chart.angles.start'];return angle;};this.overChartArea=function(e)
44
+ {var mouseXY=RGraph.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1]
45
+ pa2(co,'b a % % % % % false a % % % % % true',this.coords[0][0],this.coords[0][1],this.coords[0][2],prop['chart.angles.start'],prop['chart.angles.end'],this.coords[0][0],this.coords[0][1],this.coords[0][2]-this.coords[0][5],prop['chart.angles.end'],prop['chart.angles.start']);return co.isPointInPath(mouseX,mouseY);};this.parseColors=function()
46
+ {if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);}
47
+ prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);prop['chart.colors'][1]=this.parseSingleColorForGradient(prop['chart.colors'][1]);prop['chart.strokestyle']=this.parseSingleColorForGradient(prop['chart.strokestyle']);prop['chart.background.color']=this.parseSingleColorForGradient(prop['chart.background.color']);};this.reset=function()
48
+ {};this.parseSingleColorForGradient=function(color)
49
+ {if(!color||typeof color!='string'){return color;}
50
+ 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,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}
51
+ return grad?grad:color;}
52
+ return grad?grad:color;};this.on=function(type,func)
53
+ {if(type.substr(0,2)!=='on'){type='on'+type;}
54
+ if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
55
+ return this;};this.exec=function(func)
56
+ {func(this);return this;};this.firstDrawFunc=function()
57
+ {};this.grow=function()
58
+ {var obj=this,initial_value=this.currentValue,opt=arguments[0]||{},numFrames=opt.frames||30,frame=0,callback=arguments[1]||function(){},diff=this.value-Number(this.currentValue),increment=diff/numFrames
59
+ function iterator()
60
+ {frame++;if(frame<=numFrames){obj.value=initial_value+(increment*frame);RG.clear(ca);RG.redrawCanvas(ca);RG.Effects.updateCanvas(iterator);}else{callback();}}
61
+ iterator();return this;};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};