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,564 +1,38 @@
1
- // version: 2017-05-08
2
- /**
3
- * o--------------------------------------------------------------------------------o
4
- * | This file is part of the RGraph package - you can learn more at: |
5
- * | |
6
- * | http://www.rgraph.net |
7
- * | |
8
- * | RGraph is licensed under the Open Source MIT license. That means that it's |
9
- * | totally free to use! |
10
- * o--------------------------------------------------------------------------------o
11
- */
12
1
 
13
- RGraph = window.RGraph || {isRGraph: true};
14
-
15
- // Module pattern
16
- (function (win, doc, undefined)
17
- {
18
- var RG = RGraph,
19
- ua = navigator.userAgent,
20
- ma = Math,
21
- active = null;
22
-
23
-
24
- /**
25
- * This function can be used to allow resizing
26
- *
27
- * @param object obj Your graph object
28
- */
29
- RGraph.allowResizing =
30
- RGraph.AllowResizing = function (obj)
31
- {
32
- var ca = obj.canvas,
33
- co = obj.context,
34
- pa2 = RG.path2;
35
-
36
- ca.resizing = ca.resizing || {};
37
- ca.resizing.placeHolders = ca.resizing.placeHolders || [];
38
-
39
- /**
40
- * Store the original width/height on the canvas
41
- */
42
- if (!ca.resizing.originalw) { ca.resizing.originalw = ca.width; }
43
- if (!ca.resizing.originalh) { ca.resizing.originalh = ca.height; }
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
- // The size of the resize handle (so '15' isn't littered throughout the code)
58
- var resizeHandleSize = 15;
59
-
60
-
61
- // Add the original width and height to the canvas
62
- if ( !ca.resizing.__rgraph_original_width__
63
- || !ca.resizing.__rgraph_original_height__
64
- || !ca.resizing.__adjustX
65
- || !ca.resizing.__adjustY
66
- ) {
67
-
68
- ca.resizing.__rgraph_original_width__ = ca.width;
69
- ca.resizing.__rgraph_original_height__ = ca.height;
70
- ca.resizing.adjustX = (typeof obj.get('chart.resize.handle.adjust') == 'object' && typeof obj.get('chart.resize.handle.adjust')[0] == 'number' ? obj.Get('chart.resize.handle.adjust')[0] : 0);
71
- ca.resizing.adjustY = (typeof obj.get('chart.resize.handle.adjust') == 'object' && typeof obj.get('chart.resize.handle.adjust')[1] == 'number' ? obj.Get('chart.resize.handle.adjust')[1] : 0);
72
- ca.resizing.bgcolor = obj.get('chart.resize.handle.background') || 'rgba(0,0,0,0)';
73
- }
74
-
75
-
76
-
77
-
78
- // Draw the resize handle
79
- pa2(co,
80
- 'b m % % r % % % % f %',
81
- ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX, ca.height - resizeHandleSize,
82
- ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX, ca.height - resizeHandleSize + ca.resizing.adjustY, 2 * resizeHandleSize, resizeHandleSize,
83
- ca.resizing.bgcolor
84
- );
85
-
86
- // Draw the arrows
87
- pa2(co,
88
- 'b lw 1 m % % l % % m % % l % % s gray f transparent',
89
- ma.round(ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX), ca.height - resizeHandleSize + ca.resizing.adjustY,
90
- ma.round(ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX), ca.height + ca.resizing.adjustY,
91
- ca.width + ca.resizing.adjustX, ma.round(ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY),
92
- ca.width - resizeHandleSize + ca.resizing.adjustX, ma.round(ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY)
93
- );
94
-
95
- // Top arrow head
96
- pa2(co, [ 'b', 'm', ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX, ca.height - resizeHandleSize + ca.resizing.adjustY, 'l',ca.width - (resizeHandleSize / 2) + 3 + ca.resizing.adjustX, ca.height - resizeHandleSize + 3 + ca.resizing.adjustY, 'l',ca.width - (resizeHandleSize / 2) - 3 + ca.resizing.adjustX, ca.height - resizeHandleSize + 3 + ca.resizing.adjustY, 'c', 'f','gray']);
97
-
98
- // Bottom arrow head
99
- pa2(co, ['b','m', ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX, ca.height + ca.resizing.adjustY,'l', ca.width - (resizeHandleSize / 2) + 3 + ca.resizing.adjustX, ca.height - 3 + ca.resizing.adjustY,'l', ca.width - (resizeHandleSize / 2) - 3 + ca.resizing.adjustX, ca.height - 3 + ca.resizing.adjustY,'c','f', 'gray']);
100
-
101
- // Left arrow head
102
- pa2(co, ['b','m', ca.width - resizeHandleSize + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'l', ca.width - resizeHandleSize + 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + 3 + ca.resizing.adjustY,'l', ca.width - resizeHandleSize + 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 3 + ca.resizing.adjustY,'c','f', 'gray']);
103
-
104
- // Right arrow head
105
- pa2(co, ['b','m',ca.width + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'l',ca.width - 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + 3 + ca.resizing.adjustY,'l',ca.width - 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 3 + ca.resizing.adjustY,'c','f', 'gray']);
106
-
107
- // Square at the centre of the arrows
108
- pa2(co, ['b','m',ca.width + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'r',ca.width - (resizeHandleSize / 2) - 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 2 + ca.resizing.adjustY, 4, 4,'r',ca.width - (resizeHandleSize / 2) - 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 2 + ca.resizing.adjustY, 4, 4,'s','gray','f','white']);
109
-
110
- // Draw the "Reset" button
111
- pa2(co, ['b','m',ma.round(ca.width - resizeHandleSize - 3 + ca.resizing.adjustX), ca.height - resizeHandleSize / 2 + ca.resizing.adjustY,'l',ma.round(ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX), ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'l',ca.width - resizeHandleSize - resizeHandleSize + 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 2 + ca.resizing.adjustY,'l',ca.width - resizeHandleSize - resizeHandleSize + 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + 2 + ca.resizing.adjustY,'l',ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'s','gray','f','gray']);
112
-
113
- // The vertical line at the end of the reset button
114
- pa2(co, ['b','m', ma.round(ca.width - resizeHandleSize - resizeHandleSize - 1 + ca.resizing.adjustX), ca.height - (resizeHandleSize / 2) - 3 + ca.resizing.adjustY,'l', ma.round(ca.width - resizeHandleSize - resizeHandleSize - 1 + ca.resizing.adjustX), ca.height - (resizeHandleSize / 2) + 3 + ca.resizing.adjustY,'s','f']);
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
- /**
123
- * The code inside this if() condition only runs once due to the if() condition tests- if
124
- * the obj.rgraphResizewrapper variable exists then the code has run
125
- */
126
- if (obj.get('chart.resizable') && !ca.rgraphResizewrapper) {
127
-
128
-
129
-
130
- // ** TODO ** Needs fixing
131
- //
132
- //
133
- // Wrap the canvas
134
- // ** NEEDS FIXING **
135
- //
136
- ca.rgraphResizewrapper = $('<div id="rgraph_resize_container_' + ca.id +'"></div>').css({
137
- 'float': ca.style.cssFloat,
138
- position: 'relative'
139
- }).get(0);
140
-
141
- $(ca).wrap(ca.rgraphResizewrapper);
142
-
143
- // TODO Might need to add more properties here (eg margin, padding etc)
144
- ca.style.cssFloat = 'none';
145
- ca.style.top = 0;
146
- ca.style.left = 0;
147
-
148
-
149
-
150
- var window_onmousemove = function (e)
151
- {
152
- var ca = active,
153
- obj = ca ? ca.__object__ : null;
154
-
155
- if (ca) {
156
-
157
- e = RG.fixEventObject(e);
158
-
159
- if (ca.resizing.mousedown) {
160
-
161
- var newWidth = ca.width + (e.pageX - ca.resizing.originalx);
162
- var newHeight = ca.height + (e.pageY - ca.resizing.originaly);
163
-
164
- if ( newWidth > (ca.resizing.originalw / 2)
165
- && (typeof obj.get('resizableMaxwidth') === 'number' ? newWidth < obj.get('resizableMaxwidth') : true)
166
- ) {
167
- ca.resizing.div.style.width = newWidth + 'px';
168
- }
169
-
170
- if (newHeight > (ca.resizing.originalh / 2) && (typeof obj.get('resizableMaxheight') === 'number' ? newHeight < obj.get('resizableMaxheight') : true) ) {
171
- ca.resizing.div.style.height = newHeight + 'px';
172
- }
173
-
174
- RG.fireCustomEvent(ca.__object__, 'onresize');
175
- }
176
- }
177
- }
178
-
179
-
180
-
181
- // Install the function as an event listener - but only once
182
- if (typeof ca.rgraph_resize_window_mousemove_listener_installed != 'boolean') {
183
- window.addEventListener('mousemove', window_onmousemove, false);
184
- ca.rgraph_resize_window_mousemove_listener_installed = true;
185
- }
186
-
187
- // The window onmouseup function
188
- var MouseupFunc = function (e)
189
- {
190
- if (!ca.resizing || !ca.resizing.div || !ca.resizing.mousedown) {
191
- return;
192
- }
193
-
194
- if (ca.resizing.div) {
195
-
196
- var div = ca.resizing.div;
197
- var coords = RG.getCanvasXY(ca);
198
-
199
- var parentNode = ca.parentNode;
200
-
201
- if (ca.style.position != 'absolute') {
202
-
203
- // Create a DIV to go in the canvases place
204
- var placeHolderDIV = document.createElement('DIV');
205
- placeHolderDIV.style.width = ca.resizing.originalw + 'px';
206
- placeHolderDIV.style.height = ca.resizing.originalh + 'px';
207
-
208
- placeHolderDIV.style.display = 'inline-block'; // Added 5th Nov 2010
209
- placeHolderDIV.style.position = ca.style.position;
210
- placeHolderDIV.style.left = ca.style.left;
211
- placeHolderDIV.style.top = ca.style.top;
212
- placeHolderDIV.style.cssFloat = ca.style.cssFloat;
213
-
214
- parentNode.insertBefore(placeHolderDIV, ca);
215
- }
216
-
217
-
218
- // Now set the canvas to be positioned absolutely
219
- ca.style.backgroundColor = 'white';
220
- ca.style.position = 'absolute';
221
- ca.style.border = '1px dashed gray';
222
- ca.style.boxShadow = '2px 2px 5px #ddd';
223
-
224
-
225
- ca.style.left = 0;//(ca.resizing.originalCanvasX - 2) + 'px';
226
- ca.style.top = 0;//(ca.resizing.originalCanvasY - 2) + 'px';
227
-
228
-
229
- // Set the dimensions of the canvas using the HTML attributes
230
- ca.width = parseInt(div.style.width);
231
- ca.height = parseInt(div.style.height);
232
-
233
-
234
-
235
-
236
- // Because resizing the canvas resets any tranformation - the antialias fix needs to be reapplied.
237
- ca.getContext('2d').translate(0.5,0.5);
238
-
239
-
240
-
241
- // Reset the gradient parsing status by setting all of the color values back to their original
242
- // values before Draw was first called
243
- var objects = RG.ObjectRegistry.getObjectsByCanvasID(ca.id);
244
- for (var i=0,len=objects.length; i<len; i+=1) {
245
-
246
- RG.resetColorsToOriginalValues(objects[i]);
247
- if (typeof objects[i].reset === 'function') {
248
- objects[i].reset();
249
- }
250
- }
251
-
252
-
253
-
254
-
255
- // Kill the background cache
256
- RG.cache = [];
257
-
258
-
259
- // Fire the onresize event
260
- RG.fireCustomEvent(ca.__object__, 'onresizebeforedraw');
261
-
262
- RG.redrawCanvas(ca);
263
-
264
-
265
- // Get rid of transparent semi-opaque DIV
266
- ca.resizing.mousedown = false;
267
- div.style.display = 'none';
268
- document.body.removeChild(div);
269
- }
270
-
271
-
272
- // If there is zoom enabled in thumbnail mode, lose the zoom image
273
- if (RG.Registry.Get('chart.zoomed.div') || RGraph.Registry.Get('chart.zoomed.img')) {
274
- RG.Registry.Set('chart.zoomed.div', null);
275
- RG.Registry.Set('chart.zoomed.img', null);
276
- }
277
-
278
-
279
- // Fire the onresize event
280
- RG.FireCustomEvent(ca.__object__, 'onresizeend');
281
- };
282
-
283
-
284
- var window_onmouseup = MouseupFunc;
285
-
286
- // Install the function as an event listener - but only once
287
- if (typeof ca.rgraph_resize_window_mouseup_listener_installed != 'boolean') {
288
- window.addEventListener('mouseup', window_onmouseup, false);
289
- ca.rgraph_resize_window_mouseup_listener_installed = true;
290
- }
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
- var canvas_onmousemove = function (e)
320
- {
321
-
322
- e = RG.fixEventObject(e);
323
-
324
- var coords = RG.getMouseXY(e);
325
- var obj = e.target.__object__;
326
- var ca = e.target;
327
- var co = ca.getContext('2d');
328
- var cursor = ca.style.cursor;
329
-
330
- // Save the original cursor
331
- if (!ca.resizing.original_cursor) {
332
- ca.resizing.original_cursor = cursor;
333
- }
334
-
335
- if ( (coords[0] > (ca.width - resizeHandleSize)
336
- && coords[0] < ca.width
337
- && coords[1] > (ca.height - resizeHandleSize)
338
- && coords[1] < ca.height)) {
339
-
340
- ca.style.cursor = 'move';
341
-
342
- } else if ( coords[0] > (ca.width - resizeHandleSize - resizeHandleSize)
343
- && coords[0] < ca.width - resizeHandleSize
344
- && coords[1] > (ca.height - resizeHandleSize)
345
- && coords[1] < ca.height) {
346
-
347
- ca.style.cursor = 'pointer';
348
-
349
- } else {
350
- if (ca.resizing.original_cursor) {
351
- ca.style.cursor = ca.resizing.original_cursor;
352
- ca.resizing.original_cursor = null;
353
- } else {
354
- ca.style.cursor = 'default';
355
- }
356
- }
357
- };
358
-
359
-
360
-
361
-
362
-
363
- // Install the function as an event listener - but only once
364
- if (typeof ca.rgraph_resize_mousemove_listener_installed != 'boolean') {
365
- ca.addEventListener('mousemove', canvas_onmousemove, false);
366
- ca.rgraph_resize_mousemove_listener_installed = true;
367
- }
368
-
369
-
370
-
371
-
372
-
373
- var canvas_onmouseout = function (e)
374
- {
375
- e.target.style.cursor = 'default';
376
- e.target.title = '';
377
- };
378
-
379
- // Install the function as an event listener - but only once
380
- if (typeof ca.rgraph_resize_mouseout_listener_installed != 'boolean') {
381
- ca.addEventListener('mouseout', canvas_onmouseout, false);
382
- ca.rgraph_resize_mouseout_listener_installed = true;
383
- }
384
-
385
-
386
-
387
-
388
-
389
- var canvas_onmousedown = function (e)
390
- {
391
- e = RG.fixEventObject(e);
392
-
393
- var coords = RG.getMouseXY(e);
394
- var canvasXY = RG.getCanvasXY(e.target);
395
- var ca = e.target;
396
-
397
- /**
398
- * Set the active variable to the last canvas that was clicked on
399
- */
400
- active = ca;
401
-
402
-
403
-
404
-
405
-
406
-
407
- if ( coords[0] > (ca.width - resizeHandleSize)
408
- && coords[0] < ca.width
409
- && coords[1] > (ca.height - resizeHandleSize)
410
- && coords[1] < ca.height) {
411
-
412
- RG.fireCustomEvent(obj, 'onresizebegin');
413
-
414
- // Save the existing border
415
- if (ca.resizing.original_css_border == null) {
416
- ca.resizing.original_css_border = ca.style.border;
417
- }
418
-
419
- // Save the existing shadow
420
- if (ca.resizing.original_css_shadow == null) {
421
- ca.resizing.original_css_shadow = ca.style.boxShadow;
422
- }
423
-
424
- ca.resizing.mousedown = true;
425
-
426
-
427
- // Create the semi-opaque DIV
428
- var div = document.createElement('DIV');
429
- div.style.position = 'absolute';
430
- div.style.left = canvasXY[0] + 'px';
431
- div.style.top = canvasXY[1] + 'px';
432
- div.style.width = ca.width + 'px';
433
- div.style.height = ca.height + 'px';
434
- div.style.border = '1px dotted black';
435
- div.style.backgroundColor = 'gray';
436
- div.style.opacity = 0.5;
437
- div.__canvas__ = e.target;
438
- document.body.appendChild(div);
439
-
440
- ca.resizing.div = div;
441
- ca.resizing.placeHolders.push(div);
442
-
443
- // Hide the previous resize indicator layers. This is only necessary it seems for the Meter chart
444
- for (var i=0; i<(ca.resizing.placeHolders.length - 1); ++i) {
445
- ca.resizing.placeHolders[i].style.display = 'none';
446
- }
447
-
448
- // This is a repetition of the window.onmouseup function (No need to use DOM2 here)
449
- div.onmouseup = function (e)
450
- {
451
- MouseupFunc(e);
452
- }
453
-
454
-
455
- // No need to use DOM2 here
456
- ca.resizing.div.onmouseover = function (e)
457
- {
458
- e = RG.fixEventObject(e);
459
- e.stopPropagation();
460
- }
461
-
462
- // The mouse
463
- ca.resizing.originalx = e.pageX;
464
- ca.resizing.originaly = e.pageY;
465
-
466
- ca.resizing.originalCanvasX = RG.getCanvasXY(ca)[0];
467
- ca.resizing.originalCanvasY = RG.getCanvasXY(ca)[1];
468
- }
469
-
470
- // This facilitates the reset button
471
- if ( coords[0] > (ca.width - resizeHandleSize - resizeHandleSize)
472
- && coords[0] < ca.width - resizeHandleSize
473
- && coords[1] > (ca.height - resizeHandleSize)
474
- && coords[1] < ca.height
475
- && ca.resizing.originalw
476
- && ca.resizing.originaly) {
477
-
478
-
479
- // Fire the onresizebegin event
480
- RG.fireCustomEvent(ca.__object__, 'onresizebegin');
481
-
482
- // Restore the original width and height
483
- ca.width = ca.resizing.originalw;
484
- ca.height = ca.resizing.originalh;
485
-
486
- // TODO Need to check the parent is actually a DIV container or not?
487
-
488
- // Show the link if it exists and the display is set to none
489
- if (ca.__link__ && ca.__link__.style.display === 'none') {
490
- ca.__link__.style.display = 'inline';
491
- }
492
-
493
- if (typeof ca.parentNode.id === 'string' && ca.parentNode.id.substring(0, 24) === 'rgraph_resize_container_') {
494
- ca.parentNode.style.width = ca.resizing.originalw + 'px';
495
- ca.parentNode.style.height = ca.resizing.originalh + 'px';
496
- }
497
-
498
- // Lose the border
499
- ca.style.border = ca.resizing.original_css_border;
500
-
501
- //Lose the shadow
502
- ca.style.boxShadow = ca.resizing.original_css_shadow;
503
-
504
-
505
- // Add 1 pixel to the top/left because the border is going
506
- ca.style.left = (parseInt(ca.style.left)) + 'px';
507
- ca.style.top = (parseInt(ca.style.top)) + 'px';
508
-
509
-
510
-
511
- // Because resetting the canvas resizes it - and so loses any translation - need to reapply the
512
- // antialiasing translation
513
- ca.getContext('2d').translate(0.5,0.5);
514
-
515
-
516
- RG.fireCustomEvent(ca.__object__, 'onresizebeforedraw');
517
-
518
- // Since gradients are pre-parsed colors - this resets the colors to what they were
519
- // before the parsing.
520
- var objects = RG.ObjectRegistry.getObjectsByCanvasID(ca.id);
521
- for (var i=0; i<objects.length; i+=1) {
522
- RG.resetColorsToOriginalValues(objects[i]);
523
- if (objects[i].reset) {
524
- objects[i].reset();
525
- }
526
-
527
- RG.redrawCanvas(objects[i].canvas);
528
- }
529
-
530
-
531
- // Clear the cache so that old things (eg backgrounds) are not reused
532
- RG.cache = [];
533
-
534
-
535
-
536
-
537
-
538
-
539
- // Redraw the canvas
540
- //RG.redrawCanvas(objects[i].canvas);
541
-
542
-
543
- // Set the width and height on the DIV
544
- if (ca.resizing.div) {
545
- ca.resizing.div.style.width = ca.__original_width__ + 'px';
546
- ca.resizing.div.style.height = ca.__original_height__ + 'px';
547
- }
548
-
549
-
550
- // Fire the resize event
551
- RG.fireCustomEvent(ca.__object__, 'onresize');
552
- RG.fireCustomEvent(ca.__object__, 'onresizeend');
553
- }
554
- };
555
-
556
- // Install the function as an event listener - but only once
557
- if (typeof ca.rgraph_resize_mousedown_listener_installed != 'boolean') {
558
- ca.addEventListener('mousedown', canvas_onmousedown, false);
559
- ca.rgraph_resize_mousedown_listener_installed = true;
560
- }
561
- }
562
- };
563
- // End module pattern
564
- })(window, document);
2
+ RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
3
+ {var RG=RGraph,ua=navigator.userAgent,ma=Math,active=null;RGraph.allowResizing=RGraph.AllowResizing=function(obj)
4
+ {var ca=obj.canvas,co=obj.context,pa2=RG.path2;ca.resizing=ca.resizing||{};ca.resizing.placeHolders=ca.resizing.placeHolders||[];if(!ca.resizing.originalw){ca.resizing.originalw=ca.width;}
5
+ if(!ca.resizing.originalh){ca.resizing.originalh=ca.height;}
6
+ var resizeHandleSize=15;if(!ca.resizing.__rgraph_original_width__||!ca.resizing.__rgraph_original_height__||!ca.resizing.__adjustX||!ca.resizing.__adjustY){ca.resizing.__rgraph_original_width__=ca.width;ca.resizing.__rgraph_original_height__=ca.height;ca.resizing.adjustX=(typeof obj.get('chart.resize.handle.adjust')=='object'&&typeof obj.get('chart.resize.handle.adjust')[0]=='number'?obj.Get('chart.resize.handle.adjust')[0]:0);ca.resizing.adjustY=(typeof obj.get('chart.resize.handle.adjust')=='object'&&typeof obj.get('chart.resize.handle.adjust')[1]=='number'?obj.Get('chart.resize.handle.adjust')[1]:0);ca.resizing.bgcolor=obj.get('chart.resize.handle.background')||'rgba(0,0,0,0)';}
7
+ pa2(co,'b m % % r % % % % f %',ca.width-resizeHandleSize-resizeHandleSize+ca.resizing.adjustX,ca.height-resizeHandleSize,ca.width-resizeHandleSize-resizeHandleSize+ca.resizing.adjustX,ca.height-resizeHandleSize+ca.resizing.adjustY,2*resizeHandleSize,resizeHandleSize,ca.resizing.bgcolor);pa2(co,'b lw 1 m % % l % % m % % l % % s gray f transparent',ma.round(ca.width-(resizeHandleSize/2)+ca.resizing.adjustX),ca.height-resizeHandleSize+ca.resizing.adjustY,ma.round(ca.width-(resizeHandleSize/2)+ca.resizing.adjustX),ca.height+ca.resizing.adjustY,ca.width+ca.resizing.adjustX,ma.round(ca.height-(resizeHandleSize/2)+ca.resizing.adjustY),ca.width-resizeHandleSize+ca.resizing.adjustX,ma.round(ca.height-(resizeHandleSize/2)+ca.resizing.adjustY));pa2(co,['b','m',ca.width-(resizeHandleSize/2)+ca.resizing.adjustX,ca.height-resizeHandleSize+ca.resizing.adjustY,'l',ca.width-(resizeHandleSize/2)+3+ca.resizing.adjustX,ca.height-resizeHandleSize+3+ca.resizing.adjustY,'l',ca.width-(resizeHandleSize/2)-3+ca.resizing.adjustX,ca.height-resizeHandleSize+3+ca.resizing.adjustY,'c','f','gray']);pa2(co,['b','m',ca.width-(resizeHandleSize/2)+ca.resizing.adjustX,ca.height+ca.resizing.adjustY,'l',ca.width-(resizeHandleSize/2)+3+ca.resizing.adjustX,ca.height-3+ca.resizing.adjustY,'l',ca.width-(resizeHandleSize/2)-3+ca.resizing.adjustX,ca.height-3+ca.resizing.adjustY,'c','f','gray']);pa2(co,['b','m',ca.width-resizeHandleSize+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+ca.resizing.adjustY,'l',ca.width-resizeHandleSize+3+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+3+ca.resizing.adjustY,'l',ca.width-resizeHandleSize+3+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)-3+ca.resizing.adjustY,'c','f','gray']);pa2(co,['b','m',ca.width+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+ca.resizing.adjustY,'l',ca.width-3+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+3+ca.resizing.adjustY,'l',ca.width-3+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)-3+ca.resizing.adjustY,'c','f','gray']);pa2(co,['b','m',ca.width+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+ca.resizing.adjustY,'r',ca.width-(resizeHandleSize/2)-2+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)-2+ca.resizing.adjustY,4,4,'r',ca.width-(resizeHandleSize/2)-2+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)-2+ca.resizing.adjustY,4,4,'s','gray','f','white']);pa2(co,['b','m',ma.round(ca.width-resizeHandleSize-3+ca.resizing.adjustX),ca.height-resizeHandleSize/2+ca.resizing.adjustY,'l',ma.round(ca.width-resizeHandleSize-resizeHandleSize+ca.resizing.adjustX),ca.height-(resizeHandleSize/2)+ca.resizing.adjustY,'l',ca.width-resizeHandleSize-resizeHandleSize+2+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)-2+ca.resizing.adjustY,'l',ca.width-resizeHandleSize-resizeHandleSize+2+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+2+ca.resizing.adjustY,'l',ca.width-resizeHandleSize-resizeHandleSize+ca.resizing.adjustX,ca.height-(resizeHandleSize/2)+ca.resizing.adjustY,'s','gray','f','gray']);pa2(co,['b','m',ma.round(ca.width-resizeHandleSize-resizeHandleSize-1+ca.resizing.adjustX),ca.height-(resizeHandleSize/2)-3+ca.resizing.adjustY,'l',ma.round(ca.width-resizeHandleSize-resizeHandleSize-1+ca.resizing.adjustX),ca.height-(resizeHandleSize/2)+3+ca.resizing.adjustY,'s','f']);if(obj.get('chart.resizable')&&!ca.rgraphResizewrapper){ca.rgraphResizewrapper=$('<div id="rgraph_resize_container_'+ca.id+'"></div>').css({'float':ca.style.cssFloat,position:'relative'}).get(0);$(ca).wrap(ca.rgraphResizewrapper);ca.style.cssFloat='none';ca.style.top=0;ca.style.left=0;var window_onmousemove=function(e)
8
+ {var ca=active,obj=ca?ca.__object__:null;if(ca){e=RG.fixEventObject(e);if(ca.resizing.mousedown){var newWidth=ca.width+(e.pageX-ca.resizing.originalx),newHeight=ca.height+(e.pageY-ca.resizing.originaly),minWidth=obj.get('resizableMinwidth'),minHeight=obj.get('resizableMinheight');if(newWidth>(ca.resizing.originalw/2)&&(typeof obj.get('resizableMaxwidth')==='number'?newWidth<obj.get('resizableMaxwidth'):true)&&(typeof minWidth==='number'?newWidth>minWidth:true)){ca.resizing.div.style.width=newWidth+'px';}
9
+ if(newHeight>(ca.resizing.originalh/2)&&(typeof obj.get('resizableMaxheight')==='number'?newHeight<obj.get('resizableMaxheight'):true)&&(typeof minHeight==='number'?newHeight>minHeight:true)){ca.resizing.div.style.height=newHeight+'px';}
10
+ RG.fireCustomEvent(ca.__object__,'onresize');}}}
11
+ if(typeof ca.rgraph_resize_window_mousemove_listener_installed!='boolean'){window.addEventListener('mousemove',window_onmousemove,false);ca.rgraph_resize_window_mousemove_listener_installed=true;}
12
+ var MouseupFunc=function(e)
13
+ {if(!ca.resizing||!ca.resizing.div||!ca.resizing.mousedown){return;}
14
+ if(ca.resizing.div){var div=ca.resizing.div;var coords=RG.getCanvasXY(ca);var parentNode=ca.parentNode;if(ca.style.position!='absolute'){var placeHolderDIV=document.createElement('DIV');placeHolderDIV.style.width=ca.resizing.originalw+'px';placeHolderDIV.style.height=ca.resizing.originalh+'px';placeHolderDIV.style.display='inline-block';placeHolderDIV.style.position=ca.style.position;placeHolderDIV.style.left=ca.style.left;placeHolderDIV.style.top=ca.style.top;placeHolderDIV.style.cssFloat=ca.style.cssFloat;parentNode.insertBefore(placeHolderDIV,ca);}
15
+ ca.style.backgroundColor='white';ca.style.position='absolute';ca.style.border='1px dashed gray';ca.style.boxShadow='2px 2px 5px #ddd';ca.style.left=0;ca.style.top=0;ca.width=parseInt(div.style.width);ca.height=parseInt(div.style.height);ca.getContext('2d').translate(0.5,0.5);var objects=RG.ObjectRegistry.getObjectsByCanvasID(ca.id);for(var i=0,len=objects.length;i<len;i+=1){RG.resetColorsToOriginalValues(objects[i]);if(typeof objects[i].reset==='function'){objects[i].reset();}}
16
+ RG.cache=[];RG.fireCustomEvent(ca.__object__,'onresizebeforedraw');RG.redrawCanvas(ca);ca.resizing.mousedown=false;div.style.display='none';document.body.removeChild(div);}
17
+ if(RG.Registry.Get('chart.zoomed.div')||RGraph.Registry.Get('chart.zoomed.img')){RG.Registry.Set('chart.zoomed.div',null);RG.Registry.Set('chart.zoomed.img',null);}
18
+ RG.FireCustomEvent(ca.__object__,'onresizeend');};var window_onmouseup=MouseupFunc;if(typeof ca.rgraph_resize_window_mouseup_listener_installed!='boolean'){window.addEventListener('mouseup',window_onmouseup,false);ca.rgraph_resize_window_mouseup_listener_installed=true;}
19
+ var canvas_onmousemove=function(e)
20
+ {e=RG.fixEventObject(e);var coords=RG.getMouseXY(e);var obj=e.target.__object__;var ca=e.target;var co=ca.getContext('2d');var cursor=ca.style.cursor;if(!ca.resizing.original_cursor){ca.resizing.original_cursor=cursor;}
21
+ if((coords[0]>(ca.width-resizeHandleSize)&&coords[0]<ca.width&&coords[1]>(ca.height-resizeHandleSize)&&coords[1]<ca.height)){ca.style.cursor='move';}else if(coords[0]>(ca.width-resizeHandleSize-resizeHandleSize)&&coords[0]<ca.width-resizeHandleSize&&coords[1]>(ca.height-resizeHandleSize)&&coords[1]<ca.height){ca.style.cursor='pointer';}else{if(ca.resizing.original_cursor){ca.style.cursor=ca.resizing.original_cursor;ca.resizing.original_cursor=null;}else{ca.style.cursor='default';}}};if(typeof ca.rgraph_resize_mousemove_listener_installed!='boolean'){ca.addEventListener('mousemove',canvas_onmousemove,false);ca.rgraph_resize_mousemove_listener_installed=true;}
22
+ var canvas_onmouseout=function(e)
23
+ {e.target.style.cursor='default';e.target.title='';};if(typeof ca.rgraph_resize_mouseout_listener_installed!='boolean'){ca.addEventListener('mouseout',canvas_onmouseout,false);ca.rgraph_resize_mouseout_listener_installed=true;}
24
+ var canvas_onmousedown=function(e)
25
+ {e=RG.fixEventObject(e);var coords=RG.getMouseXY(e);var canvasXY=RG.getCanvasXY(e.target);var ca=e.target;active=ca;if(coords[0]>(ca.width-resizeHandleSize)&&coords[0]<ca.width&&coords[1]>(ca.height-resizeHandleSize)&&coords[1]<ca.height){RG.fireCustomEvent(obj,'onresizebegin');if(ca.resizing.original_css_border==null){ca.resizing.original_css_border=ca.style.border;}
26
+ if(ca.resizing.original_css_shadow==null){ca.resizing.original_css_shadow=ca.style.boxShadow;}
27
+ ca.resizing.mousedown=true;var div=document.createElement('DIV');div.style.position='absolute';div.style.left=canvasXY[0]+'px';div.style.top=canvasXY[1]+'px';div.style.width=ca.width+'px';div.style.height=ca.height+'px';div.style.border='1px dotted black';div.style.backgroundColor='gray';div.style.opacity=0.5;div.__canvas__=e.target;document.body.appendChild(div);ca.resizing.div=div;ca.resizing.placeHolders.push(div);for(var i=0;i<(ca.resizing.placeHolders.length-1);++i){ca.resizing.placeHolders[i].style.display='none';}
28
+ div.onmouseup=function(e)
29
+ {MouseupFunc(e);}
30
+ ca.resizing.div.onmouseover=function(e)
31
+ {e=RG.fixEventObject(e);e.stopPropagation();}
32
+ ca.resizing.originalx=e.pageX;ca.resizing.originaly=e.pageY;ca.resizing.originalCanvasX=RG.getCanvasXY(ca)[0];ca.resizing.originalCanvasY=RG.getCanvasXY(ca)[1];}
33
+ if(coords[0]>(ca.width-resizeHandleSize-resizeHandleSize)&&coords[0]<ca.width-resizeHandleSize&&coords[1]>(ca.height-resizeHandleSize)&&coords[1]<ca.height&&ca.resizing.originalw&&ca.resizing.originaly){RG.fireCustomEvent(ca.__object__,'onresizebegin');ca.width=ca.resizing.originalw;ca.height=ca.resizing.originalh;if(ca.__link__&&ca.__link__.style.display==='none'){ca.__link__.style.display='inline';}
34
+ if(typeof ca.parentNode.id==='string'&&ca.parentNode.id.substring(0,24)==='rgraph_resize_container_'){ca.parentNode.style.width=ca.resizing.originalw+'px';ca.parentNode.style.height=ca.resizing.originalh+'px';}
35
+ ca.style.border=ca.resizing.original_css_border;ca.style.boxShadow=ca.resizing.original_css_shadow;ca.style.left=(parseInt(ca.style.left))+'px';ca.style.top=(parseInt(ca.style.top))+'px';ca.getContext('2d').translate(0.5,0.5);RG.fireCustomEvent(ca.__object__,'onresizebeforedraw');var objects=RG.ObjectRegistry.getObjectsByCanvasID(ca.id);for(var i=0;i<objects.length;i+=1){RG.resetColorsToOriginalValues(objects[i]);if(objects[i].reset){objects[i].reset();}
36
+ RG.redrawCanvas(objects[i].canvas);}
37
+ RG.cache=[];if(ca.resizing.div){ca.resizing.div.style.width=ca.__original_width__+'px';ca.resizing.div.style.height=ca.__original_height__+'px';}
38
+ RG.fireCustomEvent(ca.__object__,'onresize');RG.fireCustomEvent(ca.__object__,'onresizeend');}};if(typeof ca.rgraph_resize_mousedown_listener_installed!='boolean'){ca.addEventListener('mousedown',canvas_onmousedown,false);ca.rgraph_resize_mousedown_listener_installed=true;}}};})(window,document);