rgraph-rails 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +1 -0
  3. data/README.md +2 -2
  4. data/lib/rgraph-rails/version.rb +1 -1
  5. data/vendor/assets/images/bullet.png +0 -0
  6. data/vendor/assets/images/facebook-large.png +0 -0
  7. data/vendor/assets/images/google-plus-large.png +0 -0
  8. data/vendor/assets/images/logo.png +0 -0
  9. data/vendor/assets/images/rgraph.jpg +0 -0
  10. data/vendor/assets/javascripts/RGraph.bar.js +533 -242
  11. data/vendor/assets/javascripts/RGraph.bipolar.js +152 -169
  12. data/vendor/assets/javascripts/RGraph.common.annotate.js +2 -2
  13. data/vendor/assets/javascripts/RGraph.common.context.js +2 -2
  14. data/vendor/assets/javascripts/RGraph.common.core.js +688 -373
  15. data/vendor/assets/javascripts/RGraph.common.csv.js +2 -2
  16. data/vendor/assets/javascripts/RGraph.common.deprecated.js +2 -2
  17. data/vendor/assets/javascripts/RGraph.common.dynamic.js +188 -193
  18. data/vendor/assets/javascripts/RGraph.common.effects.js +62 -38
  19. data/vendor/assets/javascripts/RGraph.common.key.js +35 -15
  20. data/vendor/assets/javascripts/RGraph.common.resizing.js +38 -21
  21. data/vendor/assets/javascripts/RGraph.common.sheets.js +2 -2
  22. data/vendor/assets/javascripts/RGraph.common.tooltips.js +48 -40
  23. data/vendor/assets/javascripts/RGraph.common.zoom.js +2 -2
  24. data/vendor/assets/javascripts/RGraph.drawing.background.js +33 -49
  25. data/vendor/assets/javascripts/RGraph.drawing.circle.js +27 -30
  26. data/vendor/assets/javascripts/RGraph.drawing.image.js +23 -26
  27. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +47 -40
  28. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +38 -42
  29. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +24 -28
  30. data/vendor/assets/javascripts/RGraph.drawing.poly.js +25 -39
  31. data/vendor/assets/javascripts/RGraph.drawing.rect.js +27 -32
  32. data/vendor/assets/javascripts/RGraph.drawing.text.js +53 -58
  33. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +24 -29
  34. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +45 -51
  35. data/vendor/assets/javascripts/RGraph.fuel.js +11 -9
  36. data/vendor/assets/javascripts/RGraph.funnel.js +40 -43
  37. data/vendor/assets/javascripts/RGraph.gantt.js +34 -34
  38. data/vendor/assets/javascripts/RGraph.gauge.js +64 -55
  39. data/vendor/assets/javascripts/RGraph.hbar.js +194 -137
  40. data/vendor/assets/javascripts/RGraph.hprogress.js +261 -167
  41. data/vendor/assets/javascripts/RGraph.line.js +520 -512
  42. data/vendor/assets/javascripts/RGraph.meter.js +11 -10
  43. data/vendor/assets/javascripts/RGraph.modaldialog.js +11 -2
  44. data/vendor/assets/javascripts/RGraph.odo.js +11 -9
  45. data/vendor/assets/javascripts/RGraph.pie.js +385 -100
  46. data/vendor/assets/javascripts/RGraph.radar.js +36 -29
  47. data/vendor/assets/javascripts/RGraph.rose.js +58 -41
  48. data/vendor/assets/javascripts/RGraph.rscatter.js +40 -36
  49. data/vendor/assets/javascripts/RGraph.scatter.js +441 -499
  50. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1015 -0
  51. data/vendor/assets/javascripts/RGraph.thermometer.js +37 -37
  52. data/vendor/assets/javascripts/RGraph.vprogress.js +285 -157
  53. data/vendor/assets/javascripts/RGraph.waterfall.js +62 -62
  54. data/vendor/assets/stylesheets/website.css +30 -16
  55. metadata +3 -2
@@ -1,4 +1,4 @@
1
- // version: 2016-02-06
1
+ // version: 2016-06-04
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,7 +7,7 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license starts at just 99 (GBP) and |
10
+ * | the terms of the GPL. The commercial license starts at just 99 GBP and |
11
11
  * | you can read about it here: |
12
12
  * | |
13
13
  * | http://www.rgraph.net/license |
@@ -113,7 +113,10 @@
113
113
  'chart.fillstyle': 'white',
