rgraph-rails 1.0.4 → 1.0.5
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.
- checksums.yaml +8 -8
- data/.travis.yml +1 -0
- data/README.md +2 -2
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/images/bullet.png +0 -0
- data/vendor/assets/images/facebook-large.png +0 -0
- data/vendor/assets/images/google-plus-large.png +0 -0
- data/vendor/assets/images/logo.png +0 -0
- data/vendor/assets/images/rgraph.jpg +0 -0
- data/vendor/assets/javascripts/RGraph.bar.js +533 -242
- data/vendor/assets/javascripts/RGraph.bipolar.js +152 -169
- data/vendor/assets/javascripts/RGraph.common.annotate.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.context.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.core.js +688 -373
- data/vendor/assets/javascripts/RGraph.common.csv.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +188 -193
- data/vendor/assets/javascripts/RGraph.common.effects.js +62 -38
- data/vendor/assets/javascripts/RGraph.common.key.js +35 -15
- data/vendor/assets/javascripts/RGraph.common.resizing.js +38 -21
- data/vendor/assets/javascripts/RGraph.common.sheets.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +48 -40
- data/vendor/assets/javascripts/RGraph.common.zoom.js +2 -2
- data/vendor/assets/javascripts/RGraph.drawing.background.js +33 -49
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +27 -30
- data/vendor/assets/javascripts/RGraph.drawing.image.js +23 -26
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +47 -40
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +38 -42
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +24 -28
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +25 -39
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +27 -32
- data/vendor/assets/javascripts/RGraph.drawing.text.js +53 -58
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +24 -29
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +45 -51
- data/vendor/assets/javascripts/RGraph.fuel.js +11 -9
- data/vendor/assets/javascripts/RGraph.funnel.js +40 -43
- data/vendor/assets/javascripts/RGraph.gantt.js +34 -34
- data/vendor/assets/javascripts/RGraph.gauge.js +64 -55
- data/vendor/assets/javascripts/RGraph.hbar.js +194 -137
- data/vendor/assets/javascripts/RGraph.hprogress.js +261 -167
- data/vendor/assets/javascripts/RGraph.line.js +520 -512
- data/vendor/assets/javascripts/RGraph.meter.js +11 -10
- data/vendor/assets/javascripts/RGraph.modaldialog.js +11 -2
- data/vendor/assets/javascripts/RGraph.odo.js +11 -9
- data/vendor/assets/javascripts/RGraph.pie.js +385 -100
- data/vendor/assets/javascripts/RGraph.radar.js +36 -29
- data/vendor/assets/javascripts/RGraph.rose.js +58 -41
- data/vendor/assets/javascripts/RGraph.rscatter.js +40 -36
- data/vendor/assets/javascripts/RGraph.scatter.js +441 -499
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1015 -0
- data/vendor/assets/javascripts/RGraph.thermometer.js +37 -37
- data/vendor/assets/javascripts/RGraph.vprogress.js +285 -157
- data/vendor/assets/javascripts/RGraph.waterfall.js +62 -62
- data/vendor/assets/stylesheets/website.css +30 -16
- metadata +3 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
9
|
* | v2.0 license and a commercial license which means that you're not bound by |
|
10
|
-
* | the terms of the GPL. The commercial license starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
9
|
* | v2.0 license and a commercial license which means that you're not bound by |
|
10
|
-
* | the terms of the GPL. The commercial license starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
9
|
* | v2.0 license and a commercial license which means that you're not bound by |
|
10
|
-
* | the terms of the GPL. The commercial license starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -32,28 +32,28 @@
|
|
32
32
|
/**
|
33
33
|
* This is the window click event listener. It redraws all canvas tags on the page.
|
34
34
|
*/
|
35
|
-
|
36
|
-
|
35
|
+
RG.installWindowMousedownListener =
|
36
|
+
RG.InstallWindowMousedownListener = function (obj)
|
37
37
|
{
|
38
|
-
if (!
|
38
|
+
if (!RG.window_mousedown_event_listener) {
|
39
39
|
|
40
|
-
|
40
|
+
RG.window_mousedown_event_listener = function (e)
|
41
41
|
{
|
42
42
|
/**
|
43
43
|
* For firefox add the window.event object
|
44
44
|
*/
|
45
45
|
if (navigator.userAgent.indexOf('Firefox') >= 0) win.event = e;
|
46
46
|
|
47
|
-
e =
|
47
|
+
e = RG.fixEventObject(e);
|
48
48
|
|
49
49
|
|
50
|
-
if (
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
if (RG.HideTooltip && RG.Registry.Get('chart.tooltip')) {
|
51
|
+
RG.clear(RG.Registry.Get('chart.tooltip').__canvas__);
|
52
|
+
RG.redraw();
|
53
|
+
RG.hideTooltip();
|
54
54
|
}
|
55
55
|
};
|
56
|
-
win.addEventListener('mousedown',
|
56
|
+
win.addEventListener('mousedown', RG.window_mousedown_event_listener, false);
|
57
57
|
}
|
58
58
|
};
|
59
59
|
|
@@ -63,46 +63,46 @@
|
|
63
63
|
/**
|
64
64
|
* This is the window click event listener. It redraws all canvas tags on the page.
|
65
65
|
*/
|
66
|
-
|
67
|
-
|
66
|
+
RG.installWindowMouseupListener =
|
67
|
+
RG.InstallWindowMouseupListener = function (obj)
|
68
68
|
{
|
69
|
-
if (!
|
70
|
-
|
69
|
+
if (!RG.window_mouseup_event_listener) {
|
70
|
+
RG.window_mouseup_event_listener = function (e)
|
71
71
|
{
|
72
72
|
/**
|
73
73
|
* For firefox add the window.event object
|
74
74
|
*/
|
75
75
|
if (navigator.userAgent.indexOf('Firefox') >= 0) win.event = e;
|
76
76
|
|
77
|
-
e =
|
77
|
+
e = RG.fixEventObject(e);
|
78
78
|
|
79
79
|
|
80
80
|
/**
|
81
81
|
* Stop any annotating that may be going on
|
82
82
|
*/
|
83
|
-
if (
|
84
|
-
|
83
|
+
if (RG.annotating_window_onmouseup) {
|
84
|
+
RG.annotating_window_onmouseup(e);
|
85
85
|
return;
|
86
86
|
}
|
87
87
|
|
88
88
|
/**
|
89
89
|
* End adjusting
|
90
90
|
*/
|
91
|
-
if (
|
91
|
+
if (RG.Registry.Get('chart.adjusting') || RG.Registry.Get('chart.adjusting.gantt')) {
|
92
92
|
|
93
|
-
var obj =
|
93
|
+
var obj = RG.Registry.Get('chart.adjusting');
|
94
94
|
|
95
95
|
// If it's a line chart update the data_arr variable
|
96
96
|
if (obj && obj.type === 'line') {
|
97
|
-
obj.data_arr =
|
97
|
+
obj.data_arr = RG.arrayLinearize(obj.data);
|
98
98
|
}
|
99
99
|
|
100
|
-
|
100
|
+
RG.fireCustomEvent(RG.Registry.Get('chart.adjusting'), 'onadjustend');
|
101
101
|
}
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
RG.Registry.set('chart.adjusting', null);
|
104
|
+
RG.Registry.set('chart.adjusting.shape', null);
|
105
|
+
RG.Registry.set('chart.adjusting.gantt', null);
|
106
106
|
|
107
107
|
|
108
108
|
// ==============================================
|
@@ -112,9 +112,9 @@
|
|
112
112
|
var tags = document.getElementsByTagName('canvas');
|
113
113
|
for (var i=0; i<tags.length; ++i) {
|
114
114
|
if (tags[i].__object__ && tags[i].__object__.isRGraph) {
|
115
|
-
if (!tags[i].__object__.
|
115
|
+
if (!tags[i].__object__.get('chart.annotatable')) {
|
116
116
|
if (!tags[i].__rgraph_trace_cover__ && !noredraw) {
|
117
|
-
|
117
|
+
RG.clear(tags[i]);
|
118
118
|
} else {
|
119
119
|
var noredraw = true;
|
120
120
|
}
|
@@ -123,10 +123,10 @@
|
|
123
123
|
}
|
124
124
|
|
125
125
|
if (!noredraw) {
|
126
|
-
|
126
|
+
RG.redraw();
|
127
127
|
}
|
128
128
|
};
|
129
|
-
win.addEventListener('mouseup',
|
129
|
+
win.addEventListener('mouseup', RG.window_mouseup_event_listener, false);
|
130
130
|
}
|
131
131
|
};
|
132
132
|
|
@@ -141,8 +141,8 @@
|
|
141
141
|
*
|
142
142
|
* RGraph.window_mouseup_event_listener
|
143
143
|
*/
|
144
|
-
|
145
|
-
|
144
|
+
RG.installCanvasMouseupListener =
|
145
|
+
RG.InstallCanvasMouseupListener = function (obj)
|
146
146
|
{
|
147
147
|
if (!obj.canvas.rgraph_mouseup_event_listener) {
|
148
148
|
obj.canvas.rgraph_mouseup_event_listener = function (e)
|
@@ -152,7 +152,7 @@
|
|
152
152
|
*/
|
153
153
|
if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
|
154
154
|
|
155
|
-
e =
|
155
|
+
e = RG.fixEventObject(e);
|
156
156
|
|
157
157
|
|
158
158
|
// *************************************************************************
|
@@ -162,14 +162,14 @@
|
|
162
162
|
|
163
163
|
// This causes things at the edge of the chart area - eg line chart hotspots - not to fire because the
|
164
164
|
// cursor is out of the chart area
|
165
|
-
var objects =
|
166
|
-
//var objects =
|
165
|
+
var objects = RG.ObjectRegistry.getObjectsByXY(e);
|
166
|
+
//var objects = RG.ObjectRegistry.getObjectsByCanvasID(e.target.id);
|
167
167
|
|
168
168
|
if (objects) {
|
169
169
|
for (var i=0,len=objects.length; i<len; i+=1) {
|
170
170
|
|
171
|
-
var obj = objects[i]
|
172
|
-
|
171
|
+
var obj = objects[i],
|
172
|
+
id = objects[i].id;
|
173
173
|
|
174
174
|
|
175
175
|
// =========================================================================
|
@@ -179,8 +179,8 @@
|
|
179
179
|
|
180
180
|
if (obj.type == 'drawing.text' && typeof link === 'string') {
|
181
181
|
|
182
|
-
var link_target = obj.
|
183
|
-
var link_options = obj.
|
182
|
+
var link_target = obj.get('link.target');
|
183
|
+
var link_options = obj.get('link.options');
|
184
184
|
|
185
185
|
window.open(link, link_target ? link_target : null, link_options);
|
186
186
|
}
|
@@ -205,10 +205,10 @@
|
|
205
205
|
|
206
206
|
if ( type == 'line'
|
207
207
|
|| type == 'rscatter'
|
208
|
-
|| (type == 'scatter' && !obj.
|
208
|
+
|| (type == 'scatter' && !obj.get('chart.boxplot'))
|
209
209
|
|| type == 'radar') {
|
210
210
|
|
211
|
-
var canvasXY =
|
211
|
+
var canvasXY = RG.getCanvasXY(obj.canvas);
|
212
212
|
var x = canvasXY[0] + shape['x'];
|
213
213
|
var y = canvasXY[1] + shape['y'];
|
214
214
|
|
@@ -217,18 +217,18 @@
|
|
217
217
|
var y = e.pageY;
|
218
218
|
}
|
219
219
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
220
|
+
RG.clear(obj.canvas);
|
221
|
+
RG.redraw();
|
222
|
+
RG.Registry.set('chart.tooltip.shape', shape);
|
223
|
+
RG.tooltip(obj, text, x, y, shape['index'], e);
|
224
|
+
obj.highlight(shape);
|
225
225
|
|
226
226
|
// Add the shape that triggered the tooltip
|
227
|
-
if (
|
227
|
+
if (RG.Registry.get('chart.tooltip')) {
|
228
228
|
|
229
|
-
|
229
|
+
RG.Registry.get('chart.tooltip').__shape__ = shape;
|
230
230
|
|
231
|
-
|
231
|
+
RG.evaluateCursor(e);
|
232
232
|
}
|
233
233
|
|
234
234
|
e.cancelBubble = true;
|
@@ -248,21 +248,21 @@
|
|
248
248
|
|
249
249
|
|
250
250
|
|
251
|
-
if (
|
251
|
+
if (RG.Registry.get('chart.adjusting') || RG.Registry.get('chart.adjusting.gantt')) {
|
252
252
|
|
253
|
-
//var obj =
|
253
|
+
//var obj = RG.Registry.get('chart.adjusting');
|
254
254
|
|
255
255
|
// If it's a line chart update the data_arr variable
|
256
256
|
if (obj && obj.type === 'line') {
|
257
|
-
obj.data_arr =
|
257
|
+
obj.data_arr = RG.arrayLinearize(obj.data);
|
258
258
|
}
|
259
259
|
|
260
|
-
|
260
|
+
RG.fireCustomEvent(RG.Registry.get('chart.adjusting'), 'onadjustend');
|
261
261
|
}
|
262
262
|
|
263
|
-
|
264
|
-
|
265
|
-
|
263
|
+
RG.Registry.set('chart.adjusting', null);
|
264
|
+
RG.Registry.set('chart.adjusting.shape', null);
|
265
|
+
RG.Registry.set('chart.adjusting.gantt', null);
|
266
266
|
|
267
267
|
/**
|
268
268
|
* If the mouse pointer is over a "front" chart this prevents charts behind it
|
@@ -286,8 +286,8 @@
|
|
286
286
|
*
|
287
287
|
* @param object obj The chart object
|
288
288
|
*/
|
289
|
-
|
290
|
-
|
289
|
+
RG.installCanvasMousemoveListener =
|
290
|
+
RG.InstallCanvasMousemoveListener = function (obj)
|
291
291
|
{
|
292
292
|
if (!obj.canvas.rgraph_mousemove_event_listener) {
|
293
293
|
obj.canvas.rgraph_mousemove_event_listener = function (e)
|
@@ -296,7 +296,7 @@
|
|
296
296
|
* For firefox add the window.event object
|
297
297
|
*/
|
298
298
|
if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
|
299
|
-
e =
|
299
|
+
e = RG.fixEventObject(e);
|
300
300
|
|
301
301
|
|
302
302
|
|
@@ -304,12 +304,12 @@
|
|
304
304
|
/**
|
305
305
|
* Go through all the objects and check them to see if anything needs doing
|
306
306
|
*/
|
307
|
-
var objects =
|
308
|
-
//var objects =
|
307
|
+
var objects = RG.ObjectRegistry.getObjectsByXY(e);
|
308
|
+
//var objects = RG.ObjectRegistry.getObjectsByCanvasID(e.target.id);
|
309
309
|
|
310
310
|
if (objects && objects.length > 0) {
|
311
311
|
for (var i=0,len=objects.length; i<len; i+=1) {
|
312
|
-
|
312
|
+
|
313
313
|
var obj = objects[i];
|
314
314
|
var id = obj.id;
|
315
315
|
|
@@ -365,7 +365,7 @@
|
|
365
365
|
if (!func && typeof obj.onmousemove == 'function') {
|
366
366
|
var func = obj.onmousemove;
|
367
367
|
}
|
368
|
-
|
368
|
+
|
369
369
|
/**
|
370
370
|
*
|
371
371
|
*/
|
@@ -375,43 +375,50 @@
|
|
375
375
|
var func2 = obj['$' + index].onmousemove;
|
376
376
|
}
|
377
377
|
}
|
378
|
-
|
378
|
+
|
379
379
|
/**
|
380
380
|
* This bit saves the current pointer style if there isn't one already saved
|
381
381
|
*/
|
382
382
|
if (shape && (typeof(func) == 'function' || typeof(func2) == 'function' || typeof obj.Get('link') === 'string')) {
|
383
|
-
|
383
|
+
|
384
384
|
if (obj.Get('chart.events.mousemove.revertto') == null) {
|
385
385
|
obj.Set('chart.events.mousemove.revertto', e.target.style.cursor);
|
386
386
|
}
|
387
|
-
|
388
|
-
if (typeof(func) == 'function') func(e, shape);
|
389
|
-
if (typeof(func2) == 'function') func2(e, shape);
|
390
387
|
|
391
|
-
|
388
|
+
if (typeof(func) == 'function') RGraph.custom_events_mousemove_pointer = func(e, shape);
|
389
|
+
if (typeof(func2) == 'function') RGraph.custom_events_mousemove_pointer = RGraph.custom_events_mousemove_pointer || func2(e, shape);
|
390
|
+
|
391
|
+
|
392
392
|
//return;
|
393
393
|
|
394
394
|
} else if (typeof(obj.Get('chart.events.mousemove.revertto')) == 'string') {
|
395
395
|
|
396
|
-
|
396
|
+
RG.cursor.push('default');
|
397
397
|
obj.Set('chart.events.mousemove.revertto', null);
|
398
398
|
}
|
399
399
|
|
400
|
-
|
400
|
+
|
401
401
|
|
402
402
|
// ================================================================================================ //
|
403
403
|
// Tooltips
|
404
404
|
// ================================================================================================ //
|
405
|
-
|
405
|
+
var current_tooltip = RG.Registry.get('chart.tooltip');
|
406
|
+
var tooltips = obj.get('chart.tooltips');
|
407
|
+
var tooltips_event = obj.Get('chart.tooltips.event');
|
406
408
|
|
407
409
|
if ( shape
|
408
|
-
&& (
|
409
|
-
&&
|
410
|
-
&& (
|
410
|
+
&& (tooltips && tooltips[shape['index']] || shape['tooltip'])
|
411
|
+
&& tooltips_event.indexOf('mousemove') > 0
|
412
|
+
&& ( RG.isNull(current_tooltip) // Is there a tooltip being shown?
|
413
|
+
|| obj.uid != current_tooltip.__object__.uid // Same object?
|
414
|
+
|| (current_tooltip.__index__ != shape['index']) // Same tooltip index?
|
415
|
+
|| (typeof shape['dataset'] === 'number' && shape['dataset'] != current_tooltip.__shape__['dataset'])
|
416
|
+
)
|
411
417
|
) {
|
412
418
|
|
413
|
-
|
414
|
-
|
419
|
+
RG.clear(obj.canvas);
|
420
|
+
RG.hideTooltip();
|
421
|
+
RG.redraw();
|
415
422
|
obj.canvas.rgraph_mouseup_event_listener(e);
|
416
423
|
|
417
424
|
return;
|
@@ -423,7 +430,7 @@
|
|
423
430
|
// ================================================================================================ //
|
424
431
|
|
425
432
|
|
426
|
-
if (obj && obj.
|
433
|
+
if (obj && obj.get('chart.adjustable')) {
|
427
434
|
obj.Adjusting_mousemove(e);
|
428
435
|
}
|
429
436
|
|
@@ -443,8 +450,8 @@
|
|
443
450
|
// ================================================================================================ //
|
444
451
|
|
445
452
|
|
446
|
-
if (e.target && e.target.__object__ && e.target.__object__.
|
447
|
-
|
453
|
+
if (e.target && e.target.__object__ && e.target.__object__.get('chart.crosshairs')) {
|
454
|
+
RG.drawCrosshairs(e, e.target.__object__);
|
448
455
|
}
|
449
456
|
|
450
457
|
|
@@ -462,8 +469,8 @@
|
|
462
469
|
// ================================================================================================ //
|
463
470
|
|
464
471
|
|
465
|
-
if (e.target.__object__ && e.target.__object__.
|
466
|
-
|
472
|
+
if (e.target.__object__ && e.target.__object__.get('chart.annotatable') && RG.annotating_canvas_onmousemove) {
|
473
|
+
RG.annotating_canvas_onmousemove(e);
|
467
474
|
}
|
468
475
|
|
469
476
|
|
@@ -471,7 +478,7 @@
|
|
471
478
|
/**
|
472
479
|
* Determine the pointer
|
473
480
|
*/
|
474
|
-
|
481
|
+
RG.evaluateCursor(e);
|
475
482
|
};
|
476
483
|
obj.canvas.addEventListener('mousemove', obj.canvas.rgraph_mousemove_event_listener, false);
|
477
484
|
}
|
@@ -485,8 +492,8 @@
|
|
485
492
|
*
|
486
493
|
* @param object obj The chart object
|
487
494
|
*/
|
488
|
-
|
489
|
-
|
495
|
+
RG.installCanvasMousedownListener =
|
496
|
+
RG.InstallCanvasMousedownListener = function (obj)
|
490
497
|
{
|
491
498
|
if (!obj.canvas.rgraph_mousedown_event_listener) {
|
492
499
|
obj.canvas.rgraph_mousedown_event_listener = function (e)
|
@@ -502,8 +509,8 @@
|
|
502
509
|
/**
|
503
510
|
* Annotating
|
504
511
|
*/
|
505
|
-
if (e.target.__object__ && e.target.__object__.
|
506
|
-
|
512
|
+
if (e.target.__object__ && e.target.__object__.get('chart.annotatable') && RG.annotating_canvas_onmousedown) {
|
513
|
+
RG.annotating_canvas_onmousedown(e);
|
507
514
|
return;
|
508
515
|
}
|
509
516
|
|
@@ -518,12 +525,12 @@
|
|
518
525
|
/*************************************************************
|
519
526
|
* Handle adjusting for all object types
|
520
527
|
*************************************************************/
|
521
|
-
if (obj && obj.isRGraph && obj.
|
528
|
+
if (obj && obj.isRGraph && obj.get('chart.adjustable')) {
|
522
529
|
|
523
530
|
/**
|
524
531
|
* Check the cursor is in the correct area
|
525
532
|
*/
|
526
|
-
var obj =
|
533
|
+
var obj = RG.ObjectRegistry.getObjectByXY(e);
|
527
534
|
|
528
535
|
if (obj && obj.isRGraph) {
|
529
536
|
|
@@ -534,7 +541,7 @@
|
|
534
541
|
var shape = obj.getShape(e);
|
535
542
|
if (shape) {
|
536
543
|
var mouseXY = RG.getMouseXY(e);
|
537
|
-
RG.Registry.
|
544
|
+
RG.Registry.set('chart.adjusting.gantt', {
|
538
545
|
'index': shape['index'],
|
539
546
|
'object': obj,
|
540
547
|
'mousex': mouseXY[0],
|
@@ -550,18 +557,18 @@
|
|
550
557
|
default: var shape = null;
|
551
558
|
}
|
552
559
|
|
553
|
-
RG.Registry.
|
560
|
+
RG.Registry.set('chart.adjusting.shape', shape);
|
554
561
|
|
555
562
|
|
556
563
|
// Fire the onadjustbegin event
|
557
|
-
|
564
|
+
RG.fireCustomEvent(obj, 'onadjustbegin');
|
558
565
|
|
559
|
-
RG.Registry.
|
566
|
+
RG.Registry.set('chart.adjusting', obj);
|
560
567
|
|
561
568
|
|
562
569
|
// Liberally redraw the canvas
|
563
|
-
|
564
|
-
|
570
|
+
RG.clear(obj.canvas);
|
571
|
+
RG.redraw();
|
565
572
|
|
566
573
|
// Call the mousemove event listener so that the canvas
|
567
574
|
// is adjusted even though the mouse isn't moved
|
@@ -570,8 +577,8 @@
|
|
570
577
|
}
|
571
578
|
|
572
579
|
|
573
|
-
|
574
|
-
|
580
|
+
RG.clear(obj.canvas);
|
581
|
+
RG.redraw();
|
575
582
|
}
|
576
583
|
};
|
577
584
|
obj.canvas.addEventListener('mousedown', obj.canvas.rgraph_mousedown_event_listener, false);
|
@@ -586,8 +593,8 @@
|
|
586
593
|
*
|
587
594
|
* @param object obj The chart object
|
588
595
|
*/
|
589
|
-
|
590
|
-
|
596
|
+
RG.installCanvasClickListener =
|
597
|
+
RG.InstallCanvasClickListener = function (obj)
|
591
598
|
{
|
592
599
|
if (!obj.canvas.rgraph_click_event_listener) {
|
593
600
|
obj.canvas.rgraph_click_event_listener = function (e)
|
@@ -597,7 +604,7 @@
|
|
597
604
|
*/
|
598
605
|
if (navigator.userAgent.indexOf('Firefox') >= 0) window.event = e;
|
599
606
|
|
600
|
-
e = RG.
|
607
|
+
e = RG.fixEventObject(e);
|
601
608
|
|
602
609
|
var objects = RG.ObjectRegistry.getObjectsByXY(e);
|
603
610
|
|
@@ -610,7 +617,7 @@
|
|
610
617
|
/**
|
611
618
|
* This bit saves the current pointer style if there isn't one already saved
|
612
619
|
*/
|
613
|
-
var func = obj.
|
620
|
+
var func = obj.get('chart.events.click');
|
614
621
|
|
615
622
|
if (!func && typeof(obj.onclick) == 'function') {
|
616
623
|
func = obj.onclick;
|
@@ -686,12 +693,12 @@
|
|
686
693
|
/**
|
687
694
|
* This function evaluates the various cursor settings and if there's one for pointer, changes it to that
|
688
695
|
*/
|
689
|
-
//
|
690
|
-
|
691
|
-
|
696
|
+
//RG.evaluateCursor =
|
697
|
+
RG.evaluateCursor =
|
698
|
+
RG.EvaluateCursor = function (e)
|
692
699
|
{
|
693
700
|
var obj = null;
|
694
|
-
var mouseXY =
|
701
|
+
var mouseXY = RG.getMouseXY(e);
|
695
702
|
var mouseX = mouseXY[0];
|
696
703
|
var mouseY = mouseXY[1];
|
697
704
|
var canvas = e.target;
|
@@ -699,7 +706,7 @@
|
|
699
706
|
/**
|
700
707
|
* Tooltips cause the mouse pointer to change
|
701
708
|
*/
|
702
|
-
var objects =
|
709
|
+
var objects = RG.ObjectRegistry.getObjectsByCanvasID(canvas.id);
|
703
710
|
|
704
711
|
for (var i=0,len=objects.length; i<len; i+=1) {
|
705
712
|
if ((objects[i].getShape && objects[i].getShape(e)) || (objects[i].overChartArea && objects[i].overChartArea(e))) {
|
@@ -708,17 +715,17 @@
|
|
708
715
|
}
|
709
716
|
}
|
710
717
|
|
711
|
-
if (!
|
718
|
+
if (!RG.isNull(obj)) {
|
712
719
|
if (obj.getShape && obj.getShape(e)) {
|
713
720
|
|
714
721
|
var shape = obj.getShape(e);
|
715
722
|
|
716
|
-
if (obj.
|
723
|
+
if (obj.get('chart.tooltips')) {
|
717
724
|
|
718
|
-
var text =
|
725
|
+
var text = RG.parseTooltipText(obj.get('chart.tooltips'), shape['index']);
|
719
726
|
|
720
727
|
if (!text && shape['object'].type == 'scatter' && shape['index_adjusted']) {
|
721
|
-
text =
|
728
|
+
text = RG.parseTooltipText(obj.get('chart.tooltips'), shape['index_adjusted']);
|
722
729
|
}
|
723
730
|
|
724
731
|
/**
|
@@ -733,7 +740,7 @@
|
|
733
740
|
/**
|
734
741
|
* Now go through the key coords and see if it's over that.
|
735
742
|
*/
|
736
|
-
if (!
|
743
|
+
if (!RG.isNull(obj) && obj.Get('chart.key.interactive')) {
|
737
744
|
for (var j=0; j<obj.coords.key.length; ++j) {
|
738
745
|
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])) {
|
739
746
|
var pointer = true;
|
@@ -743,37 +750,30 @@
|
|
743
750
|
}
|
744
751
|
|
745
752
|
/**
|
746
|
-
* It can be specified in the user mousemove event - remember it can now
|
753
|
+
* It can be specified in the user mousemove event - remember it can now
|
754
|
+
* be specified in THREE ways
|
747
755
|
*/
|
748
|
-
if (
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
var pointer = true;
|
754
|
-
}
|
755
|
-
}
|
756
|
+
if (RGraph.custom_events_mousemove_pointer) {
|
757
|
+
var pointer = true;
|
758
|
+
RGraph.custom_events_mousemove_pointer = false;
|
759
|
+
}
|
760
|
+
/*
|
756
761
|
|
757
|
-
if (!RGraph.is_null(obj.onmousemove) && typeof(obj.onmousemove) == 'function') {
|
758
|
-
var str = (obj.onmousemove).toString();
|
759
|
-
if (str.match(/pointer/) && str.match(/cursor/) && str.match(/style/)) {
|
760
|
-
var pointer = true;
|
761
|
-
}
|
762
|
-
}
|
763
762
|
|
764
763
|
var index = shape['object'].type == 'scatter' ? shape['index_adjusted'] : shape['index'];
|
765
|
-
if (!
|
764
|
+
if (!RG.isNull(obj['$' + index]) && typeof(obj['$' + index].onmousemove) == 'function') {
|
766
765
|
var str = (obj['$' + index].onmousemove).toString();
|
767
766
|
if (str.match(/pointer/) && str.match(/cursor/) && str.match(/style/)) {
|
768
767
|
var pointer = true;
|
769
768
|
}
|
770
769
|
}
|
771
770
|
}
|
771
|
+
*/
|
772
772
|
|
773
773
|
/**
|
774
774
|
* Is the chart resizable? Go through all the objects again
|
775
775
|
*/
|
776
|
-
var objects =
|
776
|
+
var objects = RG.ObjectRegistry.objects.byCanvasID;
|
777
777
|
|
778
778
|
for (var i=0,len=objects.length; i<len; i+=1) {
|
779
779
|
if (objects[i] && objects[i][1].Get('chart.resizable')) {
|
@@ -824,7 +824,7 @@
|
|
824
824
|
// Gantt chart adjusting
|
825
825
|
// =========================================================================
|
826
826
|
|
827
|
-
//if (obj && obj.type == 'gantt' && obj.
|
827
|
+
//if (obj && obj.type == 'gantt' && obj.get('chart.adjustable')) {
|
828
828
|
// if (obj.getShape && obj.getShape(e)) {
|
829
829
|
// e.target.style.cursor = 'ew-resize';
|
830
830
|
// } else {
|
@@ -840,7 +840,7 @@
|
|
840
840
|
// =========================================================================
|
841
841
|
|
842
842
|
|
843
|
-
if (obj && obj.type == 'line' && obj.
|
843
|
+
if (obj && obj.type == 'line' && obj.get('chart.adjustable')) {
|
844
844
|
if (obj.getShape && obj.getShape(e)) {
|
845
845
|
e.target.style.cursor = 'ns-resize';
|
846
846
|
} else {
|
@@ -854,7 +854,7 @@
|
|
854
854
|
// =========================================================================
|
855
855
|
|
856
856
|
|
857
|
-
if (e.target.__object__ && e.target.__object__.
|
857
|
+
if (e.target.__object__ && e.target.__object__.get('chart.annotatable')) {
|
858
858
|
e.target.style.cursor = 'crosshair';
|
859
859
|
}
|
860
860
|
|
@@ -864,7 +864,7 @@
|
|
864
864
|
// =========================================================================
|
865
865
|
|
866
866
|
|
867
|
-
if (obj && obj.type === 'drawing.text' && shape && typeof obj.
|
867
|
+
if (obj && obj.type === 'drawing.text' && shape && typeof obj.get('link') === 'string') {
|
868
868
|
e.target.style.cursor = 'pointer';
|
869
869
|
}
|
870
870
|
};
|
@@ -879,7 +879,7 @@
|
|
879
879
|
* the return value is used as the tooltip text
|
880
880
|
* @param numbr idx The index of the tooltip.
|
881
881
|
*/
|
882
|
-
|
882
|
+
RG.parseTooltipText = function (tooltips, idx)
|
883
883
|
{
|
884
884
|
// No tooltips
|
885
885
|
if (!tooltips) {
|
@@ -911,7 +911,7 @@
|
|
911
911
|
}
|
912
912
|
|
913
913
|
// Conditional in case the tooltip file isn't included
|
914
|
-
return
|
914
|
+
return RG.getTooltipTextFromDIV ? RG.getTooltipTextFromDIV(text) : text;
|
915
915
|
};
|
916
916
|
|
917
917
|
|
@@ -922,25 +922,25 @@
|
|
922
922
|
*
|
923
923
|
* @param object obj The graph object (from which we can get the context and canvas as required)
|
924
924
|
*/
|
925
|
-
|
926
|
-
|
925
|
+
RG.drawCrosshairs =
|
926
|
+
RG.DrawCrosshairs = function (e, obj)
|
927
927
|
{
|
928
|
-
var e =
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
928
|
+
var e = RG.fixEventObject(e),
|
929
|
+
width = obj.canvas.width,
|
930
|
+
height = obj.canvas.height,
|
931
|
+
mouseXY = RG.getMouseXY(e),
|
932
|
+
x = mouseXY[0],
|
933
|
+
y = mouseXY[1],
|
934
|
+
gutterLeft = obj.gutterLeft,
|
935
|
+
gutterRight = obj.gutterRight,
|
936
|
+
gutterTop = obj.gutterTop,
|
937
|
+
gutterBottom = obj.gutterBottom,
|
938
|
+
Mathround = Math.round,
|
939
|
+
prop = obj.properties,
|
940
|
+
co = obj.context,
|
941
|
+
ca = obj.canvas
|
942
|
+
|
943
|
+
RG.redrawCanvas(ca);
|
944
944
|
|
945
945
|
if ( x >= gutterLeft
|
946
946
|
&& y >= gutterTop
|
@@ -972,7 +972,7 @@
|
|
972
972
|
|
973
973
|
for (var i=0; i<obj.coords.length; ++i) {
|
974
974
|
|
975
|
-
var length =
|
975
|
+
var length = RG.getHypLength(obj.coords[i][0], obj.coords[i][1], x, y);
|
976
976
|
|
977
977
|
// Check the mouse X coordinate
|
978
978
|
if (typeof dist != 'number' || length < dist) {
|
@@ -1000,7 +1000,7 @@
|
|
1000
1000
|
for (var j=0; j<obj.coords[i].length; ++j) {
|
1001
1001
|
|
1002
1002
|
// Check the mouse X coordinate
|
1003
|
-
var len =
|
1003
|
+
var len = RG.getHypLength(obj.coords[i][j][0], obj.coords[i][j][1], x, y);
|
1004
1004
|
|
1005
1005
|
if (typeof(dist) != 'number' || len < dist) {
|
1006
1006
|
|
@@ -1055,26 +1055,26 @@
|
|
1055
1055
|
|
1056
1056
|
yCoord = yCoord.toFixed(prop['chart.scale.decimals']);
|
1057
1057
|
|
1058
|
-
var div =
|
1059
|
-
var mouseXY =
|
1060
|
-
var canvasXY =
|
1058
|
+
var div = RG.Registry.get('chart.coordinates.coords.div');
|
1059
|
+
var mouseXY = RG.getMouseXY(e);
|
1060
|
+
var canvasXY = RG.getCanvasXY(ca);
|
1061
1061
|
|
1062
1062
|
if (!div) {
|
1063
1063
|
var div = document.createElement('DIV');
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1064
|
+
div.__object__ = obj;
|
1065
|
+
div.style.position = 'absolute';
|
1066
|
+
div.style.backgroundColor = 'white';
|
1067
|
+
div.style.border = '1px solid black';
|
1068
|
+
div.style.fontFamily = 'Arial, Verdana, sans-serif';
|
1069
|
+
div.style.fontSize = '10pt'
|
1070
|
+
div.style.padding = '2px';
|
1071
|
+
div.style.opacity = 1;
|
1072
|
+
div.style.WebkitBorderRadius = '3px';
|
1073
|
+
div.style.borderRadius = '3px';
|
1074
|
+
div.style.MozBorderRadius = '3px';
|
1075
1075
|
document.body.appendChild(div);
|
1076
1076
|
|
1077
|
-
|
1077
|
+
RG.Registry.set('chart.coordinates.coords.div', div);
|
1078
1078
|
}
|
1079
1079
|
|
1080
1080
|
// Convert the X/Y pixel coords to correspond to the scale
|
@@ -1082,8 +1082,8 @@
|
|
1082
1082
|
div.style.display = 'inline';
|
1083
1083
|
|
1084
1084
|
if (!prop['chart.crosshairs.coords.fixed']) {
|
1085
|
-
div.style.left =
|
1086
|
-
div.style.top =
|
1085
|
+
div.style.left = ma.max(2, (e.pageX - div.offsetWidth - 3)) + 'px';
|
1086
|
+
div.style.top = ma.max(2, (e.pageY - div.offsetHeight - 3)) + 'px';
|
1087
1087
|
} else {
|
1088
1088
|
div.style.left = canvasXY[0] + gutterLeft + 3 + 'px';
|
1089
1089
|
div.style.top = canvasXY[1] + gutterTop + 3 + 'px';
|
@@ -1091,7 +1091,7 @@
|
|
1091
1091
|
|
1092
1092
|
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;
|
1093
1093
|
|
1094
|
-
obj.canvas.addEventListener('mouseout',
|
1094
|
+
obj.canvas.addEventListener('mouseout', RG.hideCrosshairCoords, false);
|
1095
1095
|
|
1096
1096
|
ca.__crosshairs_labels__ = div;
|
1097
1097
|
ca.__crosshairs_x__ = xCoord;
|
@@ -1104,10 +1104,10 @@
|
|
1104
1104
|
/**
|
1105
1105
|
* Fire the oncrosshairs custom event
|
1106
1106
|
*/
|
1107
|
-
|
1107
|
+
RG.fireCustomEvent(obj, 'oncrosshairs');
|
1108
1108
|
|
1109
1109
|
} else {
|
1110
|
-
|
1110
|
+
RG.hideCrosshairCoords();
|
1111
1111
|
}
|
1112
1112
|
};
|
1113
1113
|
|
@@ -1122,14 +1122,14 @@
|
|
1122
1122
|
//
|
1123
1123
|
RG.allowSegmentHighlight = function (opt)
|
1124
1124
|
{
|
1125
|
-
var obj = opt.object
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1125
|
+
var obj = opt.object,
|
1126
|
+
count = opt.count,
|
1127
|
+
fill = opt.fill,
|
1128
|
+
stroke = opt.stroke
|
1129
1129
|
|
1130
|
-
if (!
|
1130
|
+
if (!RG.segmentHighlightFunction) {
|
1131
1131
|
|
1132
|
-
|
1132
|
+
RG.segmentHighlightFunction = function (e)
|
1133
1133
|
{
|
1134
1134
|
|
1135
1135
|
var mouseXY = RG.getMouseXY(e);
|
@@ -1169,19 +1169,14 @@
|
|
1169
1169
|
end -= RG.HALFPI;
|
1170
1170
|
|
1171
1171
|
|
1172
|
-
RG.
|
1173
|
-
|
1174
|
-
'm
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
false,
|
1181
|
-
'c',
|
1182
|
-
's', stroke,
|
1183
|
-
'f', fill
|
1184
|
-
]);
|
1172
|
+
RG.path2(
|
1173
|
+
obj.context,
|
1174
|
+
'b m % % a % % % % % false c s % f %',
|
1175
|
+
obj.centerx, obj.centery,
|
1176
|
+
obj.centerx,obj.centery,r,start,end,
|
1177
|
+
stroke,
|
1178
|
+
fill
|
1179
|
+
);
|
1185
1180
|
|
1186
1181
|
};
|
1187
1182
|
obj.canvas.addEventListener('mousemove', RG.segmentHighlightFunction, false);
|