rgraph-rails 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +0 -1
  3. data/README.md +3 -3
  4. data/lib/rgraph-rails/version.rb +1 -1
  5. data/vendor/assets/javascripts/RGraph.bar.js +239 -3764
  6. data/vendor/assets/javascripts/RGraph.bipolar.js +115 -1986
  7. data/vendor/assets/javascripts/RGraph.common.annotate.js +35 -399
  8. data/vendor/assets/javascripts/RGraph.common.context.js +30 -600
  9. data/vendor/assets/javascripts/RGraph.common.core.js +403 -5187
  10. data/vendor/assets/javascripts/RGraph.common.csv.js +19 -275
  11. data/vendor/assets/javascripts/RGraph.common.deprecated.js +35 -454
  12. data/vendor/assets/javascripts/RGraph.common.dynamic.js +84 -1189
  13. data/vendor/assets/javascripts/RGraph.common.effects.js +90 -1548
  14. data/vendor/assets/javascripts/RGraph.common.key.js +54 -755
  15. data/vendor/assets/javascripts/RGraph.common.resizing.js +37 -567
  16. data/vendor/assets/javascripts/RGraph.common.sheets.js +29 -356
  17. data/vendor/assets/javascripts/RGraph.common.tooltips.js +32 -614
  18. data/vendor/assets/javascripts/RGraph.common.zoom.js +14 -223
  19. data/vendor/assets/javascripts/RGraph.cornergauge.js +71 -0
  20. data/vendor/assets/javascripts/RGraph.drawing.background.js +35 -620
  21. data/vendor/assets/javascripts/RGraph.drawing.circle.js +35 -576
  22. data/vendor/assets/javascripts/RGraph.drawing.image.js +52 -807
  23. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +41 -717
  24. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +37 -668
  25. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +36 -563
  26. data/vendor/assets/javascripts/RGraph.drawing.poly.js +40 -608
  27. data/vendor/assets/javascripts/RGraph.drawing.rect.js +35 -597
  28. data/vendor/assets/javascripts/RGraph.drawing.text.js +34 -642
  29. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +50 -809
  30. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +51 -856
  31. data/vendor/assets/javascripts/RGraph.fuel.js +58 -964
  32. data/vendor/assets/javascripts/RGraph.funnel.js +55 -984
  33. data/vendor/assets/javascripts/RGraph.gantt.js +75 -1241
  34. data/vendor/assets/javascripts/RGraph.gauge.js +87 -1397
  35. data/vendor/assets/javascripts/RGraph.hbar.js +143 -2376
  36. data/vendor/assets/javascripts/RGraph.hprogress.js +80 -1397
  37. data/vendor/assets/javascripts/RGraph.line.js +241 -4162
  38. data/vendor/assets/javascripts/RGraph.meter.js +74 -1278
  39. metadata +3 -30
  40. data/vendor/assets/images/bg.png +0 -0
  41. data/vendor/assets/images/bullet.png +0 -0
  42. data/vendor/assets/images/facebook-large.png +0 -0
  43. data/vendor/assets/images/google-plus-large.png +0 -0
  44. data/vendor/assets/images/logo.png +0 -0
  45. data/vendor/assets/images/meter-image-sd-needle.png +0 -0
  46. data/vendor/assets/images/meter-image-sd.png +0 -0
  47. data/vendor/assets/images/meter-sketch-needle.png +0 -0
  48. data/vendor/assets/images/meter-sketch.png +0 -0
  49. data/vendor/assets/images/odometer-background.png +0 -0
  50. data/vendor/assets/images/rgraph.jpg +0 -0
  51. data/vendor/assets/images/title.png +0 -0
  52. data/vendor/assets/images/twitter-large.png +0 -0
  53. data/vendor/assets/javascripts/RGraph.modaldialog.js +0 -301
  54. data/vendor/assets/javascripts/RGraph.odo.js +0 -1265
  55. data/vendor/assets/javascripts/RGraph.pie.js +0 -2272
  56. data/vendor/assets/javascripts/RGraph.radar.js +0 -1847
  57. data/vendor/assets/javascripts/RGraph.rose.js +0 -1877
  58. data/vendor/assets/javascripts/RGraph.rscatter.js +0 -1425
  59. data/vendor/assets/javascripts/RGraph.scatter.js +0 -2970
  60. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +0 -1015
  61. data/vendor/assets/javascripts/RGraph.thermometer.js +0 -1129
  62. data/vendor/assets/javascripts/RGraph.vprogress.js +0 -1452
  63. data/vendor/assets/javascripts/RGraph.waterfall.js +0 -1252
  64. data/vendor/assets/javascripts/financial-data.js +0 -1067
  65. data/vendor/assets/stylesheets/ModalDialog.css +0 -90
  66. data/vendor/assets/stylesheets/animations.css +0 -3347
  67. data/vendor/assets/stylesheets/website.css +0 -446
@@ -1,601 +1,31 @@
1
- // version: 2016-06-04
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 starts at just 99 GBP and |
11
- * | you can read about it here: |
12
- * | |
13
- * | http://www.rgraph.net/license |
14
- * o--------------------------------------------------------------------------------o
15
- */
16
1
 