114
114
  'chart.text.color': 'black',
115
115
  'chart.text.size': 12,
116
- 'chart.text.font': 'Arial',
116
+ 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
117
+ 'chart.text.accessible': true,
118
+ 'chart.text.accessible.overflow': 'visible',
119
+ 'chart.text.accessible.pointerevents': false,
117
120
  'chart.events.click': null,
118
121
  'chart.events.mousemove': null,
119
122
  'chart.shadow': true,
@@ -126,7 +129,8 @@
126
129
  'chart.tooltips': null,
127
130
  'chart.tooltips.highlight': true,
128
131
  'chart.tooltips.event': 'onclick',
129
- 'chart.voffset': 20
132
+ 'chart.voffset': 20,
133
+ 'chart.clearto': 'rgba(0,0,0,0)'
130
134
  }
131
135
 
132
136
  /**
@@ -168,7 +172,6 @@
168
172
  ca = this.canvas,
169
173
  co = ca.getContext('2d'),
170
174
  prop = this.properties,
171
- pa = RG.Path,
172
175
  pa2 = RG.path2,
173
176
  win = window,
174
177
  doc = document,
@@ -222,10 +225,9 @@
222
225
 
223
226
 
224
227
  // Convert uppercase letters to dot+lower case letter
225
- name = name.replace(/([A-Z])/g, function (str)
226
- {
227
- return '.' + String(RegExp.$1).toLowerCase();
228
- });
228
+ while(name.match(/([A-Z])/)) {
229
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
230
+ }
229
231
 
230
232
 
231
233
 
@@ -357,15 +359,16 @@
357
359
  co.fillStyle = prop['chart.text.color'];
358
360
 
359
361
  // Draw the text
360
- RG.Text2(this, {'font':prop['chart.text.font'],
361
- 'size':prop['chart.text.size'],
362
- 'x': Math.round(this.x) - (this.alignRight ? this.metrics[0] + 3 : -3),
363
- 'y':this.y - 3 - prop['chart.voffset'],
364
- 'text':this.text,
365
- 'valign':'bottom',
366
- 'halign':'left',
367
- 'tag': 'labels'
368
- });
362
+ RG.text2(this, {
363
+ 'font':prop['chart.text.font'],
364
+ 'size':prop['chart.text.size'],
365
+ 'x': ma.round(this.x) - (this.alignRight ? this.metrics[0] + 3 : -3),
366
+ 'y':this.y - 3 - prop['chart.voffset'],
367
+ 'text':this.text,
368
+ 'valign':'bottom',
369
+ 'halign':'left',
370
+ 'tag': 'labels'
371
+ });
369
372
 
370
373
  this.coords[0].push([x, y, width, height]);
371
374
 
@@ -488,43 +491,32 @@
488
491
  */
489
492
  this.positionTooltip = function (obj, x, y, tooltip, idx)
490
493
  {
491
- var textDimensions = RG.MeasureText(this.text, false, prop['chart.text.font'], prop['chart.text.size']);
492
-
493
- var canvasXY = RG.getCanvasXY(obj.canvas);
494
- var width = tooltip.offsetWidth;
495
- var height = tooltip.offsetHeight;
494
+ var textDimensions = RG.measureText(this.text, false, prop['chart.text.font'], prop['chart.text.size']);
495
+ var canvasXY = RG.getCanvasXY(obj.canvas);
496
+ var mouseXY = RG.getMouseXY(window.event);
497
+ var width = tooltip.offsetWidth;
498
+ var height = tooltip.offsetHeight;
496
499
 
497
500
  // Set the top position
498
501
  tooltip.style.left = 0;
499
- tooltip.style.top = canvasXY[1] + this.coords[0][1] - height - 9 + (this.coords[0][3] / 2) + 'px';
500
-
502
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
503
+
501
504
  // By default any overflow is hidden
502
505
  tooltip.style.overflow = '';
503
-
504
- // The arrow
505
- var img = new Image();
506
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
507
- img.style.position = 'absolute';
508
- img.id = '__rgraph_tooltip_pointer__';
509
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
510
- tooltip.appendChild(img);
511
506
 
512
507
  // Reposition the tooltip if at the edges:
513
508
 
514
509
  // LEFT edge
515
- if ((canvasXY[0] + obj.coords[0][0] + (obj.coords[0][2] / 2) - (width / 2)) < 10) {
516
- tooltip.style.left = (canvasXY[0] + this.coords[0][0] + (this.coords[0][2] / 2) - (width * 0.1)) + 'px';
517
- img.style.left = ((width * 0.1) - 8.5) + 'px';
510
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
511
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
518
512
 
519
513
  // RIGHT edge
520
- } else if ((canvasXY[0] + this.coords[0][0] + (this.coords[0][2] / 2) + (width / 2)) > doc.body.offsetWidth) {
521
- tooltip.style.left = (canvasXY[0] + this.coords[0][0] + (this.coords[0][2] / 2) - (width * 0.9)) + 'px';
522
- img.style.left = ((width * 0.9) - 8.5) + 'px';
514
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
515
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
523
516
 
524
517
  // Default positioning - CENTERED
525
518
  } else {
526
- tooltip.style.left = (canvasXY[0] + this.coords[0][0] + (this.coords[0][2] / 2) - (width * 0.5)) + 'px';
527
- img.style.left = ((width * 0.5) - 8.5) + 'px';
519
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
528
520
  }
529
521
  };
