rgraph-rails 4.62 → 4.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,1396 +1,89 @@
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
- /**
14
- * Initialise the various objects
15
- */
16
- RGraph = window.RGraph || {isRGraph: true};
17
-
18
- // Module pattern
19
- (function (win, doc, undefined)
20
- {
21
- var RG = RGraph,
22
- ua = navigator.userAgent,
23
- ma = Math;
24
-
25
-
26
-
27
-
28
- /**
29
- * This is the window click event listener. It redraws all canvas tags on the page.
30
- */
31
- RG.installWindowMousedownListener =
32
- RG.InstallWindowMousedownListener = function (obj)
33
- {
34
- if (!RG.window_mousedown_event_listener) {
35
-
36
- RG.window_mousedown_event_listener = function (e)
37
- {
38
- /**
39
- * For firefox add the window.event object
40
- */
41
- if (navigator.userAgent.indexOf('Firefox') >= 0) win.event = e;
42
-
43
- e = RG.fixEventObject(e);
44
-
45
-
46
- if (RG.HideTooltip && RG.Registry.Get('chart.tooltip')) {
47
- RG.clear(RG.Registry.Get('chart.tooltip').__canvas__);
48
- RG.redraw();
49
- RG.hideTooltip();
50
- }
51
- };
52
- win.addEventListener('mousedown', RG.window_mousedown_event_listener, false);
53
- }
54
- };
55
-
56
-
57
-
58
-
59
- /**
60
- * This is the window click event listener. It redraws all canvas tags on the page.
61
- */
62
- RG.installWindowMouseupListener =
63
- RG.InstallWindowMouseupListener = function (obj)
64
- {
65
- if (!RG.window_mouseup_event_listener) {
66
- RG.window_mouseup_event_listener = function (e)
67
- {
68
- /**
69
- * For firefox add the window.event object
70
- */
71
- if (navigator.userAgent.indexOf('Firefox') >= 0) win.event = e;
72
-
73
- e = RG.fixEventObject(e);
74
-
75
-
76
- /**
77
- * Stop any annotating that may be going on
78
- */
79
- if (RG.annotating_window_onmouseup) {
80
- RG.annotating_window_onmouseup(e);
81
- return;
82
- }
83
-
84
- /**
85
- * End adjusting
86
- */
87
- if (RG.Registry.Get('chart.adjusting') || RG.Registry.Get('chart.adjusting.gantt')) {
88
-
89
- var obj = RG.Registry.Get('chart.adjusting');
90
-
91
- // If it's a line chart update the data_arr variable
92
- if (obj && obj.type === 'line') {
93
- obj.data_arr = RG.arrayLinearize(obj.data);
94
- }
95
-
96
- RG.fireCustomEvent(RG.Registry.Get('chart.adjusting'), 'onadjustend');
97
- }
98
-
99
- RG.Registry.set('chart.adjusting', null);
100
- RG.Registry.set('chart.adjusting.shape', null);
101
- RG.Registry.set('chart.adjusting.gantt', null);
102
-
103
-
104
- // ==============================================
105
- // Finally, redraw the chart
106
- // ==============================================
107
-
108
- var tags = document.getElementsByTagName('canvas');
109
- for (var i=0; i<tags.length; ++i) {
110
- if (tags[i].__object__ && tags[i].__object__.isRGraph) {
111
- if (!tags[i].__object__.get('chart.annotatable')) {
112
- if (!tags[i].__rgraph_trace_cover__ && !noredraw) {
113
- RG.clear(tags[i]);
114
- } else {
115
- var noredraw = true;
116
- }
117
- }
118
- }
119
- }
120
-
121
- if (!noredraw) {
122
- RG.redraw();
123
- }
124
- };
125
- win.addEventListener('mouseup', RG.window_mouseup_event_listener, false);
126
- }
127
- };
128
-
129
-
130
-
131
-
132
- /**
133
- * This is the canvas mouseup event listener. It installs the mouseup event for the
134
- * canvas. The mouseup event then checks the relevant object.
135
- *
136
- * @param object obj The chart object
137
- *
138
- * RGraph.window_mouseup_event_listener
139
- */
140
- RG.installCanvasMouseupListener =
141
- RG.InstallCanvasMouseupListener = function (obj)
142
- {
143
- if (!obj.canvas.rgraph_mouseup_event_listener) {
144
- obj.canvas.rgraph_mouseup_event_listener = function (e)
145
- {
146
- /**
147
- * For firefox add the window.event object
148
- */
149
- if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
150
-
151
- e = RG.fixEventObject(e);
152
-
153
-
154
- // *************************************************************************
155
- // Tooltips
156
- // *************************************************************************
157
-
158
-
159
- // This causes things at the edge of the chart area - eg line chart hotspots - not to fire because the
160
- // cursor is out of the chart area
161
- var objects = RG.ObjectRegistry.getObjectsByXY(e);
162
- //var objects = RG.ObjectRegistry.getObjectsByCanvasID(e.target.id);
163
-
164
- if (objects) {
165
- for (var i=0,len=objects.length; i<len; i+=1) {
166
-
167
- var obj = objects[i],
168
- id = objects[i].id;
169
-
170
-
171
- // =========================================================================
172
- // The drawing API text object supports chart.link
173
- // ========================================================================
174
- var link = obj.Get('link');
175
-
176
- if (obj.type == 'drawing.text' && typeof link === 'string') {
177
-
178
- var link_target = obj.get('link.target');
179
- var link_options = obj.get('link.options');
180
-
181
- window.open(link, link_target ? link_target : null, link_options);
182
- }
183
-
184
-
185
- // ========================================================================
186
- // Tooltips
187
- // ========================================================================
188
-
189
-
190
- if (!RG.isNull(obj) && RG.tooltip) {
191
-
192
- var shape = obj.getShape(e);
193
-
194
- if (shape && shape['tooltip']) {
195
-
196
- var text = shape['tooltip'];
197
-
198
- if (text) {
199
-
200
- var type = shape['object'].type;
201
-
202
- RG.clear(obj.canvas);
203
- RG.redraw();
204
- RG.Registry.set('chart.tooltip.shape', shape);
205
-
206
- // Note that tooltips are positioned at the pointer
207
- // now; and thats done within the .tooltip() function
208
- RG.tooltip(obj, text, 0, 0, shape['index'], e);
209
-
210
- obj.highlight(shape);
211
-
212
- // Add the shape that triggered the tooltip
213
- if (RG.Registry.get('chart.tooltip')) {
214
-
215
- RG.Registry.get('chart.tooltip').__shape__ = shape;
216
-
217
- RG.evaluateCursor(e);
218
- }
219
-
220
- e.cancelBubble = true;
221
- e.stopPropagation();
222
- return false;
223
- }
224
- }
225
- }
226
-
227
-
228
-
229
-
230
-
231
- // =========================================================================
232
- // Adjusting
233
- // ========================================================================
234
-
235
-
236
-
237
- if (RG.Registry.get('chart.adjusting') || RG.Registry.get('chart.adjusting.gantt')) {
238
-
239
- //var obj = RG.Registry.get('chart.adjusting');
240
-
241
- // If it's a line chart update the data_arr variable
242
- if (obj && obj.type === 'line') {
243
- obj.data_arr = RG.arrayLinearize(obj.data);
244
- }
245
-
246
- RG.fireCustomEvent(RG.Registry.get('chart.adjusting'), 'onadjustend');
247
- }
248
-
249
- RG.Registry.set('chart.adjusting', null);
250
- RG.Registry.set('chart.adjusting.shape', null);
251
- RG.Registry.set('chart.adjusting.gantt', null);
252
-
253
- /**
254
- * If the mouse pointer is over a "front" chart this prevents charts behind it
255
- * from firing their events.
256
- */
257
- if (shape || (obj.overChartArea && obj.overChartArea(e)) ) {
258
- break;
259
- }
260
- }
261
- }
262
- };
263
- obj.canvas.addEventListener('mouseup', obj.canvas.rgraph_mouseup_event_listener, false);
264
- }
265
- };
266
-
267
-
268
-
269
-
270
- /**
271
- * This is the canvas mousemove event listener.
272
- *
273
- * @param object obj The chart object
274
- */
275
- RG.installCanvasMousemoveListener =
276
- RG.InstallCanvasMousemoveListener = function (obj)
277
- {
278
- if (!obj.canvas.rgraph_mousemove_event_listener) {
279
- obj.canvas.rgraph_mousemove_event_listener = function (e)
280
- {
281
-
282
- /**
283
- * For firefox add the window.event object
284
- */
285
- if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
286
- e = RG.fixEventObject(e);
287
-
288
-
289
-
290
-
291
- /**
292
- * Go through all the objects and check them to see if anything needs doing
293
- */
294
- var objects = RG.OR.getObjectsByXY(e);
295
-
296
- // Necessary to track which objects have had the mouseover
297
- // triggered on them
298
- var uids = [];
299
-
300
- if (objects && objects.length > 0) {
301
-
302
- for (var i=0,len=objects.length; i<len; i+=1) {
303
-
304
- var obj = objects[i];
305
- var id = obj.id;
306
-
307
-
308
- // Record the uid
309
- uids[obj.uid] = true;
310
-
311
-
312
- if (!obj.getShape) {
313
- continue;
314
- }
315
-
316
-
317
- var shape = obj.getShape(e);
318
-
319
- // Fire the onmouseout event if necessary
320
- if (
321
- (!shape && typeof obj.__mouseover_shape_index__ === 'number') ||
322
- (shape && typeof obj.__mouseover_shape_index__ === 'number' && shape.index !== obj.__mouseover_shape_index__)
323
- ) {
324
-
325
- RG.fireCustomEvent(obj, 'onmouseout');
326
- }
327
-
328
-
329
-
330
-
331
-
332
-
333
-
334
- //
335
- // If the mouse is over a key element add the details
336
- // of it to the Registry
337
- //
338
- if (obj.coords && obj.coords.key && obj.coords.key.length) {
339
-
340
- var mouseXY = RG.getMouseXY(e);
341
-
342
- for (var i=0,overkey=false; i<obj.coords.key.length; ++i) {
343
-
344
- if (
345
- mouseXY[0] >= obj.coords.key[i][0]
346
- && mouseXY[0] <= (obj.coords.key[i][0] + obj.coords.key[i][2])
347
- && mouseXY[1] >= obj.coords.key[i][1]
348
- && mouseXY[1] <= (obj.coords.key[i][1] + obj.coords.key[i][3])
349
- ) {
350
-
351
- RG.Registry.set('key-element', obj.coords.key[i]);
352
- overkey = true;
353
- }
354
-
355
- if (!overkey) {
356
- RG.Registry.set('key-element', null);
357
- }
358
- }
359
- }
360
-
361
-
362
-
363
-
364
- // ================================================================================================ //
365
- // This facilitates the chart.events.mousemove option
366
- // ================================================================================================ //
367
-
368
- var func = obj.get('chart.events.mousemove');
369
-
370
- if (!func && typeof obj.onmousemove == 'function') {
371
- var func = obj.onmousemove;
372
- }
373
-
374
- /**
375
- *
376
- */
377
- if (shape) {
378
- var index = shape['object'].type == 'scatter' ? shape['index_adjusted'] : shape['index'];
379
- if (typeof(obj['$' + index]) == 'object' && typeof(obj['$' + index].onmousemove) == 'function') {
380
- var func2 = obj['$' + index].onmousemove;
381
- }
382
- }
383
-
384
- /**
385
- * This bit saves the current pointer style if there isn't one already saved
386
- */
387
- if (shape && (typeof(func) == 'function' || typeof(func2) == 'function' || typeof obj.Get('link') === 'string')) {
388
-
389
- if (obj.Get('chart.events.mousemove.revertto') == null) {
390
- obj.Set('chart.events.mousemove.revertto', e.target.style.cursor);
391
- }
392
-
393
- if (typeof(func) == 'function') RGraph.custom_events_mousemove_pointer = func(e, shape);
394
- if (typeof(func2) == 'function') RGraph.custom_events_mousemove_pointer = RGraph.custom_events_mousemove_pointer || func2(e, shape);
395
-
396
- // Go through the RGraph.events array looking for more
397
- // event listeners
398
- if ( typeof RG.events === 'object'
399
- && typeof RG.events[obj.uid] === 'object') {
400
-
401
- for (i in RG.events[obj.uid]) {
402
-
403
- if ( typeof i === 'string'
404
- && typeof RG.events[obj.uid][i] === 'object'
405
- && RG.events[obj.uid][i][1] === 'onmousemove'
406
- && typeof RG.events[obj.uid][i][2] === 'function') {
407
-
408
- (RG.events[obj.uid][i][2])(obj);
409
- }
410
- }
411
- }
412
- //return;
413
-
414
- } else if (typeof(obj.Get('chart.events.mousemove.revertto')) == 'string') {
415
-
416
- RG.cursor.push('default');
417
- obj.Set('chart.events.mousemove.revertto', null);
418
- }
419
-
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
- // ======================================================
441
- // This bit of code facilitates the onmouseover event
442
- // ======================================================
443
-
444
-
445
-
446
- var func = obj.properties['chart.events.mouseover'];
447
-
448
- if (!func && typeof obj.onmouseover === 'function') {
449
- func = obj.onmouseover;
450
- }
451
-
452
-
453
- // Allow for individually index functions to be specified
454
- if (shape) {
455
-
456
- var index = shape['object'].type == 'scatter' ? shape['index_adjusted'] : shape['index'];
457
-
458
- if (typeof(obj['$' + index]) == 'object' && typeof(obj['$' + index].onmouseover) == 'function') {
459
- var func2 = obj['$' + index].onmouseover;
460
- }
461
- } else {
462
-
463
- obj.__mouseover_shape_index__ = null;
464
- RG.__mouseover_objects__ = [];
465
- }
466
-
467
- if (typeof RG.__mouseover_objects__ === 'undefined') {
468
- RG.__mouseover_objects__ = [];
469
- }
470
-
471
-
472
- if (shape) {
473
- if ((obj.__mouseover_shape_index__ === shape.index) === false) {
474
-
475
- obj.__mouseover_shape_index__ = shape.index;
476
- RG.__mouseover_objects__.push(obj);
477
-
478
- if (func) func(e, shape);
479
- if (func2) func2(e, shape);
480
-
481
- // Go through the RGraph.events array looking for more
482
- // event listeners
483
- if ( typeof RG.events === 'object'
484
- && typeof RG.events[obj.uid] === 'object') {
485
-
486
- for (i in RG.events[obj.uid]) {
487
-
488
- if ( typeof i === 'string'
489
- && typeof RG.events[obj.uid][i] === 'object'
490
- && RG.events[obj.uid][i][1] === 'onmouseover'
491
- && typeof RG.events[obj.uid][i][2] === 'function') {
492
-
493
- (RG.events[obj.uid][i][2])(obj);
494
- }
495
- }
496
- }
497
- }
498
- } else {
499
- obj.__mouseover_shape_index__ = null;
500
- RG.__mouseover_objects__ = [];
501
- }
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
-
523
-
524
-
525
- // ================================================================================================ //
526
- // Tooltips
527
- // ================================================================================================ //
528
- var current_tooltip = RG.Registry.get('chart.tooltip');
529
- var tooltips = obj.get('chart.tooltips');
530
- var tooltips_event = obj.Get('chart.tooltips.event');
531
-
532
-
533
- if ( shape
534
- && (tooltips && tooltips[shape['index']] || shape['tooltip'])
535
- && tooltips_event.indexOf('mousemove') !== -1
536
- && ( RG.isNull(current_tooltip) // Is there a tooltip being shown?
537
- || obj.uid != current_tooltip.__object__.uid // Same object?
538
- || (current_tooltip.__index__ != shape['index']) // Same tooltip index?
539
- || (typeof shape['dataset'] === 'number' && shape['dataset'] != current_tooltip.__shape__['dataset'])
540
- )
541
- ) {
542
-
543
- RG.clear(obj.canvas);
544
- RG.hideTooltip();
545
- RG.redraw();
546
- obj.canvas.rgraph_mouseup_event_listener(e);
547
-
548
- return;
549
- }
550
-
551
-
552
- // ================================================================================================ //
553
- // Adjusting
554
- // ================================================================================================ //
555
-
556
-
557
- if (obj && obj.get('chart.adjustable')) {
558
- obj.Adjusting_mousemove(e);
559
- }
560
-
561
-
562
- /**
563
- * This facilitates breaking out of the loop when a shape has been found -
564
- * ie the cursor is over a shape an upper chart
565
- */
566
- if (shape || (obj.overChartArea && obj.overChartArea(e) )) {
567
- break;
568
- }
569
- }
570
-
571
- //
572
- // For all objects that are NOT mouseover'ed, reset the
573
- // mouseover flag back to null
574
- //
575
- var objects = RG.OR.getObjectsByCanvasID(e.target.id);
576
-
577
- for (var i=0; i<objects.length; ++i) {
578
- if (!uids[objects[i].uid]) {
579
- objects[i].__mouseover_shape_index__ = null;
580
- }
581
- }
582
-
583
- } else {
584
-
585
- // Reset the mouseover flag on all of this canvas tags objects
586
- var objects = RG.OR.getObjectsByCanvasID(e.target.id);
587
-
588
- for (var i=0; i<objects.length; i++) {
589
-
590
- if (typeof objects[i].__mouseover_shape_index__ === 'number') {
591
- RG.fireCustomEvent(objects[i], 'onmouseout');
592
- }
593
-
594
- objects[i].__mouseover_shape_index__ = null;
595
- }
596
-
597
- RG.__mouseover_objects__ = [];
598
- }
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
- // ================================================================================================ //
607
- // Crosshairs
608
- // ================================================================================================ //
609
-
610
-
611
- if (e.target && e.target.__object__ && e.target.__object__.get('chart.crosshairs')) {
612
- RG.drawCrosshairs(e, e.target.__object__);
613
- }
614
-
615
-
616
- // ================================================================================================ //
617
- // Interactive key No LONGER REQUIRED
618
- // ================================================================================================ //
619
-
620
-
621
- //if (typeof InteractiveKey_line_mousemove == 'function') InteractiveKey_line_mousemove(e);
622
- //if (typeof InteractiveKey_pie_mousemove == 'function') InteractiveKey_pie_mousemove(e);
623
-
624
-
625
- // ================================================================================================ //
626
- // Annotating
627
- // ================================================================================================ //
628
-
629
-
630
- if (e.target.__object__ && e.target.__object__.get('chart.annotatable') && RG.annotating_canvas_onmousemove) {
631
- RG.annotating_canvas_onmousemove(e);
632
- }
633
-
634
-
635
-
636
- /**
637
- * Determine the pointer
638
- */
639
- RG.evaluateCursor(e);
640
- };
641
- obj.canvas.addEventListener('mousemove', obj.canvas.rgraph_mousemove_event_listener, false);
642
- }
643
- };
644
-
645
-
646
-
647
-
648
- /**
649
- * This is the canvas mousedown event listener.
650
- *
651
- * @param object obj The chart object
652
- */
653
- RG.installCanvasMousedownListener =
654
- RG.InstallCanvasMousedownListener = function (obj)
655
- {
656
- if (!obj.canvas.rgraph_mousedown_event_listener) {
657
- obj.canvas.rgraph_mousedown_event_listener = function (e)
658
- {
659
- /**
660
- * For firefox add the window.event object
661
- */
662
- if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
663
-
664
- e = RG.fixEventObject(e);
665
-
666
-
667
- /**
668
- * Annotating
669
- */
670
- if (e.target.__object__ && e.target.__object__.get('chart.annotatable') && RG.annotating_canvas_onmousedown) {
671
- RG.annotating_canvas_onmousedown(e);
672
- return;
673
- }
674
-
675
- var obj = RG.ObjectRegistry.getObjectByXY(e);
676
-
677
- if (obj) {
678
-
679
- var id = obj.id;
680
-
681
-
682
-
683
- /*************************************************************
684
- * Handle adjusting for all object types
685
- *************************************************************/
686
- if (obj && obj.isRGraph && obj.get('chart.adjustable')) {
687
-
688
- /**
689
- * Check the cursor is in the correct area
690
- */
691
- var obj = RG.OR.getObjectByXY(e);
692
-
693
- if (obj && obj.isRGraph) {
694
-
695
- // If applicable, get the appropriate shape and store it in the registry
696
- switch (obj.type) {
697
- case 'bar': var shape = obj.getShapeByX(e); break;
698
- case 'gantt':
699
-
700
- var shape = obj.getShape(e);
701
- var data = typeof shape.subindex === 'number' ? obj.data[shape.index][shape.subindex] : obj.data[shape.index];
702
-
703
- if (shape) {
704
-
705
- var mouseXY = RG.getMouseXY(e);
706
-
707
- RG.Registry.set('chart.adjusting.gantt', {
708
- index: shape.index,
709
- subindex: shape.subindex,
710
- object: obj,
711
- mousex: mouseXY[0],
712
- mousey: mouseXY[1],
713
- event: data,
714
- event_start: data[0],
715
- event_duration: data[1],
716
- mode: (mouseXY[0] > (shape['x'] + shape['width'] - 5) ? 'resize' : 'move'),
717
- shape: shape
718
- });
719
- }
720
- break;
721
- case 'line': var shape = obj.getShape(e); break;
722
- case 'hbar': var shape = obj.getShapeByY(e); break;
723
- default: var shape = null;
724
- }
725
-
726
- //
727
- // Added 30/9/2016
728
- // Now check the index in the chart.adjusting.limitto property
729
- // If that property is an object and the appropriate index is
730
- // truthy then allow adjusting, otherwise don't.
731
- //
732
- if (
733
- RG.isNull(obj.properties['chart.adjustable.only'])
734
- || typeof obj.properties['chart.adjustable.only'] === 'undefined'
735
- ||
736
- (
737
- RG.isArray(obj.properties['chart.adjustable.only'])
738
- && obj.isAdjustable
739
- && obj.isAdjustable(shape)
740
- )
741
- ) {
742
-
743
- RG.Registry.set('chart.adjusting.shape', shape);
744
-
745
-
746
- // Fire the onadjustbegin event
747
- RG.fireCustomEvent(obj, 'onadjustbegin');
748
-
749
- RG.Registry.set('chart.adjusting', obj);
750
-
751
-
752
- // Liberally redraw the canvas
753
- RG.clear(obj.canvas);
754
- RG.redraw();
755
-
756
- // Call the mousemove event listener so that the canvas
757
- // is adjusted even though the mouse isn't moved
758
- obj.canvas.rgraph_mousemove_event_listener(e);
759
- }
760
- }
761
- }
762
-
763
-
764
- RG.clear(obj.canvas);
765
- RG.redraw();
766
- }
767
- };
768
- obj.canvas.addEventListener('mousedown', obj.canvas.rgraph_mousedown_event_listener, false);
769
- }
770
- };
771
-
772
-
773
-
774
-
775
- /**
776
- * This is the canvas click event listener. Used by the pseudo event listener
777
- *
778
- * @param object obj The chart object
779
- */
780
- RG.installCanvasClickListener =
781
- RG.InstallCanvasClickListener = function (obj)
782
- {
783
- if (!obj.canvas.rgraph_click_event_listener) {
784
- obj.canvas.rgraph_click_event_listener = function (e)
785
- {
786
- /**
787
- * For firefox add the window.event object
788
- */
789
- if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
790
-
791
- e = RG.fixEventObject(e);
792
-
793
- var objects = RG.ObjectRegistry.getObjectsByXY(e);
794
-
795
- for (var i=0,len=objects.length; i<len; i+=1) {
796
-
797
- var obj = objects[i];
798
- var id = obj.id;
799
- var shape = obj.getShape(e);
800
-
801
- /**
802
- * This bit saves the current pointer style if there isn't one already saved
803
- */
804
- var func = obj.get('chart.events.click');
805
-
806
- if (!func && typeof(obj.onclick) == 'function') {
807
- func = obj.onclick;
808
- }
809
-
810
- if (shape && typeof func == 'function') {
811
-
812
- func(e, shape);
813
-
814
- // Go through the RGraph.events array looking for more
815
- // event listeners
816
-
817
- if ( typeof RG.events === 'object'
818
- && typeof RG.events[obj.uid] === 'object') {
819
-
820
- for (i in RG.events[obj.uid]) {
821
-
822
- if ( typeof i === 'string'
823
- && typeof RG.events[obj.uid][i] === 'object'
824
- && RG.events[obj.uid][i][1] === 'onclick'
825
- && typeof RG.events[obj.uid][i][2] === 'function') {
826
-
827
- (RG.events[obj.uid][i][2])(obj);
828
- }
829
- }
830
- }
831
-
832
- /**
833
- * If objects are layered on top of each other this return
834
- * stops objects underneath from firing once the "top"
835
- * objects user event has fired
836
- */
837
- return;
838
- }
839
-
840
-
841
-
842
- //
843
- // Handle the key click event
844
- //
845
- var key = RG.Registry.get('key-element');
846
- if (key) {
847
- RG.fireCustomEvent(obj, 'onkeyclick');
848
- }
849
-
850
-
851
-
852
-
853
-
854
- /**
855
- * The property takes priority over this.
856
- */
857
- if (shape) {
858
-
859
- var index = shape['object'].type == 'scatter' ? shape['index_adjusted'] : shape['index'];
860
-
861
- if (typeof(index) == 'number' && obj['$' + index]) {
862
-
863
- var func = obj['$' + index].onclick;
864
-
865
- if (typeof(func) == 'function') {
866
-
867
- func(e, shape);
868
-
869
- /**
870
- * If objects are layered on top of each other this return
871
- * stops objects underneath from firing once the "top"
872
- * objects user event has fired
873
- */
874
- return;
875
- }
876
- }
877
- }
878
-
879
- /**
880
- * This facilitates breaking out of the loop when a shape has been found -
881
- * ie the cursor is over a shape an upper chart
882
- */
883
- if (shape || (obj.overChartArea && obj.overChartArea(e)) ) {
884
- break;
885
- }
886
- }
887
- };
888
- obj.canvas.addEventListener('click', obj.canvas.rgraph_click_event_listener, false);
889
- }
890
- };
891
-
892
-
893
-
894
-
895
- /**
896
- * This function evaluates the various cursor settings and if there's one for pointer, changes it to that
897
- */
898
- RG.evaluateCursor =
899
- RG.EvaluateCursor = function (e)
900
- {
901
- var obj = null;
902
- var mouseXY = RG.getMouseXY(e);
903
- var mouseX = mouseXY[0];
904
- var mouseY = mouseXY[1];
905
- var canvas = e.target;
906
-
907
- /**
908
- * Tooltips cause the mouse pointer to change
909
- */
910
- var objects = RG.OR.getObjectsByCanvasID(canvas.id);
911
-
912
- for (var i=0,len=objects.length; i<len; i+=1) {
913
- if ((objects[i].getShape && objects[i].getShape(e)) || (objects[i].overChartArea && objects[i].overChartArea(e))) {
914
- var obj = objects[i];
915
- var id = obj.id;
916
- }
917
- }
918
-
919
- if (!RG.isNull(obj)) {
920
- if (obj.getShape && obj.getShape(e)) {
921
-
922
- var shape = obj.getShape(e);
923
-
924
- if (obj.get('chart.tooltips')) {
925
-
926
- var text = RG.parseTooltipText(obj.get('chart.tooltips'), shape['index']);
927
-
928
- if (!text && shape['object'].type == 'scatter' && shape['index_adjusted']) {
929
- text = RG.parseTooltipText(obj.get('chart.tooltips'), shape['index_adjusted']);
930
- }
931
-
932
- /**
933
- * This essentially makes front charts "hide" the back charts
934
- */
935
- if (text) {
936
- var pointer = true;
937
- }
938
- }
939
- }
940
-
941
- /**
942
- * Now go through the key coords and see if it's over that.
943
- */
944
- if (!RG.isNull(obj) && obj.Get('chart.key.interactive')) {
945
- for (var j=0; j<obj.coords.key.length; ++j) {
946
- if (mouseX > obj.coords.key[j][0] && mouseX < (obj.coords.key[j][0] + obj.coords.key[j][2]) && mouseY > obj.coords.key[j][1] && mouseY < (obj.coords.key[j][1] + obj.coords.key[j][3])) {
947
- var pointer = true;
948
- }
949
- }
950
- }
951
- }
952
-
953
- /**
954
- * It can be specified in the user mousemove event - remember it can now
955
- * be specified in THREE ways
956
- */
957
- if (RGraph.custom_events_mousemove_pointer) {
958
- var pointer = true;
959
- RGraph.custom_events_mousemove_pointer = false;
960
- }
961
- /*
962
-
963
-
964
- var index = shape['object'].type == 'scatter' ? shape['index_adjusted'] : shape['index'];
965
- if (!RG.isNull(obj['$' + index]) && typeof(obj['$' + index].onmousemove) == 'function') {
966
- var str = (obj['$' + index].onmousemove).toString();
967
- if (str.match(/pointer/) && str.match(/cursor/) && str.match(/style/)) {
968
- var pointer = true;
969
- }
970
- }
971
- }
972
- */
973
-
974
- /**
975
- * Is the chart resizable? Go through all the objects again
976
- */
977
- var objects = RG.OR.objects.byCanvasID;
978
-
979
- for (var i=0,len=objects.length; i<len; i+=1) {
980
- if (objects[i] && objects[i][1].Get('chart.resizable')) {
981
- var resizable = true;
982
- }
983
- }
984
-
985
- if (resizable && mouseX > (e.target.width - 32) && mouseY > (e.target.height - 16)) {
986
- pointer = true;
987
- }
988
-
989
-
990
- if (pointer) {
991
- e.target.style.cursor = 'pointer';
992
- } else if (e.target.style.cursor == 'pointer') {
993
- e.target.style.cursor = 'default';
994
- } else {
995
- e.target.style.cursor = null;
996
- }
997
-
998
-
999
-
1000
- // =========================================================================
1001
- // Resize cursor - check mouseis in bottom left corner and if it is change it
1002
- // =========================================================================
1003
-
1004
-
1005
- if (resizable && mouseX >= (e.target.width - 15) && mouseY >= (e.target.height - 15)) {
1006
- e.target.style.cursor = 'move';
1007
-
1008
- } else if (e.target.style.cursor === 'move') {
1009
- e.target.style.cursor = 'default';
1010
- }
1011
-
1012
-
1013
- // =========================================================================
1014
- // Interactive key
1015
- // =========================================================================
1016
-
1017
-
1018
-
1019
- if (typeof mouse_over_key == 'boolean' && mouse_over_key) {
1020
- e.target.style.cursor = 'pointer';
1021
- }
1022
-
1023
-
1024
- // =========================================================================
1025
- // Gantt chart adjusting
1026
- // =========================================================================
1027
-
1028
- //if (obj && obj.type == 'gantt' && obj.get('chart.adjustable')) {
1029
- // if (obj.getShape && obj.getShape(e)) {
1030
- // e.target.style.cursor = 'ew-resize';
1031
- // } else {
1032
- // e.target.style.cursor = 'default';
1033
- // }
1034
- //} else if (!obj || !obj.type) {
1035
- // e.target.style.cursor = cursor;
1036
- //}
1037
-
1038
-
1039
- // =========================================================================
1040
- // Line chart adjusting
1041
- // =========================================================================
1042
-
1043
-
1044
- if (obj && obj.type == 'line' && obj.get('chart.adjustable')) {
1045
- if (obj.getShape) {
1046
-
1047
- var shape = obj.getShape(e);
1048
-
1049
- if (shape && obj.isAdjustable(shape)) {
1050
- e.target.style.cursor = 'ns-resize';
1051
- }
1052
- } else {
1053
- e.target.style.cursor = 'default';
1054
- }
1055
- }
1056
-
1057
-
1058
- // =========================================================================
1059
- // Annotatable
1060
- // =========================================================================
1061
-
1062
-
1063
- if (e.target.__object__ && e.target.__object__.get('chart.annotatable')) {
1064
- e.target.style.cursor = 'crosshair';
1065
- }
1066
-
1067
-
1068
- // =========================================================================
1069
- // Drawing API link
1070
- // =========================================================================
1071
-
1072
-
1073
- if (obj && obj.type === 'drawing.text' && shape && typeof obj.get('link') === 'string') {
1074
- e.target.style.cursor = 'pointer';
1075
- }
1076
- };
1077
-
1078
-
1079
-
1080
-
1081
- /**
1082
- * This function handles the tooltip text being a string, function
1083
- *
1084
- * @param mixed tooltip This could be a string or a function. If it's a function it's called and
1085
- * the return value is used as the tooltip text
1086
- * @param numbr idx The index of the tooltip.
1087
- */
1088
- RG.parseTooltipText = function (tooltips, idx)
1089
- {
1090
- // No tooltips
1091
- if (!tooltips) {
1092
- return null;
1093
- }
1094
-
1095
- // Get the tooltip text
1096
- if (typeof tooltips == 'function') {
1097
- var text = tooltips(idx);
1098
-
1099
- // A single tooltip. Only supported by the Scatter chart
1100
- } else if (typeof tooltips == 'string') {
1101
- var text = tooltips;
1102
-
1103
- } else if (typeof tooltips == 'object' && typeof tooltips[idx] == 'function') {
1104
- var text = tooltips[idx](idx);
1105
-
1106
- } else if (typeof tooltips[idx] == 'string' && tooltips[idx]) {
1107
- var text = tooltips[idx];
1108
-
1109
- } else {
1110
- var text = '';
1111
- }
1112
-
1113
- if (text == 'undefined') {
1114
- text = '';
1115
- } else if (text == 'null') {
1116
- text = '';
1117
- }
1118
-
1119
- // Conditional in case the tooltip file isn't included
1120
- return RG.getTooltipTextFromDIV ? RG.getTooltipTextFromDIV(text) : text;
1121
- };
1122
-
1123
-
1124
-
1125
-
1126
- /**
1127
- * Draw crosshairs if enabled
1128
- *
1129
- * @param object obj The graph object (from which we can get the context and canvas as required)
1130
- */
1131
- RG.drawCrosshairs =
1132
- RG.DrawCrosshairs = function (e, obj)
1133
- {
1134
- var e = RG.fixEventObject(e),
1135
- width = obj.canvas.width,
1136
- height = obj.canvas.height,
1137
- mouseXY = RG.getMouseXY(e),
1138
- x = mouseXY[0],
1139
- y = mouseXY[1],
1140
- gutterLeft = obj.gutterLeft,
1141
- gutterRight = obj.gutterRight,
1142
- gutterTop = obj.gutterTop,
1143
- gutterBottom = obj.gutterBottom,
1144
- Mathround = Math.round,
1145
- prop = obj.properties,
1146
- co = obj.context,
1147
- ca = obj.canvas
1148
-
1149
- RG.redrawCanvas(ca);
1150
-
1151
- if ( x >= gutterLeft
1152
- && y >= gutterTop
1153
- && x <= (width - gutterRight)
1154
- && y <= (height - gutterBottom)
1155
- ) {
1156
-
1157
- var linewidth = prop['chart.crosshairs.linewidth'] ? prop['chart.crosshairs.linewidth'] : 1;
1158
- co.lineWidth = linewidth ? linewidth : 1;
1159
-
1160
- co.beginPath();
1161
- co.strokeStyle = prop['chart.crosshairs.color'];
1162
-
1163
-
1164
-
1165
-
1166
-
1167
- /**
1168
- * The chart.crosshairs.snap option
1169
- */
1170
- if (prop['chart.crosshairs.snap']) {
1171
-
1172
- // Linear search for the closest point
1173
- var point = null;
1174
- var dist = null;
1175
- var len = null;
1176
-
1177
- if (obj.type == 'line') {
1178
-
1179
- for (var i=0; i<obj.coords.length; ++i) {
1180
-
1181
- var length = RG.getHypLength(obj.coords[i][0], obj.coords[i][1], x, y);
1182
-
1183
- // Check the mouse X coordinate
1184
- if (typeof dist != 'number' || length < dist) {
1185
- var point = i;
1186
- var dist = length;
1187
- }
1188
- }
1189
-
1190
- x = obj.coords[point][0];
1191
- y = obj.coords[point][1];
1192
-
1193
- // Get the dataset
1194
- for (var dataset=0; dataset<obj.coords2.length; ++dataset) {
1195
- for (var point=0; point<obj.coords2[dataset].length; ++point) {
1196
- if (obj.coords2[dataset][point][0] == x && obj.coords2[dataset][point][1] == y) {
1197
- ca.__crosshairs_snap_dataset__ = dataset;
1198
- ca.__crosshairs_snap_point__ = point;
1199
- }
1200
- }
1201
- }
1202
-
1203
- } else {
1204
-
1205
- for (var i=0; i<obj.coords.length; ++i) {
1206
- for (var j=0; j<obj.coords[i].length; ++j) {
1207
-
1208
- // Check the mouse X coordinate
1209
- var len = RG.getHypLength(obj.coords[i][j][0], obj.coords[i][j][1], x, y);
1210
-
1211
- if (typeof(dist) != 'number' || len < dist) {
1212
-
1213
- var dataset = i;
1214
- var point = j;
1215
- var dist = len;
1216
- }
1217
- }
1218
-
1219
- }
1220
- ca.__crosshairs_snap_dataset__ = dataset;
1221
- ca.__crosshairs_snap_point__ = point;
1222
-
1223
-
1224
- x = obj.coords[dataset][point][0];
1225
- y = obj.coords[dataset][point][1];
1226
- }
1227
- }
1228
-
1229
-
1230
-
1231
-
1232
-
1233
-
1234
- // Draw a top vertical line
1235
- if (prop['chart.crosshairs.vline']) {
1236
- co.moveTo(Mathround(x), Mathround(gutterTop));
1237
- co.lineTo(Mathround(x), Mathround(height - gutterBottom));
1238
- }
1239
-
1240
- // Draw a horizontal line
1241
- if (prop['chart.crosshairs.hline']) {
1242
- co.moveTo(Mathround(gutterLeft), Mathround(y));
1243
- co.lineTo(Mathround(width - gutterRight), Mathround(y));
1244
- }
1245
-
1246
- co.stroke();
1247
-
1248
-
1249
- /**
1250
- * Need to show the coords?
1251
- */
1252
- if (obj.type == 'scatter' && prop['chart.crosshairs.coords']) {
1253
-
1254
- var xCoord = (((x - gutterLeft) / (width - gutterLeft - gutterRight)) * (prop['chart.xmax'] - prop['chart.xmin'])) + prop['chart.xmin'];
1255
- xCoord = xCoord.toFixed(prop['chart.scale.decimals']);
1256
- var yCoord = obj.max - (((y - prop['chart.gutter.top']) / (height - gutterTop - gutterBottom)) * obj.max);
1257
-
1258
- if (obj.type == 'scatter' && obj.properties['chart.xaxispos'] == 'center') {
1259
- yCoord = (yCoord - (obj.max / 2)) * 2;
1260
- }
1261
-
1262
- yCoord = yCoord.toFixed(prop['chart.scale.decimals']);
1263
-
1264
- var div = RG.Registry.get('chart.coordinates.coords.div');
1265
- var mouseXY = RG.getMouseXY(e);
1266
- var canvasXY = RG.getCanvasXY(ca);
1267
-
1268
- if (!div) {
1269
- var div = document.createElement('DIV');
1270
- div.__object__ = obj;
1271
- div.style.position = 'absolute';
1272
- div.style.backgroundColor = 'white';
1273
- div.style.border = '1px solid black';
1274
- div.style.fontFamily = 'Arial, Verdana, sans-serif';
1275
- div.style.fontSize = '10pt'
1276
- div.style.padding = '2px';
1277
- div.style.opacity = 1;
1278
- div.style.WebkitBorderRadius = '3px';
1279
- div.style.borderRadius = '3px';
1280
- div.style.MozBorderRadius = '3px';
1281
- document.body.appendChild(div);
1282
-
1283
- RG.Registry.set('chart.coordinates.coords.div', div);
1284
- }
1285
-
1286
- // Convert the X/Y pixel coords to correspond to the scale
1287
- div.style.opacity = 1;
1288
- div.style.display = 'inline';
1289
-
1290
- if (!prop['chart.crosshairs.coords.fixed']) {
1291
- div.style.left = ma.max(2, (e.pageX - div.offsetWidth - 3)) + 'px';
1292
- div.style.top = ma.max(2, (e.pageY - div.offsetHeight - 3)) + 'px';
1293
- } else {
1294
- div.style.left = canvasXY[0] + gutterLeft + 3 + 'px';
1295
- div.style.top = canvasXY[1] + gutterTop + 3 + 'px';
1296
- }
1297
-
1298
- div.innerHTML = '<span style="color: #666">' + prop['chart.crosshairs.coords.labels.x'] + ':</span> ' + xCoord + '<br><span style="color: #666">' + prop['chart.crosshairs.coords.labels.y'] + ':</span> ' + yCoord;
1299
-
1300
- obj.canvas.addEventListener('mouseout', RG.hideCrosshairCoords, false);
1301
-
1302
- ca.__crosshairs_labels__ = div;
1303
- ca.__crosshairs_x__ = xCoord;
1304
- ca.__crosshairs_y__ = yCoord;
1305
-
1306
- } else if (prop['chart.crosshairs.coords']) {
1307
- alert('[RGRAPH] Showing crosshair coordinates is only supported on the Scatter chart');
1308
- }
1309
-
1310
- /**
1311
- * Fire the oncrosshairs custom event
1312
- */
1313
- RG.fireCustomEvent(obj, 'oncrosshairs');
1314
-
1315
- } else {
1316
- RG.hideCrosshairCoords();
1317
- }
1318
- };
1319
-
1320
-
1321
-
1322
-
1323
- //
1324
- // Adds a mousemove event listener that highlights a segment based on th
1325
- // mousemove event. Used in the Rose and the RScatter charts
1326
- //
1327
- //@param int segments The number of segments to allow
1328
- //
1329
- RG.allowSegmentHighlight = function (opt)
1330
- {
1331
- var obj = opt.object,
1332
- count = opt.count,
1333
- fill = opt.fill,
1334
- stroke = opt.stroke
1335
-
1336
- if (!RG.segmentHighlightFunction) {
1337
-
1338
- RG.segmentHighlightFunction = function (e)
1339
- {
1340
-
1341
- var mouseXY = RG.getMouseXY(e);
1342
- var angle = RG.getAngleByXY(obj.centerx, obj.centery, mouseXY[0], mouseXY[1]);
1343
-
1344
- angle += RG.HALFPI;
1345
-
1346
- if (angle > RG.TWOPI) {
1347
- angle -= RG.TWOPI;
1348
- }
1349
-
1350
- RG.redraw();
1351
-
1352
- var start = 0;
1353
- var end = 0;
1354
- var a = (ma.PI * 2) / count;
1355
-
1356
- //
1357
- // Radius
1358
- //
1359
- var r = obj.radius;
1360
-
1361
-
1362
- (function ()
1363
- {
1364
- for (i=0; i<count; i+=1) {
1365
- if (angle < (a * (i + 1))) {
1366
- start = i * a;
1367
- end = (i + 1) * a;
1368
-
1369
- return;
1370
- }
1371
- }
1372
- })();
1373
-
1374
- start -= RG.HALFPI;
1375
- end -= RG.HALFPI;
1376
-
1377
-
1378
- RG.path2(
1379
- obj.context,
1380
- 'b m % % a % % % % % false c s % f %',
1381
- obj.centerx, obj.centery,
1382
- obj.centerx,obj.centery,r,start,end,
1383
- stroke,
1384
- fill
1385
- );
1386
-
1387
- };
1388
- obj.canvas.addEventListener('mousemove', RG.segmentHighlightFunction, false);
1389
- }
1390
- }
1391
-
1392
-
1393
-
1394
-
1395
- // End module pattern
1396
- })(window, document);
2
+ RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
3
+ {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.installWindowMousedownListener=RG.InstallWindowMousedownListener=function(obj)
4
+ {if(!RG.window_mousedown_event_listener){RG.window_mousedown_event_listener=function(e)
5
+ {if(navigator.userAgent.indexOf('Firefox')>=0)win.event=e;e=RG.fixEventObject(e);if(RG.HideTooltip&&RG.Registry.Get('chart.tooltip')){RG.clear(RG.Registry.Get('chart.tooltip').__canvas__);RG.redraw();RG.hideTooltip();}};win.addEventListener('mousedown',RG.window_mousedown_event_listener,false);}};RG.installWindowMouseupListener=RG.InstallWindowMouseupListener=function(obj)
6
+ {if(!RG.window_mouseup_event_listener){RG.window_mouseup_event_listener=function(e)
7
+ {if(navigator.userAgent.indexOf('Firefox')>=0)win.event=e;e=RG.fixEventObject(e);if(RG.annotating_window_onmouseup){RG.annotating_window_onmouseup(e);return;}
8
+ if(RG.Registry.Get('chart.adjusting')||RG.Registry.Get('chart.adjusting.gantt')){var obj=RG.Registry.Get('chart.adjusting');if(obj&&obj.type==='line'){obj.data_arr=RG.arrayLinearize(obj.data);}
9
+ RG.fireCustomEvent(RG.Registry.Get('chart.adjusting'),'onadjustend');}
10
+ RG.Registry.set('chart.adjusting',null);RG.Registry.set('chart.adjusting.shape',null);RG.Registry.set('chart.adjusting.gantt',null);var tags=document.getElementsByTagName('canvas');for(var i=0;i<tags.length;++i){if(tags[i].__object__&&tags[i].__object__.isRGraph){if(!tags[i].__object__.get('chart.annotatable')){if(!tags[i].__rgraph_trace_cover__&&!noredraw){RG.clear(tags[i]);}else{var noredraw=true;}}}}
11
+ if(!noredraw){RG.redraw();}};win.addEventListener('mouseup',RG.window_mouseup_event_listener,false);}};RG.installCanvasMouseupListener=RG.InstallCanvasMouseupListener=function(obj)
12
+ {if(!obj.canvas.rgraph_mouseup_event_listener){obj.canvas.rgraph_mouseup_event_listener=function(e)
13
+ {if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);var objects=RG.ObjectRegistry.getObjectsByXY(e);if(objects){for(var i=0,len=objects.length;i<len;i+=1){var obj=objects[i],id=objects[i].id;var link=obj.Get('link');if(obj.type=='drawing.text'&&typeof link==='string'){var link_target=obj.get('link.target');var link_options=obj.get('link.options');window.open(link,link_target?link_target:null,link_options);}
14
+ if(!RG.isNull(obj)&&RG.tooltip){var shape=obj.getShape(e);if(shape&&shape['tooltip']){var text=shape['tooltip'];if(text){var type=shape['object'].type;RG.clear(obj.canvas);RG.redraw();RG.Registry.set('chart.tooltip.shape',shape);RG.tooltip(obj,text,0,0,shape['index'],e);obj.highlight(shape);if(RG.Registry.get('chart.tooltip')){RG.Registry.get('chart.tooltip').__shape__=shape;RG.evaluateCursor(e);}
15
+ e.cancelBubble=true;e.stopPropagation();return false;}}}
16
+ if(RG.Registry.get('chart.adjusting')||RG.Registry.get('chart.adjusting.gantt')){if(obj&&obj.type==='line'){obj.data_arr=RG.arrayLinearize(obj.data);}
17
+ RG.fireCustomEvent(RG.Registry.get('chart.adjusting'),'onadjustend');}
18
+ RG.Registry.set('chart.adjusting',null);RG.Registry.set('chart.adjusting.shape',null);RG.Registry.set('chart.adjusting.gantt',null);if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}}};obj.canvas.addEventListener('mouseup',obj.canvas.rgraph_mouseup_event_listener,false);}};RG.installCanvasMousemoveListener=RG.InstallCanvasMousemoveListener=function(obj)
19
+ {if(!obj.canvas.rgraph_mousemove_event_listener){obj.canvas.rgraph_mousemove_event_listener=function(e)
20
+ {if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);var objects=RG.OR.getObjectsByXY(e);var uids=[];if(objects&&objects.length>0){for(var i=0,len=objects.length;i<len;i+=1){var obj=objects[i];var id=obj.id;uids[obj.uid]=true;if(!obj.getShape){continue;}
21
+ var shape=obj.getShape(e);if((!shape&&typeof obj.__mouseover_shape_index__==='number')||(shape&&typeof obj.__mouseover_shape_index__==='number'&&shape.index!==obj.__mouseover_shape_index__)){RG.fireCustomEvent(obj,'onmouseout');}
22
+ if(obj.coords&&obj.coords.key&&obj.coords.key.length){var mouseXY=RG.getMouseXY(e);for(var i=0,overkey=false;i<obj.coords.key.length;++i){if(mouseXY[0]>=obj.coords.key[i][0]&&mouseXY[0]<=(obj.coords.key[i][0]+obj.coords.key[i][2])&&mouseXY[1]>=obj.coords.key[i][1]&&mouseXY[1]<=(obj.coords.key[i][1]+obj.coords.key[i][3])){RG.Registry.set('key-element',obj.coords.key[i]);overkey=true;}
23
+ if(!overkey){RG.Registry.set('key-element',null);}}}
24
+ var func=obj.get('chart.events.mousemove');if(!func&&typeof obj.onmousemove=='function'){var func=obj.onmousemove;}
25
+ if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(obj['$'+index])=='object'&&typeof(obj['$'+index].onmousemove)=='function'){var func2=obj['$'+index].onmousemove;}}
26
+ if(shape&&(typeof(func)=='function'||typeof(func2)=='function'||typeof obj.Get('link')==='string')){if(obj.Get('chart.events.mousemove.revertto')==null){obj.Set('chart.events.mousemove.revertto',e.target.style.cursor);}
27
+ if(typeof(func)=='function')RGraph.custom_events_mousemove_pointer=func(e,shape);if(typeof(func2)=='function')RGraph.custom_events_mousemove_pointer=RGraph.custom_events_mousemove_pointer||func2(e,shape);if(typeof RG.events==='object'&&typeof RG.events[obj.uid]==='object'){for(i in RG.events[obj.uid]){if(typeof i==='string'&&typeof RG.events[obj.uid][i]==='object'&&RG.events[obj.uid][i][1]==='onmousemove'&&typeof RG.events[obj.uid][i][2]==='function'){(RG.events[obj.uid][i][2])(obj);}}}}else if(typeof(obj.Get('chart.events.mousemove.revertto'))=='string'){RG.cursor.push('default');obj.Set('chart.events.mousemove.revertto',null);}
28
+ var func=obj.properties['chart.events.mouseover'];if(!func&&typeof obj.onmouseover==='function'){func=obj.onmouseover;}
29
+ if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(obj['$'+index])=='object'&&typeof(obj['$'+index].onmouseover)=='function'){var func2=obj['$'+index].onmouseover;}}else{obj.__mouseover_shape_index__=null;RG.__mouseover_objects__=[];}
30
+ if(typeof RG.__mouseover_objects__==='undefined'){RG.__mouseover_objects__=[];}
31
+ if(shape){if((obj.__mouseover_shape_index__===shape.index)===false){obj.__mouseover_shape_index__=shape.index;RG.__mouseover_objects__.push(obj);if(func)func(e,shape);if(func2)func2(e,shape);if(typeof RG.events==='object'&&typeof RG.events[obj.uid]==='object'){for(i in RG.events[obj.uid]){if(typeof i==='string'&&typeof RG.events[obj.uid][i]==='object'&&RG.events[obj.uid][i][1]==='onmouseover'&&typeof RG.events[obj.uid][i][2]==='function'){(RG.events[obj.uid][i][2])(obj);}}}}}else{obj.__mouseover_shape_index__=null;RG.__mouseover_objects__=[];}
32
+ var current_tooltip=RG.Registry.get('chart.tooltip');var tooltips=obj.get('chart.tooltips');var tooltips_event=obj.Get('chart.tooltips.event');if(shape&&(tooltips&&tooltips[shape['index']]||shape['tooltip'])&&tooltips_event.indexOf('mousemove')!==-1&&(RG.isNull(current_tooltip)||obj.uid!=current_tooltip.__object__.uid||(current_tooltip.__index__!=shape['index'])||(typeof shape['dataset']==='number'&&shape['dataset']!=current_tooltip.__shape__['dataset']))){RG.clear(obj.canvas);RG.hideTooltip();RG.redraw();obj.canvas.rgraph_mouseup_event_listener(e);return;}
33
+ if(obj&&obj.get('chart.adjustable')){obj.Adjusting_mousemove(e);}
34
+ if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}
35
+ var objects=RG.OR.getObjectsByCanvasID(e.target.id);for(var i=0;i<objects.length;++i){if(!uids[objects[i].uid]){objects[i].__mouseover_shape_index__=null;}}}else{var objects=RG.OR.getObjectsByCanvasID(e.target.id);for(var i=0;i<objects.length;i++){if(typeof objects[i].__mouseover_shape_index__==='number'){RG.fireCustomEvent(objects[i],'onmouseout');}
36
+ objects[i].__mouseover_shape_index__=null;}
37
+ RG.__mouseover_objects__=[];}
38
+ if(e.target&&e.target.__object__&&e.target.__object__.get('chart.crosshairs')){RG.drawCrosshairs(e,e.target.__object__);}
39
+ if(e.target.__object__&&e.target.__object__.get('chart.annotatable')&&RG.annotating_canvas_onmousemove){RG.annotating_canvas_onmousemove(e);}
40
+ RG.evaluateCursor(e);};obj.canvas.addEventListener('mousemove',obj.canvas.rgraph_mousemove_event_listener,false);}};RG.installCanvasMousedownListener=RG.InstallCanvasMousedownListener=function(obj)
41
+ {if(!obj.canvas.rgraph_mousedown_event_listener){obj.canvas.rgraph_mousedown_event_listener=function(e)
42
+ {if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);if(e.target.__object__&&e.target.__object__.get('chart.annotatable')&&RG.annotating_canvas_onmousedown){RG.annotating_canvas_onmousedown(e);return;}
43
+ var obj=RG.ObjectRegistry.getObjectByXY(e);if(obj){var id=obj.id;if(obj&&obj.isRGraph&&obj.get('chart.adjustable')){var obj=RG.OR.getObjectByXY(e);if(obj&&obj.isRGraph){switch(obj.type){case'bar':var shape=obj.getShapeByX(e);break;case'gantt':var shape=obj.getShape(e);var data=typeof shape.subindex==='number'?obj.data[shape.index][shape.subindex]:obj.data[shape.index];if(shape){var mouseXY=RG.getMouseXY(e);RG.Registry.set('chart.adjusting.gantt',{index:shape.index,subindex:shape.subindex,object:obj,mousex:mouseXY[0],mousey:mouseXY[1],event:data,event_start:data[0],event_duration:data[1],mode:(mouseXY[0]>(shape['x']+shape['width']-5)?'resize':'move'),shape:shape});}
44
+ break;case'line':var shape=obj.getShape(e);break;case'hbar':var shape=obj.getShapeByY(e);break;default:var shape=null;}
45
+ if(RG.isNull(obj.properties['chart.adjustable.only'])||typeof obj.properties['chart.adjustable.only']==='undefined'||(RG.isArray(obj.properties['chart.adjustable.only'])&&obj.isAdjustable&&obj.isAdjustable(shape))){RG.Registry.set('chart.adjusting.shape',shape);RG.fireCustomEvent(obj,'onadjustbegin');RG.Registry.set('chart.adjusting',obj);RG.clear(obj.canvas);RG.redraw();obj.canvas.rgraph_mousemove_event_listener(e);}}}
46
+ RG.clear(obj.canvas);RG.redraw();}};obj.canvas.addEventListener('mousedown',obj.canvas.rgraph_mousedown_event_listener,false);}};RG.installCanvasClickListener=RG.InstallCanvasClickListener=function(obj)
47
+ {if(!obj.canvas.rgraph_click_event_listener){obj.canvas.rgraph_click_event_listener=function(e)
48
+ {if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);var objects=RG.ObjectRegistry.getObjectsByXY(e);for(var i=0,len=objects.length;i<len;i+=1){var obj=objects[i];var id=obj.id;var shape=obj.getShape(e);var func=obj.get('chart.events.click');if(!func&&typeof(obj.onclick)=='function'){func=obj.onclick;}
49
+ if(shape&&typeof func=='function'){func(e,shape);if(typeof RG.events==='object'&&typeof RG.events[obj.uid]==='object'){for(i in RG.events[obj.uid]){if(typeof i==='string'&&typeof RG.events[obj.uid][i]==='object'&&RG.events[obj.uid][i][1]==='onclick'&&typeof RG.events[obj.uid][i][2]==='function'){(RG.events[obj.uid][i][2])(obj);}}}
50
+ return;}
51
+ var key=RG.Registry.get('key-element');if(key){RG.fireCustomEvent(obj,'onkeyclick');}
52
+ if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(index)=='number'&&obj['$'+index]){var func=obj['$'+index].onclick;if(typeof(func)=='function'){func(e,shape);return;}}}
53
+ if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}};obj.canvas.addEventListener('click',obj.canvas.rgraph_click_event_listener,false);}};RG.evaluateCursor=RG.EvaluateCursor=function(e)
54
+ {var obj=null;var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];var canvas=e.target;var objects=RG.OR.getObjectsByCanvasID(canvas.id);for(var i=0,len=objects.length;i<len;i+=1){if((objects[i].getShape&&objects[i].getShape(e))||(objects[i].overChartArea&&objects[i].overChartArea(e))){var obj=objects[i];var id=obj.id;}}
55
+ if(!RG.isNull(obj)){if(obj.getShape&&obj.getShape(e)){var shape=obj.getShape(e);if(obj.get('chart.tooltips')){var text=RG.parseTooltipText(obj.get('chart.tooltips'),shape['index']);if(!text&&shape['object'].type=='scatter'&&shape['index_adjusted']){text=RG.parseTooltipText(obj.get('chart.tooltips'),shape['index_adjusted']);}
56
+ if(text){var pointer=true;}}}
57
+ if(!RG.isNull(obj)&&obj.Get('chart.key.interactive')){for(var j=0;j<obj.coords.key.length;++j){if(mouseX>obj.coords.key[j][0]&&mouseX<(obj.coords.key[j][0]+obj.coords.key[j][2])&&mouseY>obj.coords.key[j][1]&&mouseY<(obj.coords.key[j][1]+obj.coords.key[j][3])){var pointer=true;}}}}
58
+ if(RGraph.custom_events_mousemove_pointer){var pointer=true;RGraph.custom_events_mousemove_pointer=false;}
59
+ var objects=RG.OR.objects.byCanvasID;for(var i=0,len=objects.length;i<len;i+=1){if(objects[i]&&objects[i][1].Get('chart.resizable')){var resizable=true;}}
60
+ if(resizable&&mouseX>(e.target.width-32)&&mouseY>(e.target.height-16)){pointer=true;}
61
+ if(pointer){e.target.style.cursor='pointer';}else if(e.target.style.cursor=='pointer'){e.target.style.cursor='default';}else{e.target.style.cursor=null;}
62
+ if(resizable&&mouseX>=(e.target.width-15)&&mouseY>=(e.target.height-15)){e.target.style.cursor='move';}else if(e.target.style.cursor==='move'){e.target.style.cursor='default';}
63
+ if(typeof mouse_over_key=='boolean'&&mouse_over_key){e.target.style.cursor='pointer';}
64
+ if(obj&&obj.type=='line'&&obj.get('chart.adjustable')){if(obj.getShape){var shape=obj.getShape(e);if(shape&&obj.isAdjustable(shape)){e.target.style.cursor='ns-resize';}}else{e.target.style.cursor='default';}}
65
+ if(e.target.__object__&&e.target.__object__.get('chart.annotatable')){e.target.style.cursor='crosshair';}
66
+ if(obj&&obj.type==='drawing.text'&&shape&&typeof obj.get('link')==='string'){e.target.style.cursor='pointer';}};RG.parseTooltipText=function(tooltips,idx)
67
+ {if(!tooltips){return null;}
68
+ if(typeof tooltips=='function'){var text=tooltips(idx);}else if(typeof tooltips=='string'){var text=tooltips;}else if(typeof tooltips=='object'&&typeof tooltips[idx]=='function'){var text=tooltips[idx](idx);}else if(typeof tooltips[idx]=='string'&&tooltips[idx]){var text=tooltips[idx];}else{var text='';}
69
+ if(text=='undefined'){text='';}else if(text=='null'){text='';}
70
+ return RG.getTooltipTextFromDIV?RG.getTooltipTextFromDIV(text):text;};RG.drawCrosshairs=RG.DrawCrosshairs=function(e,obj)
71
+ {var e=RG.fixEventObject(e),width=obj.canvas.width,height=obj.canvas.height,mouseXY=RG.getMouseXY(e),x=mouseXY[0],y=mouseXY[1],gutterLeft=obj.gutterLeft,gutterRight=obj.gutterRight,gutterTop=obj.gutterTop,gutterBottom=obj.gutterBottom,Mathround=Math.round,prop=obj.properties,co=obj.context,ca=obj.canvas
72
+ RG.redrawCanvas(ca);if(x>=gutterLeft&&y>=gutterTop&&x<=(width-gutterRight)&&y<=(height-gutterBottom)){var linewidth=prop['chart.crosshairs.linewidth']?prop['chart.crosshairs.linewidth']:1;co.lineWidth=linewidth?linewidth:1;co.beginPath();co.strokeStyle=prop['chart.crosshairs.color'];if(prop['chart.crosshairs.snap']){var point=null;var dist=null;var len=null;if(obj.type=='line'){for(var i=0;i<obj.coords.length;++i){var length=RG.getHypLength(obj.coords[i][0],obj.coords[i][1],x,y);if(typeof dist!='number'||length<dist){var point=i;var dist=length;}}
73
+ x=obj.coords[point][0];y=obj.coords[point][1];for(var dataset=0;dataset<obj.coords2.length;++dataset){for(var point=0;point<obj.coords2[dataset].length;++point){if(obj.coords2[dataset][point][0]==x&&obj.coords2[dataset][point][1]==y){ca.__crosshairs_snap_dataset__=dataset;ca.__crosshairs_snap_point__=point;}}}}else{for(var i=0;i<obj.coords.length;++i){for(var j=0;j<obj.coords[i].length;++j){var len=RG.getHypLength(obj.coords[i][j][0],obj.coords[i][j][1],x,y);if(typeof(dist)!='number'||len<dist){var dataset=i;var point=j;var dist=len;}}}
74
+ ca.__crosshairs_snap_dataset__=dataset;ca.__crosshairs_snap_point__=point;x=obj.coords[dataset][point][0];y=obj.coords[dataset][point][1];}}
75
+ if(prop['chart.crosshairs.vline']){co.moveTo(Mathround(x),Mathround(gutterTop));co.lineTo(Mathround(x),Mathround(height-gutterBottom));}
76
+ if(prop['chart.crosshairs.hline']){co.moveTo(Mathround(gutterLeft),Mathround(y));co.lineTo(Mathround(width-gutterRight),Mathround(y));}
77
+ co.stroke();if(obj.type=='scatter'&&prop['chart.crosshairs.coords']){var xCoord=(((x-gutterLeft)/(width-gutterLeft-gutterRight))*(prop['chart.xmax']-prop['chart.xmin']))+prop['chart.xmin'];xCoord=xCoord.toFixed(prop['chart.scale.decimals']);var yCoord=obj.max-(((y-prop['chart.gutter.top'])/(height-gutterTop-gutterBottom))*obj.max);if(obj.type=='scatter'&&obj.properties['chart.xaxispos']=='center'){yCoord=(yCoord-(obj.max/2))*2;}
78
+ yCoord=yCoord.toFixed(prop['chart.scale.decimals']);var div=RG.Registry.get('chart.coordinates.coords.div');var mouseXY=RG.getMouseXY(e);var canvasXY=RG.getCanvasXY(ca);if(!div){var div=document.createElement('DIV');div.__object__=obj;div.style.position='absolute';div.style.backgroundColor='white';div.style.border='1px solid black';div.style.fontFamily='Arial, Verdana, sans-serif';div.style.fontSize='10pt'
79
+ div.style.padding='2px';div.style.opacity=1;div.style.WebkitBorderRadius='3px';div.style.borderRadius='3px';div.style.MozBorderRadius='3px';document.body.appendChild(div);RG.Registry.set('chart.coordinates.coords.div',div);}
80
+ div.style.opacity=1;div.style.display='inline';if(!prop['chart.crosshairs.coords.fixed']){div.style.left=ma.max(2,(e.pageX-div.offsetWidth-3))+'px';div.style.top=ma.max(2,(e.pageY-div.offsetHeight-3))+'px';}else{div.style.left=canvasXY[0]+gutterLeft+3+'px';div.style.top=canvasXY[1]+gutterTop+3+'px';}
81
+ if(typeof prop['chart.crosshairs.coords.formatter.x']==='function'){xCoord=(prop['chart.crosshairs.coords.formatter.x'])({object:obj,value:parseInt(xCoord)});}
82
+ if(typeof prop['chart.crosshairs.coords.formatter.y']==='function'){yCoord=(prop['chart.crosshairs.coords.formatter.y'])({object:obj,value:parseInt(yCoord)});}
83
+ div.innerHTML='<span style="color: #666">'+prop['chart.crosshairs.coords.labels.x']+':</span> '+xCoord+'<br><span style="color: #666">'+prop['chart.crosshairs.coords.labels.y']+':</span> '+yCoord;obj.canvas.addEventListener('mouseout',RG.hideCrosshairCoords,false);ca.__crosshairs_labels__=div;ca.__crosshairs_x__=xCoord;ca.__crosshairs_y__=yCoord;}else if(prop['chart.crosshairs.coords']){alert('[RGRAPH] Showing crosshair coordinates is only supported on the Scatter chart');}
84
+ RG.fireCustomEvent(obj,'oncrosshairs');}else{RG.hideCrosshairCoords();}};RG.allowSegmentHighlight=function(opt)
85
+ {var obj=opt.object,count=opt.count,fill=opt.fill,stroke=opt.stroke
86
+ if(!RG.segmentHighlightFunction){RG.segmentHighlightFunction=function(e)
87
+ {var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(obj.centerx,obj.centery,mouseXY[0],mouseXY[1]);angle+=RG.HALFPI;if(angle>RG.TWOPI){angle-=RG.TWOPI;}
88
+ RG.redraw();var start=0;var end=0;var a=(ma.PI*2)/count;var r=obj.radius;(function()
89
+ {for(i=0;i<count;i+=1){if(angle<(a*(i+1))){start=i*a;end=(i+1)*a;return;}}})();start-=RG.HALFPI;end-=RG.HALFPI;RG.path2(obj.context,'b m % % a % % % % % false c s % f %',obj.centerx,obj.centery,obj.centerx,obj.centery,r,start,end,stroke,fill);};obj.canvas.addEventListener('mousemove',RG.segmentHighlightFunction,false);}}})(window,document);