17
- RGraph = window.RGraph || {isRGraph: true};
18
-
19
- // Module pattern
20
- (function (win, doc, undefined)
21
- {
22
- var RG = RGraph,
23
- ua = navigator.userAgent,
24
- ma = Math;
25
-
26
-
27
-
28
- /**
29
- * This gunction shows a context menu containing the parameters
30
- * provided to it
31
- *
32
- * @param object canvas The canvas object
33
- * @param array menuitems The context menu menuitems
34
- * @param object e The event object
35
- */
36
- RG.contextmenu =
37
- RG.Contextmenu = function (obj, menuitems, e)
38
- {
39
- var canvas = obj.canvas;
40
-
41
- e = RG.FixEventObject(e);
42
-
43
- /**
44
- * Fire the custom RGraph event onbeforecontextmenu
45
- */
46
- RG.FireCustomEvent(obj, 'onbeforecontextmenu');
47
-
48
- /**
49
- * Hide any existing menu
50
- */
51
- if (RG.Registry.Get('chart.contextmenu')) {
52
- RG.HideContext();
53
- }
54
-
55
- // Hide any zoomed canvas
56
- RG.HideZoomedCanvas();
57
-
58
- /**
59
- * Hide the palette if necessary
60
- */
61
- RG.HidePalette();
62
-
63
- /**
64
- * This is here to ensure annotating is OFF
65
- */
66
- obj.Set('chart.mousedown', false);
67
-
68
- var x = e.pageX;
69
- var y = e.pageY;
70
- var div = document.createElement('div');
71
- var bg = document.createElement('div');
72
-
73
- div.className = 'RGraph_contextmenu';
74
- div.__canvas__ = canvas; /* Store a reference to the canvas on the contextmenu object */
75
- div.style.position = 'absolute';
76
- div.style.left = 0;
77
- div.style.top = 0;
78
- div.style.border = '1px solid black';
79
- div.style.backgroundColor = 'white';
80
- div.style.boxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
81
- div.style.MozBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
82
- div.style.WebkitBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
83
- div.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';
84
- div.style.opacity = 0;
85
-
86
- bg.className = 'RGraph_contextmenu_background';
87
- bg.style.position = 'absolute';
88
- bg.style.backgroundColor = '#ccc';
89
- bg.style.borderRight = '1px solid #aaa';
90
- bg.style.top = 0;
91
- bg.style.left = 0;
92
- bg.style.width = '18px';
93
- bg.style.height = '100%';
94
- bg.style.opacity = 0;
95
-
96
-
97
- div = document.body.appendChild(div);
98
- bg = div.appendChild(bg);
99
-
100
-
101
- /**
102
- * Now add the context menu items
103
- */
104
- for (i=0; i<menuitems.length; ++i) {
105
-
106
- var menuitem = document.createElement('div');
107
-
108
- menuitem.__object__ = obj;
109
- menuitem.__canvas__ = canvas;
110
- menuitem.__contextmenu__ = div;
111
- menuitem.className = 'RGraph_contextmenu_item';
112
-
113
- if (menuitems[i]) {
114
- menuitem.style.padding = '2px 5px 2px 23px';
115
- menuitem.style.fontFamily = 'Arial';
116
- menuitem.style.fontSize = '10pt';
117
- menuitem.style.textAlign = 'left';
118
- menuitem.style.fontWeight = 'normal';
119
- menuitem.innerHTML = menuitems[i][0];
120
-
121
- if (RG.is_array(menuitems[i][1])) {
122
- menuitem.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAQUlEQVQImY3NoQ2AMABE0ZewABMyGQ6mqWODzlAclBSFO8HZl8uf0FFxCHtwYkt4Y6ChYE44cGH9/fyae2p2LAleW9oVTQuVf6gAAAAASUVORK5CYII=)';
123
- menuitem.style.backgroundRepeat = 'no-repeat';
124
- menuitem.style.backgroundPosition = '97% center';
125
- }
126
-
127
- // Add the mouseover event
128
- if (menuitems[i][1]) {
129
- if (menuitem.addEventListener) {
130
- menuitem.addEventListener("mouseover", function (e) {RG.HideContextSubmenu(); e.target.style.backgroundColor = 'rgba(0,0,0,0.2)'; e.target.style.cursor = 'pointer';}, false);
131
- menuitem.addEventListener("mouseout", function (e) {e.target.style.backgroundColor = 'inherit'; e.target.style.cursor = 'default';}, false);
132
- } else {
133
- menuitem.attachEvent("onmouseover", function () {RG.HideContextSubmenu();event.srcElement.style.backgroundColor = '#eee';event.srcElement.style.cursor = 'pointer';}
134
- , false);
135
- menuitem.attachEvent("onmouseout", function () {event.srcElement.style.backgroundColor = 'inherit'; event.srcElement.style.cursor = 'default';}, false);
136
- }
137
- } else {
138
- if (menuitem.addEventListener) {
139
- menuitem.addEventListener("mouseover", function (e) {e.target.style.cursor = 'default';}, false);
140
- menuitem.addEventListener("mouseout", function (e) {e.target.style.cursor = 'default';}, false);
141
- } else {
142
- menuitem.attachEvent("onmouseover", function () {event.srcElement.style.cursor = 'default'}, false);
143
- menuitem.attachEvent("onmouseout", function () {event.srcElement.style.cursor = 'default';}, false);
144
- }
145
- }
146
-
147
- } else {
148
- menuitem.style.borderBottom = '1px solid #ddd';
149
- menuitem.style.marginLeft = '25px';
150
- }
151
-
152
- div.appendChild(menuitem);
153
-
154
- /**
155
- * Install the event handler that calls the menuitem
156
- */
157
- if (menuitems[i] && menuitems[i][1] && typeof(menuitems[i][1]) == 'function') {
158
-
159
- menuitem.addEventListener('click', menuitems[i][1], false);
160
-
161
- // Submenu
162
- } else if (menuitems[i] && menuitems[i][1] && RG.is_array(menuitems[i][1])) {
163
- (function ()
164
- {
165
- var tmp = menuitems[i][1]; // This is here because of "references vs primitives" and how they're passed around in Javascript
166
-
167
- // TODO This may need attention
168
- menuitem.addEventListener('mouseover', function (e) {RG.Contextmenu_submenu(obj, tmp, e.target);}, false);
169
- })();
170
- }
171
- }
172
-
173
- /**
174
- * Now all the menu items have been added, set the shadow width
175
- * Shadow now handled by CSS3
176
- */
177
- div.style.width = (div.offsetWidth + 10) + 'px';
178
- div.style.height = (div.offsetHeight - 2) + 'px';
179
-
180
- // Show the menu to the left or the right (normal) of the cursor?
181
- if (x + div.offsetWidth > document.body.offsetWidth) {
182
- x -= div.offsetWidth;
183
- }
184
-
185
- // Reposition the menu (now we have the real offsetWidth)
186
- div.style.left = x + 'px';
187
- div.style.top = y + 'px';
188
-
189
- /**
190
- * Do a little fade in effect
191
- */
192
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.2", 50);
193
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.4", 100);
194
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.6", 150);
195
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.8", 200);
196
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 1", 250);
197
-
198
- // The fade in effect on the left gray bar
199
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.2", 50);
200
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.4", 100);
201
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.6", 150);
202
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.8", 200);
203
- setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 1", 250);
204
-
205
- // Store the context menu in the registry
206
- RG.Registry.Set('chart.contextmenu', div);
207
- RG.Registry.Set('chart.contextmenu.bg', bg);
208
- RG.Registry.Get('chart.contextmenu').oncontextmenu = function () {return false;};
209
- RG.Registry.Get('chart.contextmenu.bg').oncontextmenu = function () {return false;};
210
-
211
- /**
212
- * Install the event handlers that hide the context menu
213
- */
214
- canvas.addEventListener('click', function () {RG.HideContext();}, false);
215
-
216
- window.addEventListener('click', function ()
217
- {
218
- RG.HideContext();
219
- }, false);
220
-
221
- window.addEventListener('resize', function ()
222
- {
223
- RG.HideContext();
224
- }, false);
225
-
226
-
227
- /**
228
- * Add the __shape__ object to the context menu
229
- */
230
-
231
- /**
232
- * Set the shape coords from the .getShape() method
233
- */
234
- if (typeof(obj.getShape) == 'function') {
235
- RG.Registry.Get('chart.contextmenu').__shape__ = obj.getShape(e);
236
- }
237
-
238
-
239
- e.stopPropagation();
240
-
241
- /**
242
- * Fire the (RGraph) oncontextmenu event
243
- */
244
- RG.FireCustomEvent(obj, 'oncontextmenu');
245
-
246
- return false;
247
- };
248
-
249
-
250
-
251
-
252
- /**
253
- * Hides the context menu if it's currently visible
254
- */
255
- RG.hideContext =
256
- RG.HideContext = function ()
257
- {
258
- var cm = RG.Registry.Get('chart.contextmenu');
259
- var cmbg = RG.Registry.Get('chart.contextmenu.bg');
260
-
261
- //Hide any submenu currently being displayed
262
- RG.HideContextSubmenu();
263
-
264
- if (cm) {
265
- cm.parentNode.removeChild(cm);
266
- cmbg.parentNode.removeChild(cmbg);
267
-
268
- cm.style.visibility = 'hidden';
269
- cm.style.display = 'none';
270
- RG.Registry.Set('chart.contextmenu', null);
271
-
272
- cmbg.style.visibility = 'hidden';
273
- cmbg.style.display = 'none';
274
- RG.Registry.Set('chart.contextmenu.bg', null);
275
- }
276
- };
277
-
278
-
279
-
280
-
281
- /**
282
- * Hides the context menus SUBMENU if it's currently visible
283
- */
284
- RG.hideContextSubmenu =
285
- RG.HideContextSubmenu = function ()
286
- {
287
- var sub = RG.Registry.Get('chart.contextmenu.submenu');
288
-
289
- if (sub) {
290
- sub.style.visibility = 'none';
291
- sub.style.display = 'none';
292
- RG.Registry.Set('chart.contextmenu.submenu', null);
293
- }
294
- };
295
-
296
-
297
-
298
-
299
- /**
300
- * Shows the context menu after making a few checks - not opera (doesn't support oncontextmenu,
301
- * not safari (tempermentality), not chrome (hmmm)
302
- */
303
- RG.showContext =
304
- RG.ShowContext = function (obj)
305
- {
306
- RG.HidePalette();
307
-
308
- if (obj.Get('chart.contextmenu') && obj.Get('chart.contextmenu').length) {
309
-
310
- var isOpera = navigator.userAgent.indexOf('Opera') >= 0;
311
- var isSafari = navigator.userAgent.indexOf('Safari') >= 0;
312
- var isChrome = navigator.userAgent.indexOf('Chrome') >= 0;
313
- var isMacFirefox = navigator.userAgent.indexOf('Firefox') > 0 && navigator.userAgent.indexOf('Mac') > 0;
314
- var isIE9 = navigator.userAgent.indexOf('MSIE 9') >= 0;
315
-
316
- if (((!isOpera && !isSafari) || isChrome) && !isMacFirefox) {
317
-
318
- obj.canvas.oncontextmenu = function (e)
319
- {
320
- e = RG.FixEventObject(e);
321
-
322
- if (e.ctrlKey) return true;
323
-
324
- RG.Contextmenu(obj, obj.Get('chart.contextmenu'), e);
325
-
326
- return false;
327
- }
328
-
329
- // Accomodate Opera and Safari - use double click event
330
- } else {
331
-
332
- obj.canvas.addEventListener('dblclick', function (e)
333
- {
334
- if (e.ctrlKey) return true;
335
-
336
- if (!RG.Registry.Get('chart.contextmenu')) {
337
- RG.Contextmenu(obj, obj.Get('chart.contextmenu'), e);
338
- }
339
- }, false);
340
- }
341
- }
342
- };
343
-
344
-
345
-
346
-
347
- /**
348
- * This draws a submenu should it be necessary
349
- *
350
- * @param object obj The graph object
351
- * @param object menu The context menu
352
- */
353
- RG.contextmenu_submenu =
354
- RG.Contextmenu_submenu = function (obj, menuitems, parentMenuItem)
355
- {
356
- RG.HideContextSubmenu();
357
-
358
- var canvas = obj.canvas;
359
- var context = obj.context;
360
- var menu = parentMenuItem.parentNode;
361
-
362
- var subMenu = document.createElement('DIV');
363
- subMenu.style.position = 'absolute';
364
- subMenu.style.width = '100px';
365
- subMenu.style.top = menu.offsetTop + parentMenuItem.offsetTop + 'px';
366
- subMenu.style.left = (menu.offsetLeft + menu.offsetWidth - (RG.ISOLD ? 9 : 0)) + 'px';
367
- subMenu.style.backgroundColor = 'white';
368
- subMenu.style.border = '1px solid black';
369
- subMenu.className = 'RGraph_contextmenu';
370
- subMenu.__contextmenu__ = menu;
371
- subMenu.style.boxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
372
- subMenu.style.MozBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
373
- subMenu.style.WebkitBoxShadow = '3px 3px 3px rgba(96,96,96,0.5)';
374
- subMenu.style.filter = 'progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';
375
- document.body.appendChild(subMenu);
376
-
377
- for (var i=0; i<menuitems.length; ++i) {
378
-
379
- var menuitem = document.createElement('DIV');
380
-
381
- menuitem.__canvas__ = canvas;
382
- menuitem.__contextmenu__ = menu;
383
- menuitem.className = 'RGraph_contextmenu_item';
384
-
385
- if (menuitems[i]) {
386
- menuitem.style.padding = '2px 5px 2px 23px';
387
- menuitem.style.fontFamily = 'Arial';
388
- menuitem.style.fontSize = '10pt';
389
- menuitem.style.fontWeight = 'normal';
390
- menuitem.style.textAlign = 'left';
391
- menuitem.innerHTML = menuitems[i][0];
392
-
393
- if (menuitems[i][1]) {
394
- if (menuitem.addEventListener) {
395
- menuitem.addEventListener("mouseover", function (e) {e.target.style.backgroundColor = 'rgba(0,0,0,0.2)'; e.target.style.cursor = 'pointer';}, false);
396
- menuitem.addEventListener("mouseout", function (e) {e.target.style.backgroundColor = 'inherit'; e.target.style.cursor = 'default';}, false);
397
- } else {
398
- menuitem.attachEvent("onmouseover", function () {event.srcElement.style.backgroundColor = 'rgba(0,0,0,0.2)'; event.srcElement.style.cursor = 'pointer'}, false);
399
- menuitem.attachEvent("onmouseout", function () {event.srcElement.style.backgroundColor = 'inherit'; event.srcElement.style.cursor = 'default';}, false);
400
- }
401
- } else {
402
- if (menuitem.addEventListener) {
403
- menuitem.addEventListener("mouseover", function (e) {e.target.style.cursor = 'default';}, false);
404
- menuitem.addEventListener("mouseout", function (e) {e.target.style.cursor = 'default';}, false);
405
- } else {
406
- menuitem.attachEvent("onmouseover", function () {event.srcElement.style.cursor = 'default'}, false);
407
- menuitem.attachEvent("onmouseout", function () {event.srcElement.style.cursor = 'default';}, false);
408
- }
409
- }
410
- } else {
411
- menuitem.style.borderBottom = '1px solid #ddd';
412
- menuitem.style.marginLeft = '25px';
413
- }
414
-
415
- subMenu.appendChild(menuitem);
416
-
417
- if (menuitems[i] && menuitems[i][1]) {
418
- if (document.all) {
419
- menuitem.attachEvent('onclick', menuitems[i][1]);
420
- } else {
421
- menuitem.addEventListener('click', menuitems[i][1], false);
422
- }
423
- }
424
- }
425
-
426
-
427
- var bg = document.createElement('DIV');
428
- bg.className = 'RGraph_contextmenu_background';
429
- bg.style.position = 'absolute';
430
- bg.style.backgroundColor = '#ccc';
431
- bg.style.borderRight = '1px solid #aaa';
432
- bg.style.top = 0;
433
- bg.style.left = 0;
434
- bg.style.width = '18px';
435
- bg.style.height = '100%';
436
-
437
- bg = subMenu.appendChild(bg);
438
-
439
- RG.Registry.Set('chart.contextmenu.submenu', subMenu);
440
- };
441
-
442
-
443
-
444
-
445
- /**
446
- * A function designed to be used in conjunction with thed context menu
447
- * to allow people to get image versions of canvases.
448
- *
449
- * @param canvas Optionally you can pass in the canvas, which will be used
450
- */
451
- RG.showPNG = function ()
452
- {
453
- if (RG.ISIE8) {
454
- alert('[RGRAPH PNG] Sorry, showing a PNG is not supported on MSIE8.');
455
- return;
456
- }
457
-
458
- if (arguments[0] && arguments[0].id) {
459
- var canvas = arguments[0];
460
- var event = arguments[1];
461
-
462
- } else if (RG.Registry.Get('chart.contextmenu')) {
463
- var canvas = RG.Registry.Get('chart.contextmenu').__canvas__;
464
-
465
- } else {
466
- alert('[RGRAPH SHOWPNG] Could not find canvas!');
467
- }
468
-
469
- var obj = canvas.__object__;
470
-
471
- /**
472
- * Create the gray background DIV to cover the page
473
- */
474
- var bg = document.createElement('DIV');
475
- bg.id = '__rgraph_image_bg__';
476
- bg.style.position = 'fixed';
477
- bg.style.top = '-10px';
478
- bg.style.left = '-10px';
479
- bg.style.width = '5000px';
480
- bg.style.height = '5000px';
481
- bg.style.backgroundColor = 'rgb(204,204,204)';
482
- bg.style.opacity = 0;
483
- document.body.appendChild(bg);
484
-
485
-
486
- /**
487
- * Create the div that the graph sits in
488
- */
489
- var div = document.createElement('DIV');
490
- div.style.backgroundColor = 'white';
491
- div.style.opacity = 0;
492
- div.style.border = '1px solid black';
493
- div.style.position = 'fixed';
494
- div.style.top = '20%';
495
- div.style.width = canvas.width + 'px';
496
- div.style.height = canvas.height + 35 + 'px';
497
- div.style.left = (document.body.clientWidth / 2) - (canvas.width / 2) + 'px';
498
- div.style.padding = '5px';
499
-
500
- div.style.borderRadius = '10px';
501
- div.style.MozBorderRadius = '10px';
502
- div.style.WebkitBorderRadius = '10px';
503
-
504
- div.style.boxShadow = '0 0 15px rgba(96,96,96,0.5)';
505
- div.style.MozBoxShadow = '0 0 15px rgba(96,96,96,0.5)';
506
- div.style.WebkitBoxShadow = 'rgba(96,96,96,0.5) 0 0 15px';
507
-
508
- div.__canvas__ = canvas;
509
- div.__object__ = obj;
510
- div.id = '__rgraph_image_div__';
511
- document.body.appendChild(div);
512
-
513
-
514
- /**
515
- * Add the HTML text inputs
516
- */
517
- div.innerHTML += '<div style="position: absolute; margin-left: 10px; top: ' + canvas.height + 'px; width: ' + (canvas.width - 50) + 'px; height: 25px"><span style="font-size: 12pt;display: inline; display: inline-block; width: 65px; text-align: right">URL:</span><textarea style="float: right; overflow: hidden; height: 20px; width: ' + (canvas.width - obj.gutterLeft - obj.gutterRight - 80) + 'px" onclick="this.select()" readonly="readonly" id="__rgraph_dataurl__">' + canvas.toDataURL() + '</textarea></div>';
518
- div.innerHTML += '<div style="position: absolute; top: ' + (canvas.height + 25) + 'px; left: ' + (obj.gutterLeft - 65 + (canvas.width / 2)) + 'px; width: ' + (canvas.width - obj.gutterRight) + 'px; font-size: 65%">A link using the URL: <a href="' + canvas.toDataURL() + '">View</a></div>'
519
-
520
-
521
-
522
- /**
523
- * Create the image rendition of the graph
524
- */
525
- var img = document.createElement('IMG');
526
- RG.Registry.Set('chart.png', img);
527
- img.__canvas__ = canvas;
528
- img.__object__ = obj;
529
- img.id = '__rgraph_image_img__';
530
- img.className = 'RGraph_png';
531
-
532
- img.src = canvas.toDataURL();
533
-
534
- div.appendChild(img);
535
-
536
- setTimeout(function () {document.getElementById("__rgraph_dataurl__").select();}, 50);
537
-
538
- window.addEventListener('resize', function (e){var img = RG.Registry.Get('chart.png');img.style.left = (document.body.clientWidth / 2) - (img.width / 2) + 'px';}, false);
539
-
540
- bg.onclick = function (e)
541
- {
542
- var div = document.getElementById("__rgraph_image_div__");
543
- var bg = document.getElementById("__rgraph_image_bg__");
544
-
545
- if (div) {
546
- div.style.opacity = 0;
547
-
548
- div.parentNode.removeChild(div);
549
-
550
- div.id = '';
551
- div.style.display = 'none';
552
- div = null;
553
- }
554
-
555
- if (bg) {
556
- bg.style.opacity = 0;
557
-
558
- bg.id = '';
559
- bg.style.display = 'none';
560
- bg = null;
561
- }
562
- }
563
-
564
- window.addEventListener('resize', function (e) {bg.onclick(e);}, false)
565
-
566
- /**
567
- * This sets the image BG and the DIV as global variables, circumventing repeated calls to document.getElementById()
568
- */
569
- RG.showpng_image_bg = bg;
570
- RG.showpng_image_div = div;
571
-
572
- setTimeout('RGraph.showpng_image_div.style.opacity = 0.2', 50);
573
- setTimeout('RGraph.showpng_image_div.style.opacity = 0.4', 100);
574
- setTimeout('RGraph.showpng_image_div.style.opacity = 0.6', 150);
575
- setTimeout('RGraph.showpng_image_div.style.opacity = 0.8', 200);
576
- setTimeout('RGraph.showpng_image_div.style.opacity = 1', 250);
577
-
578
- setTimeout('RGraph.showpng_image_bg.style.opacity = 0.1', 50);
579
- setTimeout('RGraph.showpng_image_bg.style.opacity = 0.2', 100);
580
- setTimeout('RGraph.showpng_image_bg.style.opacity = 0.3', 150);
581
- setTimeout('RGraph.showpng_image_bg.style.opacity = 0.4', 200);
582
- setTimeout('RGraph.showpng_image_bg.style.opacity = 0.5', 250);
583
-
584
-
585
-
586
- img.onclick = function (e)
587
- {
588
- if (e.stopPropagation) e.stopPropagation();
589
- else event.cancelBubble = true;
590
- }
591
-
592
- if (event && event.stopPropagation) {
593
- event.stopPropagation();
594
- }
595
- };
596
-
597
-
598
-
599
-
600
- // End module pattern
601
- })(window, document);
2
+ RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
3
+ {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.contextmenu=RG.Contextmenu=function(obj,menuitems,e)
4
+ {var canvas=obj.canvas;e=RG.FixEventObject(e);RG.FireCustomEvent(obj,'onbeforecontextmenu');if(RG.Registry.Get('chart.contextmenu')){RG.HideContext();}
5
+ RG.HideZoomedCanvas();RG.HidePalette();obj.Set('chart.mousedown',false);var x=e.pageX;var y=e.pageY;var div=document.createElement('div');var bg=document.createElement('div');div.className='RGraph_contextmenu';div.__canvas__=canvas;div.style.position='absolute';div.style.left=0;div.style.top=0;div.style.border='1px solid black';div.style.backgroundColor='white';div.style.boxShadow='3px 3px 3px rgba(96,96,96,0.5)';div.style.MozBoxShadow='3px 3px 3px rgba(96,96,96,0.5)';div.style.WebkitBoxShadow='3px 3px 3px rgba(96,96,96,0.5)';div.style.filter='progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';div.style.opacity=0;bg.className='RGraph_contextmenu_background';bg.style.position='absolute';bg.style.backgroundColor='#ccc';bg.style.borderRight='1px solid #aaa';bg.style.top=0;bg.style.left=0;bg.style.width='18px';bg.style.height='100%';bg.style.opacity=0;div=document.body.appendChild(div);bg=div.appendChild(bg);for(i=0;i<menuitems.length;++i){var menuitem=document.createElement('div');menuitem.__object__=obj;menuitem.__canvas__=canvas;menuitem.__contextmenu__=div;menuitem.className='RGraph_contextmenu_item';if(menuitems[i]){menuitem.style.padding='2px 5px 2px 23px';menuitem.style.fontFamily='Arial';menuitem.style.fontSize='10pt';menuitem.style.textAlign='left';menuitem.style.fontWeight='normal';menuitem.innerHTML=menuitems[i][0];if(RG.is_array(menuitems[i][1])){menuitem.style.backgroundImage='url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAQUlEQVQImY3NoQ2AMABE0ZewABMyGQ6mqWODzlAclBSFO8HZl8uf0FFxCHtwYkt4Y6ChYE44cGH9/fyae2p2LAleW9oVTQuVf6gAAAAASUVORK5CYII=)';menuitem.style.backgroundRepeat='no-repeat';menuitem.style.backgroundPosition='97% center';}
6
+ if(menuitems[i][1]){if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){RG.HideContextSubmenu();e.target.style.backgroundColor='rgba(0,0,0,0.2)';e.target.style.cursor='pointer';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.backgroundColor='inherit';e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){RG.HideContextSubmenu();event.srcElement.style.backgroundColor='#eee';event.srcElement.style.cursor='pointer';},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.backgroundColor='inherit';event.srcElement.style.cursor='default';},false);}}else{if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){e.target.style.cursor='default';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){event.srcElement.style.cursor='default'},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.cursor='default';},false);}}}else{menuitem.style.borderBottom='1px solid #ddd';menuitem.style.marginLeft='25px';}
7
+ div.appendChild(menuitem);if(menuitems[i]&&menuitems[i][1]&&typeof(menuitems[i][1])=='function'){menuitem.addEventListener('click',menuitems[i][1],false);}else if(menuitems[i]&&menuitems[i][1]&&RG.is_array(menuitems[i][1])){(function()
8
+ {var tmp=menuitems[i][1];menuitem.addEventListener('mouseover',function(e){RG.Contextmenu_submenu(obj,tmp,e.target);},false);})();}}
9
+ div.style.width=(div.offsetWidth+10)+'px';div.style.height=(div.offsetHeight-2)+'px';if(x+div.offsetWidth>document.body.offsetWidth){x-=div.offsetWidth;}
10
+ div.style.left=x+'px';div.style.top=y+'px';setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.2",50);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.4",100);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.6",150);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 0.8",200);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu')) obj.style.opacity = 1",250);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.2",50);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.4",100);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.6",150);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 0.8",200);setTimeout("if (obj = RGraph.Registry.Get('chart.contextmenu.bg')) obj.style.opacity = 1",250);RG.Registry.Set('chart.contextmenu',div);RG.Registry.Set('chart.contextmenu.bg',bg);RG.Registry.Get('chart.contextmenu').oncontextmenu=function(){return false;};RG.Registry.Get('chart.contextmenu.bg').oncontextmenu=function(){return false;};canvas.addEventListener('click',function(){RG.HideContext();},false);window.addEventListener('click',function()
11
+ {RG.HideContext();},false);window.addEventListener('resize',function()
12
+ {RG.HideContext();},false);if(typeof(obj.getShape)=='function'){RG.Registry.Get('chart.contextmenu').__shape__=obj.getShape(e);}
13
+ e.stopPropagation();RG.FireCustomEvent(obj,'oncontextmenu');return false;};RG.hideContext=RG.HideContext=function()
14
+ {var cm=RG.Registry.Get('chart.contextmenu');var cmbg=RG.Registry.Get('chart.contextmenu.bg');RG.HideContextSubmenu();if(cm){cm.parentNode.removeChild(cm);cmbg.parentNode.removeChild(cmbg);cm.style.visibility='hidden';cm.style.display='none';RG.Registry.Set('chart.contextmenu',null);cmbg.style.visibility='hidden';cmbg.style.display='none';RG.Registry.Set('chart.contextmenu.bg',null);}};RG.hideContextSubmenu=RG.HideContextSubmenu=function()
15
+ {var sub=RG.Registry.Get('chart.contextmenu.submenu');if(sub){sub.style.visibility='none';sub.style.display='none';RG.Registry.Set('chart.contextmenu.submenu',null);}};RG.showContext=RG.ShowContext=function(obj)
16
+ {RG.HidePalette();if(obj.Get('chart.contextmenu')&&obj.Get('chart.contextmenu').length){var isOpera=navigator.userAgent.indexOf('Opera')>=0;var isSafari=navigator.userAgent.indexOf('Safari')>=0;var isChrome=navigator.userAgent.indexOf('Chrome')>=0;var isMacFirefox=navigator.userAgent.indexOf('Firefox')>0&&navigator.userAgent.indexOf('Mac')>0;var isIE9=navigator.userAgent.indexOf('MSIE 9')>=0;if(((!isOpera&&!isSafari)||isChrome)&&!isMacFirefox){obj.canvas.oncontextmenu=function(e)
17
+ {e=RG.FixEventObject(e);if(e.ctrlKey)return true;RG.Contextmenu(obj,obj.Get('chart.contextmenu'),e);return false;}}else{obj.canvas.addEventListener('dblclick',function(e)
18
+ {if(e.ctrlKey)return true;if(!RG.Registry.Get('chart.contextmenu')){RG.Contextmenu(obj,obj.Get('chart.contextmenu'),e);}},false);}}};RG.contextmenu_submenu=RG.Contextmenu_submenu=function(obj,menuitems,parentMenuItem)
19
+ {RG.HideContextSubmenu();var canvas=obj.canvas;var context=obj.context;var menu=parentMenuItem.parentNode;var subMenu=document.createElement('DIV');subMenu.style.position='absolute';subMenu.style.width='100px';subMenu.style.top=menu.offsetTop+parentMenuItem.offsetTop+'px';subMenu.style.left=(menu.offsetLeft+menu.offsetWidth-(RG.ISOLD?9:0))+'px';subMenu.style.backgroundColor='white';subMenu.style.border='1px solid black';subMenu.className='RGraph_contextmenu';subMenu.__contextmenu__=menu;subMenu.style.boxShadow='3px 3px 3px rgba(96,96,96,0.5)';subMenu.style.MozBoxShadow='3px 3px 3px rgba(96,96,96,0.5)';subMenu.style.WebkitBoxShadow='3px 3px 3px rgba(96,96,96,0.5)';subMenu.style.filter='progid:DXImageTransform.Microsoft.Shadow(color=#aaaaaa,direction=135)';document.body.appendChild(subMenu);for(var i=0;i<menuitems.length;++i){var menuitem=document.createElement('DIV');menuitem.__canvas__=canvas;menuitem.__contextmenu__=menu;menuitem.className='RGraph_contextmenu_item';if(menuitems[i]){menuitem.style.padding='2px 5px 2px 23px';menuitem.style.fontFamily='Arial';menuitem.style.fontSize='10pt';menuitem.style.fontWeight='normal';menuitem.style.textAlign='left';menuitem.innerHTML=menuitems[i][0];if(menuitems[i][1]){if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){e.target.style.backgroundColor='rgba(0,0,0,0.2)';e.target.style.cursor='pointer';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.backgroundColor='inherit';e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){event.srcElement.style.backgroundColor='rgba(0,0,0,0.2)';event.srcElement.style.cursor='pointer'},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.backgroundColor='inherit';event.srcElement.style.cursor='default';},false);}}else{if(menuitem.addEventListener){menuitem.addEventListener("mouseover",function(e){e.target.style.cursor='default';},false);menuitem.addEventListener("mouseout",function(e){e.target.style.cursor='default';},false);}else{menuitem.attachEvent("onmouseover",function(){event.srcElement.style.cursor='default'},false);menuitem.attachEvent("onmouseout",function(){event.srcElement.style.cursor='default';},false);}}}else{menuitem.style.borderBottom='1px solid #ddd';menuitem.style.marginLeft='25px';}
20
+ subMenu.appendChild(menuitem);if(menuitems[i]&&menuitems[i][1]){if(document.all){menuitem.attachEvent('onclick',menuitems[i][1]);}else{menuitem.addEventListener('click',menuitems[i][1],false);}}}
21
+ var bg=document.createElement('DIV');bg.className='RGraph_contextmenu_background';bg.style.position='absolute';bg.style.backgroundColor='#ccc';bg.style.borderRight='1px solid #aaa';bg.style.top=0;bg.style.left=0;bg.style.width='18px';bg.style.height='100%';bg=subMenu.appendChild(bg);RG.Registry.Set('chart.contextmenu.submenu',subMenu);};RG.showPNG=function()
22
+ {if(RG.ISIE8){alert('[RGRAPH PNG] Sorry, showing a PNG is not supported on MSIE8.');return;}
23
+ if(arguments[0]&&arguments[0].id){var canvas=arguments[0];var event=arguments[1];}else if(RG.Registry.Get('chart.contextmenu')){var canvas=RG.Registry.Get('chart.contextmenu').__canvas__;}else{alert('[RGRAPH SHOWPNG] Could not find canvas!');}
24
+ var obj=canvas.__object__;var bg=document.createElement('DIV');bg.id='__rgraph_image_bg__';bg.style.position='fixed';bg.style.top='-10px';bg.style.left='-10px';bg.style.width='5000px';bg.style.height='5000px';bg.style.backgroundColor='rgb(204,204,204)';bg.style.opacity=0;document.body.appendChild(bg);var div=document.createElement('DIV');div.style.backgroundColor='white';div.style.opacity=0;div.style.border='1px solid black';div.style.position='fixed';div.style.top='20%';div.style.width=canvas.width+'px';div.style.height=canvas.height+35+'px';div.style.left=(document.body.clientWidth/2)-(canvas.width/2)+'px';div.style.padding='5px';div.style.borderRadius='10px';div.style.MozBorderRadius='10px';div.style.WebkitBorderRadius='10px';div.style.boxShadow='0 0 15px rgba(96,96,96,0.5)';div.style.MozBoxShadow='0 0 15px rgba(96,96,96,0.5)';div.style.WebkitBoxShadow='rgba(96,96,96,0.5) 0 0 15px';div.__canvas__=canvas;div.__object__=obj;div.id='__rgraph_image_div__';document.body.appendChild(div);div.innerHTML+='<div style="position: absolute; margin-left: 10px; top: '+canvas.height+'px; width: '+(canvas.width-50)+'px; height: 25px"><span style="font-size: 12pt;display: inline; display: inline-block; width: 65px; text-align: right">URL:</span><textarea style="float: right; overflow: hidden; height: 20px; width: '+(canvas.width-obj.gutterLeft-obj.gutterRight-80)+'px" onclick="this.select()" readonly="readonly" id="__rgraph_dataurl__">'+canvas.toDataURL()+'</textarea></div>';div.innerHTML+='<div style="position: absolute; top: '+(canvas.height+25)+'px; left: '+(obj.gutterLeft-65+(canvas.width/2))+'px; width: '+(canvas.width-obj.gutterRight)+'px; font-size: 65%">A link using the URL: <a href="'+canvas.toDataURL()+'">View</a></div>'
25
+ var img=document.createElement('IMG');RG.Registry.Set('chart.png',img);img.__canvas__=canvas;img.__object__=obj;img.id='__rgraph_image_img__';img.className='RGraph_png';img.src=canvas.toDataURL();div.appendChild(img);setTimeout(function(){document.getElementById("__rgraph_dataurl__").select();},50);window.addEventListener('resize',function(e){var img=RG.Registry.Get('chart.png');img.style.left=(document.body.clientWidth/2)-(img.width/2)+'px';},false);bg.onclick=function(e)
26
+ {var div=document.getElementById("__rgraph_image_div__");var bg=document.getElementById("__rgraph_image_bg__");if(div){div.style.opacity=0;div.parentNode.removeChild(div);div.id='';div.style.display='none';div=null;}
27
+ if(bg){bg.style.opacity=0;bg.id='';bg.style.display='none';bg=null;}}
28
+ window.addEventListener('resize',function(e){bg.onclick(e);},false)
29
+ RG.showpng_image_bg=bg;RG.showpng_image_div=div;setTimeout('RGraph.showpng_image_div.style.opacity = 0.2',50);setTimeout('RGraph.showpng_image_div.style.opacity = 0.4',100);setTimeout('RGraph.showpng_image_div.style.opacity = 0.6',150);setTimeout('RGraph.showpng_image_div.style.opacity = 0.8',200);setTimeout('RGraph.showpng_image_div.style.opacity = 1',250);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.1',50);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.2',100);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.3',150);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.4',200);setTimeout('RGraph.showpng_image_bg.style.opacity = 0.5',250);img.onclick=function(e)
30
+ {if(e.stopPropagation)e.stopPropagation();else event.cancelBubble=true;}
31
+ if(event&&event.stopPropagation){event.stopPropagation();}};})(window,document);