530
522
 
@@ -540,7 +532,11 @@
540
532
  this.Highlight = function (shape)
541
533
  {
542
534
  if (prop['chart.tooltips.highlight']) {
543
- pa(this, ['b','r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);
535
+ if (typeof prop['chart.highlight.style'] === 'function') {
536
+ (prop['chart.highlight.style'])(shape);
537
+ } else {
538
+ pa2(co, ['b','r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);
539
+ }
544
540
  }
545
541
  };
546
542
 
@@ -1,4 +1,4 @@
1
- // version: 2016-02-06
1
+ // version: 2016-06-04
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,7 +7,7 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just 99 (GBP) and you can |
10
+ * | the terms of the GPL. The commercial license is just 99 GBP and you can |
11
11
  * | read about it here: |
12
12
  * | http://www.rgraph.net/license |
13
13
  * o--------------------------------------------------------------------------------o
@@ -123,7 +123,11 @@
123
123
  'chart.highlight.fill': 'rgba(255,0,0,1.0)',
124
124
  'chart.tooltips': null,
125
125
  'chart.tooltips.highlight': true,
126
- 'chart.tooltips.event': 'onclick'
126
+ 'chart.tooltips.event': 'onclick',
127
+ 'chart.text.accessible': true,
128
+ 'chart.text.accessible.overflow': 'visible',
129
+ 'chart.text.accessible.pointerevents': false,
130
+ 'chart.clearto': 'rgba(0,0,0,0)'
127
131
  }
128
132
 
129
133
  /**
@@ -165,7 +169,6 @@
165
169
  ca = this.canvas,
166
170
  co = ca.getContext('2d'),
167
171
  prop = this.properties,
168
- pa = RG.Path,
169
172
  pa2 = RG.path2,
170
173
  win = window,
171
174
  doc = document,
@@ -219,10 +222,9 @@
219
222
 
220
223
 
221
224
  // Convert uppercase letters to dot+lower case letter
222
- name = name.replace(/([A-Z])/g, function (str)
223
- {
224
- return '.' + String(RegExp.$1).toLowerCase();
225
- });
225
+ while(name.match(/([A-Z])/)) {
226
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
227
+ }
226
228
 
227
229
 
228
230
 
@@ -272,7 +274,7 @@
272
274
  {
273
275
  // Draw a circle to start with
274
276
  co.globalAlpha = this.alpha;
275
- pa(this, [
277
+ pa2(co, [
276
278
  'b',
277
279
  'a', this.centerx, this.centery, this.actualRadius, 0, 2 * Math.PI,false,
278
280
  'a', this.centerx, this.centery, ma.max(this.actualRadius - 8, 0), 2 * Math.PI,0, true,
@@ -393,41 +395,31 @@
393
395
  this.positionTooltip = function (obj, x, y, tooltip, idx)
394
396
  {
395
397
  var canvasXY = RG.getCanvasXY(obj.canvas);
398
+ var mouseXY = RG.getMouseXY(window.event);
396
399
  var width = tooltip.offsetWidth;
397
400
  var height = tooltip.offsetHeight;
398
401
  var radius = this.radius;
399
402
 
400
403
  // Set the top position
401
404
  tooltip.style.left = 0;
402
- tooltip.style.top = canvasXY[1] + obj.centery - height - 7 + 'px';
403
-
405
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
406
+
404
407
  // By default any overflow is hidden
405
408
  tooltip.style.overflow = '';
406
-
407
- // The arrow
408
- var img = new Image();
409
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
410
- img.style.position = 'absolute';
411
- img.id = '__rgraph_tooltip_pointer__';
412
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
413
- tooltip.appendChild(img);
414
409
 
415
410
  // Reposition the tooltip if at the edges:
416
411
 
417
412
  // LEFT edge
418
- if ((canvasXY[0] + obj.centerx - (width / 2)) < 10) {
419
- tooltip.style.left = (canvasXY[0] + this.centerx - (width * 0.1)) + 'px';
420
- img.style.left = ((width * 0.1) - 8.5) + 'px';
413
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
414
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
421
415
 
422
416
  // RIGHT edge
423
- } else if ((canvasXY[0] + obj.centerx + (width / 2)) > doc.body.offsetWidth) {
424
- tooltip.style.left = canvasXY[0] + this.centerx - (width * 0.9) + 'px';
425
- img.style.left = ((width * 0.9) - 8.5) + 'px';
417
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
418
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
426
419
 
427
420
  // Default positioning - CENTERED
428
421
  } else {
429
- tooltip.style.left = (canvasXY[0] + this.centerx - (width * 0.5)) + 'px';
430
- img.style.left = ((width * 0.5) - 8.5) + 'px';
422
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
431
423
  }
432
424
  };
433
425
 
@@ -442,7 +434,11 @@
442
434
  this.Highlight = function (shape)
443
435
  {
444
436
  if (prop['chart.tooltips.highlight']) {
445
- pa(this, ['b','r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);
437
+ if (typeof prop['chart.highlight.style'] === 'function') {
438
+ (prop['chart.highlight.style'])(shape);
439
+ } else {
440
+ pa2(co, ['b','r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);
441
+ }
446
442
  }
447
443
  };
448
444
 
@@ -1,4 +1,4 @@
1
- // version: 2016-02-06
1
+ // version: 2016-06-04
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,7 +7,7 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just 99 (GBP) and you can |
10
+ * | the terms of the GPL. The commercial license is just 99 GBP and you can |
11
11
  * | read about it here: |
12
12
  * | http://www.rgraph.net/license |
13
13
  * o--------------------------------------------------------------------------------o
@@ -111,7 +111,8 @@
111
111
  'chart.shadow.color': 'rgba(0,0,0,0.2)',
112
112
  'chart.shadow.offsetx': 3,
113
113
  'chart.shadow.offsety': 3,
114
- 'chart.shadow.blur': 5
114
+ 'chart.shadow.blur': 5,
115
+ 'chart.clearto': 'rgba(0,0,0,0)'
115
116
  }
116
117
 
117
118
  /**
@@ -146,7 +147,6 @@
146
147
  ca = this.canvas,
147
148
  co = ca.getContext('2d'),
148
149
  prop = this.properties,
149
- pa = RG.Path,
150
150
  pa2 = RG.path2,
151
151
  win = window,
152
152
  doc = document,
@@ -199,10 +199,9 @@
199
199
 
200
200
 
201
201
  // Convert uppercase letters to dot+lower case letter
202
- name = name.replace(/([A-Z])/g, function (str)
203
- {
204
- return '.' + String(RegExp.$1).toLowerCase();
205
- });
202
+ while(name.match(/([A-Z])/)) {
203
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
204
+ }
206
205
 
207
206
 
208
207
 
@@ -285,7 +284,7 @@
285
284
  */
286
285
 
287
286
  var obj = this;
288
- pa(this, ['b','fu',function (obj){if (prop['chart.shadow'])
287
+ pa2(co, ['b','fu',function (obj){if (prop['chart.shadow'])
289
288
  {
290
289
  co.shadowColor = prop['chart.shadow.color'];
291
290
  co.shadowOffsetX = prop['chart.shadow.offsetx'];
@@ -375,7 +374,7 @@
375
374
  {
376
375
  var coords = this.coords;
377
376
 
378
- pa(this, ['b','m',coords[0][0], coords[0][1]]);
377
+ pa2(co, ['b','m',coords[0][0], coords[0][1]]);
379
378
 
380
379
  // Draw lines to subsequent coords
381
380
  for (var i=1,len=coords.length; i<len; ++i) {
@@ -383,7 +382,7 @@
383
382
  }
384
383
 
385
384
  // Close the path and stroke/fill it with whatever the current fill/stroke styles are
386
- pa(this, ['lw', prop['chart.linewidth'], 'c','f',co.fillStyle, 's',co.strokeStyle]);
385
+ pa2(co, ['lw', prop['chart.linewidth'], 'c','f',co.fillStyle, 's',co.strokeStyle]);
387
386
  };
388
387
 
389
388
 
@@ -433,48 +432,31 @@
433
432
  */
434
433
  this.positionTooltip = function (obj, x, y, tooltip, idx)
435
434
  {
436
- var canvasXY = RGraph.getCanvasXY(obj.canvas);
435
+ var canvasXY = RG.getCanvasXY(obj.canvas);
436
+ var mouseXY = RG.getMouseXY(window.event);
437
437
  var width = tooltip.offsetWidth;
438
438
  var height = tooltip.offsetHeight;
439
439
 
440
440
  // Set the top position
441
- tooltip.style.left = 0;
442
- tooltip.style.top = (y - height - 7) + 'px';
441
+ tooltip.style.left = 0;
442
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
443
443
 
444
444
  // By default any overflow is hidden
445
445
  tooltip.style.overflow = '';
446
-
447
- // The arrow
448
- var img = new Image();
449
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
450
- img.style.position = 'absolute';
451
- img.id = '__rgraph_tooltip_pointer__';
452
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
453
- tooltip.appendChild(img);
454
-
455
-
456
446
 
447
+ // Reposition the tooltip if at the edges:
457
448
 
458
- /**
459
- * Reposition the tooltip if at the edges:
460
- */
461
-
462
-
463
-
464
449
  // LEFT edge
465
- if (x - (width / 2) < 10) {
466
- tooltip.style.left = (canvasXY[0] + x - (width * 0.1)) - 8.5+ 'px';
467
- img.style.left = ((width * 0.1) - 8.5) + 'px';
450
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
451
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
468
452
 
469
453
  // RIGHT edge
470
- } else if ((x + (width / 2)) > doc.body.offsetWidth) {
471
- tooltip.style.left = x - (width * 0.9) + 'px';
472
- img.style.left = ((width * 0.9) - 8.5) + 'px';
454
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
455
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
473
456
 
474
457
  // Default positioning - CENTERED
475
458
  } else {
476
- tooltip.style.left = x - (width / 2) + 'px';
477
- img.style.left = ((width * 0.5) - 8.5) + 'px';
459
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
478
460
  }
479
461
  };
480
462
 
@@ -494,7 +476,11 @@
494
476
 
495
477
  // Add the new highlight
496
478
  if (prop['chart.tooltips.highlight']) {
497
- pa(this, ['b','fu', function (obj){obj.DrawPoly();},'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);
479
+ if (typeof prop['chart.highlight.style'] === 'function') {
480
+ (prop['chart.highlight.style'])(shape);
481
+ } else {
482
+ pa2(co, ['b', 'fu', function (obj){obj.DrawPoly();},'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);
483
+ }
498
484
  }
499
485
  };
500
486
 
@@ -1,4 +1,4 @@
1
- // version: 2016-02-06
1
+ // version: 2016-06-04
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,7 +7,7 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just 99 (GBP) and you can |
10
+ * | the terms of the GPL. The commercial license is just 99 GBP and you can |
11
11
  * | read about it here: |
12
12
  * | http://www.rgraph.net/license |
13
13
  * o--------------------------------------------------------------------------------o
@@ -122,7 +122,8 @@
122
122
  'chart.tooltips.event': 'onclick',
123
123
  'chart.tooltips.highlight':true,
124
124
  'chart.tooltips.coords.page': false,
125
- 'chart.tooltips.valign': 'top'
125
+ 'chart.tooltips.valign': 'top',
126
+ 'chart.clearto': 'rgba(0,0,0,0)'
126
127
  }
127
128
 
128
129
  /**
@@ -161,7 +162,6 @@
161
162
  ca = this.canvas,
162
163
  co = ca.getContext('2d'),
163
164
  prop = this.properties,
164
- pa = RG.Path,
165
165
  pa2 = RG.path2,
166
166
  win = window,
167
167
  doc = document,
@@ -214,10 +214,9 @@
214
214
 
215
215
 
216
216
  // Convert uppercase letters to dot+lower case letter
217
- name = name.replace(/([A-Z])/g, function (str)
218
- {
219
- return '.' + String(RegExp.$1).toLowerCase();
220
- });
217
+ while(name.match(/([A-Z])/)) {
218
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
219
+ }
221
220
 
222
221
 
223
222
 
@@ -296,19 +295,19 @@
296
295
  /**
297
296
  * Draw the rect here
298
297
  */
299
- pa(this, ['b']);
298
+ pa2(co, ['b']);
300
299
 
301
300
  if (prop['chart.shadow']) {
302
- pa(this, ['sc',prop['chart.shadow.color'],'sx',prop['chart.shadow.offsetx'],'sy',prop['chart.shadow.offsety'],'sb',prop['chart.shadow.blur']]);
301
+ pa2(co, ['sc',prop['chart.shadow.color'],'sx',prop['chart.shadow.offsetx'],'sy',prop['chart.shadow.offsety'],'sb',prop['chart.shadow.blur']]);
303
302
  }
304
303
 
305
- pa(this, ['r',this.coords[0][0], this.coords[0][1], this.coords[0][2], this.coords[0][3],'f',prop['chart.fillstyle']]);
304
+ pa2(co, ['r',this.coords[0][0], this.coords[0][1], this.coords[0][2], this.coords[0][3],'f',prop['chart.fillstyle']]);
306
305
 
307
306
 
308
307
  // No shaadow to stroke the rectangle
309
308
  RG.NoShadow(this);
310
309
 
311
- pa(this, ['s',prop['chart.strokestyle']]);
310
+ pa2(co, ['s',prop['chart.strokestyle']]);
312
311
 
313
312
 
314
313
  /**
@@ -421,6 +420,7 @@
421
420
  var coordW = obj.coords[0][2];
422
421
  var coordH = obj.coords[0][3];
423
422
  var canvasXY = RG.getCanvasXY(obj.canvas);
423
+ var mouseXY = RG.getMouseXY(window.event);
424
424
  var width = tooltip.offsetWidth;
425
425
  var height = tooltip.offsetHeight;
426
426
 
@@ -430,36 +430,28 @@
430
430
  if (prop['chart.tooltips.valign'] == 'center') {
431
431
  tooltip.style.top = canvasXY[1] + coordY + (coordH / 2) -height + 'px';
432
432
  } else {
433
- tooltip.style.top = canvasXY[1] + coordY - height - 7 + 'px';
433
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
434
434
  }
435
-
435
+
436
+ // Set the top position
437
+ tooltip.style.left = 0;
438
+
436
439
  // By default any overflow is hidden
437
440
  tooltip.style.overflow = '';
438
-
439
- // The arrow
440
- var img = new Image();
441
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
442
- img.style.position = 'absolute';
443
- img.id = '__rgraph_tooltip_pointer__';
444
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
445
- tooltip.appendChild(img);
446
441
 
447
442
  // Reposition the tooltip if at the edges:
448
443
 
449
444
  // LEFT edge
450
- if ((canvasXY[0] + coordX + (coordW / 2) - (width / 2)) < 10) {
451
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.1)) + (coordW / 2) + 'px';
452
- img.style.left = ((width * 0.1) - 8.5) + 'px';
445
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
446
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
453
447
 
454
448
  // RIGHT edge
455
- } else if ((canvasXY[0] + coordX + (width / 2)) > doc.body.offsetWidth) {
456
- tooltip.style.left = canvasXY[0] + coordX - (width * 0.9) + (coordW / 2) + 'px';
457
- img.style.left = ((width * 0.9) - 8.5) + 'px';
449
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
450
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
458
451
 
459
452
  // Default positioning - CENTERED
460
453
  } else {
461
- tooltip.style.left = (canvasXY[0] + coordX + (coordW / 2) - (width * 0.5)) + 'px';
462
- img.style.left = ((width * 0.5) - 8.5) + 'px';
454
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
463
455
  }
464
456
  };
465
457
 
@@ -474,8 +466,11 @@
474
466
  this.highlight =
475
467
  this.Highlight = function (shape)
476
468
  {
477
- // Add the new highlight
478
- RG.Highlight.Rect(this, shape);
469
+ if (typeof prop['chart.highlight.style'] === 'function') {
470
+ (prop['chart.highlight.style'])(shape);
471
+ } else {
472
+ RG.Highlight.Rect(this, shape);
473
+ }
479
474
  };
480
475
 
481
476