rgraph-rails 1.0.1

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