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 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
@@ -89,7 +89,7 @@
89
89
  'chart.gutter.bottom': 25,
90
90
  'chart.numticks': 10,
91
91
  'chart.numticks.inner': 50,
92
- 'chart.background.color': '#eee',
92
+ 'chart.background.color': 'Gradient(#ccc:#eee:#efefef)',
93
93
  'chart.shadow': false,
94
94
  'chart.shadow.color': 'rgba(0,0,0,0.5)',
95
95
  'chart.shadow.blur': 3,
@@ -105,7 +105,10 @@
105
105
  'chart.title.valign': null,
106
106
  'chart.text.size': 12,
107
107
  'chart.text.color': 'black',
108
- 'chart.text.font': 'Arial',
108
+ 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
109
+ 'chart.text.accessible': true,
110
+ 'chart.text.accessible.overflow': 'visible',
111
+ 'chart.text.accessible.pointerevents': false,
109
112
  'chart.contextmenu': null,
110
113
  'chart.units.pre': '',
111
114
  'chart.units.post': '',
@@ -134,6 +137,8 @@
134
137
  'chart.resize.handle.background':null,
135
138
  'chart.labels.specific': null,
136
139
  'chart.labels.count': 10,
140
+ 'chart.labels.offsetx': 0,
141
+ 'chart.labels.offsety': 0,
137
142
  'chart.adjustable': false,
138
143
  'chart.scale.decimals': 0,
139
144
  'chart.scale.point': '.',
@@ -163,7 +168,8 @@
163
168
  'chart.labels.position': 'bottom',
164
169
  'chart.events.mousemove': null,
165
170
  'chart.events.click': null,
166
- 'chart.border.inner': true
171
+ 'chart.border.inner': true,
172
+ 'chart.clearto': 'rgba(0,0,0,0)'
167
173
  }
168
174
 
169
175
 
@@ -200,7 +206,6 @@
200
206
  ca = this.canvas,
201
207
  co = ca.getContext('2d'),
202
208
  prop = this.properties,
203
- pa = RG.Path,
204
209
  pa2 = RG.path2,
205
210
  win = window,
206
211
  doc = document,
@@ -253,10 +258,9 @@
253
258
 
254
259
 
255
260
  // Convert uppercase letters to dot+lower case letter
256
- name = name.replace(/([A-Z])/g, function (str)
257
- {
258
- return '.' + String(RegExp.$1).toLowerCase();
259
- });
261
+ while(name.match(/([A-Z])/)) {
262
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
263
+ }
260
264
 
261
265
 
262
266
  /**
@@ -354,7 +358,7 @@
354
358
  this.coords = [];
355
359
  this.coordsText = [];
356
360
 
357
- this.Drawbar();
361
+ this.drawbar();
358
362
  this.DrawTickMarks();
359
363
  this.DrawLabels();
360
364
  this.DrawTitle();
@@ -448,13 +452,13 @@
448
452
  'max':this.max,
449
453
  'min':this.min,
450
454
  'strict':true,
451
- 'scale.thousand':prop['chart.scale.thousand'],
452
- 'scale.point':prop['chart.scale.point'],
453
- 'scale.decimals':prop['chart.scale.decimals'],
454
- 'ylabels.count':prop['chart.labels.count'],
455
- 'scale.round':prop['chart.scale.round'],
456
- 'units.pre': prop['chart.units.pre'],
457
- 'units.post': prop['chart.units.post']
455
+ 'scale.thousand': prop['chart.scale.thousand'],
456
+ 'scale.point': prop['chart.scale.point'],
457
+ 'scale.decimals': prop['chart.scale.decimals'],
458
+ 'ylabels.count': prop['chart.labels.count'],
459
+ 'scale.round': prop['chart.scale.round'],
460
+ 'units.pre': prop['chart.units.pre'],
461
+ 'units.post': prop['chart.units.post']
458
462
  });
459
463
 
460
464
  // Set a shadow if requested
@@ -462,12 +466,6 @@
462
466
  RG.SetShadow(this, prop['chart.shadow.color'], prop['chart.shadow.offsetx'], prop['chart.shadow.offsety'], prop['chart.shadow.blur']);
463
467
  }
464
468
 
465
- // Draw the shadow for MSIE
466
- if (RG.ISOLD && prop['chart.shadow']) {
467
- co.fillStyle = prop['chart.shadow.color'];
468
- co.fillRect(this.gutterLeft + prop['chart.shadow.offsetx'], this.gutterTop + prop['chart.shadow.offsety'], this.width, this.height);
469
- }
470
-
471
469
  // Draw the outline
472
470
  co.fillStyle = prop['chart.background.color'];
473
471
  co.strokeStyle = prop['chart.strokestyle.outer'];
@@ -475,7 +473,7 @@
475
473
  co.fillRect(this.gutterLeft, this.gutterTop, this.width, this.height);
476
474
 
477
475
  // Turn off any shadow
478
- RG.NoShadow(this);
476
+ RG.noShadow(this);
479
477
 
480
478
  co.fillStyle = prop['chart.colors'][0];
481
479
  co.strokeStyle = prop['chart.strokestyle.outer'];
@@ -483,7 +481,7 @@
483
481
  var margin = prop['chart.margin'];
484
482
 
485
483
  // Draw the actual bar itself
486
- var barWidth = Math.min(this.width, ((RG.array_sum(this.value) - this.min) / (this.max - this.min) ) * this.width);
484
+ var barWidth = ma.min(this.width, ((RG.array_sum(this.value) - this.min) / (this.max - this.min) ) * this.width);
487
485
 
488
486
  if (prop['chart.tickmarks.inner']) {
489
487
 
@@ -506,45 +504,71 @@
506
504
  /**
507
505
  * This bit draws the actual progress bar
508
506
  */
509
- if (typeof(this.value) == 'number') {
510
- co.beginPath();
511
- co.strokeStyle = prop['chart.strokestyle.inner'];
512
- co.fillStyle = prop['chart.colors'][0];
513
-
507
+ if (typeof this.value === 'number') {
508
+
514
509
  if (prop['chart.border.inner']) {
515
- co.strokeRect(this.gutterLeft, this.gutterTop + margin, barWidth, this.height - margin - margin);
510
+ this.drawCurvedBar({
511
+ x: this.gutterLeft,
512
+ y: this.gutterTop + margin,
513
+ width: barWidth,
514
+ height: this.height - margin - margin,
515
+ stroke: prop['chart.strokestyle.inner']
516
+ });
516
517
  }
517
- co.fillRect(this.gutterLeft, this.gutterTop + margin, barWidth, this.height - margin - margin);
518
+
519
+ this.drawCurvedBar({
520
+ x: this.gutterLeft,
521
+ y: this.gutterTop + margin,
522
+ width: barWidth,
523
+ height: this.height - margin - margin,
524
+ fill: prop['chart.colors'][0]
525
+ });
518
526
 
519
527
  // Store the coords
520
- this.coords.push([this.gutterLeft,
521
- this.gutterTop + margin,
522
- barWidth,
523
- this.height - margin - margin]);
524
-
525
- } else if (typeof(this.value) == 'object') {
528
+ this.coords.push([
529
+ this.gutterLeft,
530
+ this.gutterTop + margin,
531
+ barWidth,
532
+ this.height - margin - margin
533
+ ]);
526
534
 
535
+ } else if (typeof this.value === 'object') {
536
+
527
537
  co.beginPath();
528
- co.strokeStyle = prop['chart.strokestyle.inner'];
529
538
 
530
539
  var startPoint = this.gutterLeft;
531
540
 
532
- for (var i=0; i<this.value.length; ++i) {
541
+ for (var i=0,len=this.value.length; i<len; ++i) {
533
542
 
534
- var segmentLength = (this.value[i] / RG.array_sum(this.value)) * barWidth;
535
- co.fillStyle = prop['chart.colors'][i];
543
+ var segmentLength = (this.value[i] / RG.arraySum(this.value)) * barWidth;
536
544
 
537
545
  if (prop['chart.border.inner']) {
538
- co.strokeRect(startPoint, this.gutterTop + margin, segmentLength, this.height - margin - margin);
546
+ this.drawCurvedBar({
547
+ x: startPoint,
548
+ y: this.gutterTop + margin,
549
+ width: segmentLength,
550
+ height: this.height - margin - margin,
551
+ fill: prop['chart.colors'][i],
552
+ stroke: prop['chart.strokestyle.inner']
553
+ });
539
554
  }
540
- co.fillRect(startPoint, this.gutterTop + margin, segmentLength, this.height - margin - margin);
555
+
556
+ this.drawCurvedBar({
557
+ x: startPoint,
558
+ y: this.gutterTop + margin,
559
+ width: segmentLength,
560
+ height: this.height - margin - margin,
561
+ fill: prop['chart.colors'][i]
562
+ });
541
563
 
542
564
 
543
565
  // Store the coords
544
- this.coords.push([startPoint,
545
- this.gutterTop + margin,
546
- segmentLength,
547
- this.height - margin - margin]);
566
+ this.coords.push([
567
+ startPoint,
568
+ this.gutterTop + margin,
569
+ segmentLength,
570
+ this.height - margin - margin
571
+ ]);
548
572
 
549
573
  startPoint += segmentLength;
550
574
  }
@@ -586,17 +610,18 @@
586
610
  */
587
611
  if (prop['chart.label.inner']) {
588
612
  co.fillStyle = 'black';
589
- RG.Text2(this, {'font':prop['chart.text.font'],
590
- 'size':prop['chart.text.size'] + 2,
591
- 'x':this.gutterLeft + barWidth + 5,
592
- 'y':this.gutterTop + (this.height / 2),
593
- 'text': String(prop['chart.units.pre'] + this.value + prop['chart.units.post']),
594
- 'valign':'bottom',
595
- 'halign':'left',
596
- 'bounding':true,
597
- 'boundingFill':'white',
598
- 'tag': 'label.inner'
599
- });
613
+ RG.Text2(this, {
614
+ 'font':prop['chart.text.font'],
615
+ 'size':prop['chart.text.size'] + 2,
616
+ 'x':this.gutterLeft + barWidth + 5,
617
+ 'y':this.gutterTop + (this.height / 2),
618
+ 'text': String(prop['chart.units.pre'] + this.value + prop['chart.units.post']),
619
+ 'valign':'bottom',
620
+ 'halign':'left',
621
+ 'bounding':true,
622
+ 'boundingFill':'white',
623
+ 'tag': 'label.inner'
624
+ });
600
625
  }
601
626
  };
602
627
 
@@ -653,10 +678,12 @@
653
678
 
654
679
  co.fillStyle = prop['chart.text.color'];
655
680
 
656
- var xPoints = [];
657
- var yPoints = [];
658
- var font = prop['chart.text.font'];
659
- var size = prop['chart.text.size'];
681
+ var xPoints = [],
682
+ yPoints = [],
683
+ font = prop['chart.text.font'],
684
+ size = prop['chart.text.size'],
685
+ offsetx = prop['chart.labels.offsetx'],
686
+ offsety = prop['chart.labels.offsety'];
660
687
 
661
688
  for (i=0,len=this.scale2.labels.length; i<len; i++) {
662
689
 
@@ -671,38 +698,41 @@
671
698
  var valign = 'top';
672
699
  }
673
700
 
674
- RG.Text2(this, {'font':font,
675
- 'size':size,
676
- 'x':x,
677
- 'y':y,
678
- 'text': this.scale2.labels[i],
679
- 'valign':valign,
680
- 'halign':'center',
681
- 'tag': 'scale'
682
- });
701
+ RG.text2(this, {
702
+ 'font':font,
703
+ 'size':size,
704
+ 'x':x + offsetx,
705
+ 'y':y + offsety,
706
+ 'text': this.scale2.labels[i],
707
+ 'valign':valign,
708
+ 'halign':'center',
709
+ 'tag': 'scale'
710
+ });
683
711
  }
684
712
 
685
713
  if (prop['chart.tickmarks.zerostart']) {
686
714
  if (prop['chart.labels.position'] == 'top') {
687
- RG.Text2(this, {'font':font,
688
- 'size':size,
689
- 'x':this.gutterLeft,
690
- 'y':this.gutterTop - 6,
691
- 'text': prop['chart.units.pre'] + Number(this.min).toFixed(prop['chart.scale.decimals']) + prop['chart.units.post'],
692
- 'valign':'bottom',
693
- 'halign':'center',
694
- 'tag': 'scale'
695
- });
715
+ RG.text2(this, {
716
+ 'font':font,
717
+ 'size':size,
718
+ 'x':this.gutterLeft + offsetx,
719
+ 'y':this.gutterTop - 6 + offsety,
720
+ 'text': prop['chart.units.pre'] + Number(this.min).toFixed(prop['chart.scale.decimals']) + prop['chart.units.post'],
721
+ 'valign':'bottom',
722
+ 'halign':'center',
723
+ 'tag': 'scale'
724
+ });
696
725
  } else {
697
- RG.Text2(this, {'font':font,
698
- 'size':size,
699
- 'x':this.gutterLeft,
700
- 'y':ca.height - this.gutterBottom + 5,
701
- 'text': prop['chart.units.pre'] + Number(this.min).toFixed(prop['chart.scale.decimals']) + prop['chart.units.post'],
702
- 'valign':'top',
703
- 'halign':'center',
704
- 'tag': 'scale'
705
- });
726
+ RG.text2(this, {
727
+ 'font':font,
728
+ 'size':size,
729
+ 'x':this.gutterLeft + offsetx,
730
+ 'y':ca.height - this.gutterBottom + 5 + offsety,
731
+ 'text': prop['chart.units.pre'] + Number(this.min).toFixed(prop['chart.scale.decimals']) + prop['chart.units.post'],
732
+ 'valign':'top',
733
+ 'halign':'center',
734
+ 'tag': 'scale'
735
+ });
706
736
  }
707
737
  }
708
738
  };
@@ -718,27 +748,34 @@
718
748
  this.getShape =
719
749
  this.getBar = function (e)
720
750
  {
721
- var mouseCoords = RG.getMouseXY(e)
722
-
723
- for (var i=0; i<this.coords.length; i++) {
724
-
725
- var mouseCoords = RG.getMouseXY(e);
726
- var mouseX = mouseCoords[0];
727
- var mouseY = mouseCoords[1];
728
- var left = this.coords[i][0];
729
- var top = this.coords[i][1];
730
- var width = this.coords[i][2];
731
- var height = this.coords[i][3];
732
- var idx = i;
733
-
734
- if (mouseX >= left && mouseX <= (left + width) && mouseY >= top && mouseY <= (top + height) ) {
751
+ var mouseXY = RG.getMouseXY(e),
752
+ mouseX = mouseXY[0],
753
+ mouseY = mouseXY[1];
754
+
755
+ for (var i=0,len=this.coords.length; i<len; i++) {
756
+
757
+ var x = this.coords[i][0],
758
+ y = this.coords[i][1],
759
+ w = this.coords[i][2],
760
+ h = this.coords[i][3],
761
+ idx = i;
762
+
763
+ co.beginPath();
764
+ this.drawCurvedBar({
765
+ x: x,
766
+ y: y,
767
+ height: h,
768
+ width: w
769
+ });
770
+
771
+ if (co.isPointInPath(mouseX, mouseY)) {
735
772
 
736
773
  var tooltip = RG.parseTooltipText(prop['chart.tooltips'], idx);
737
774
 
738
775
  return {
739
- 0: this, 1: left, 2: top, 3: width, 4: height, 5: idx,
740
- 'object':this, 'x':left, 'y':top, 'width': width, 'height': height, 'index': idx, 'tooltip': tooltip
741
- }
776
+ 0: this, 1: x, 2: y, 3: w, 4: h, 5: idx,
777
+ 'object':this, 'x':x, 'y':y, 'width': w, 'height': h, 'index': idx, 'tooltip': tooltip
778
+ }
742
779
  }
743
780
  }
744
781
  };
@@ -781,8 +818,21 @@
781
818
  this.highlight =
782
819
  this.Highlight = function (shape)
783
820
  {
784
- // Add the new highlight
785
- RG.Highlight.Rect(this, shape);
821
+ var last = shape.index === this.coords.length - 1;
822
+
823
+ if (typeof prop['chart.highlight.style'] === 'function') {
824
+ (prop['chart.highlight.style'])(shape);
825
+ } else {
826
+
827
+ this.drawCurvedBar({
828
+ x: shape.x,
829
+ y: shape.y,
830
+ width: shape.width,
831
+ height: shape.height,
832
+ stroke: prop['chart.highlight.stroke'],
833
+ fill: prop['chart.highlight.fill']
834
+ });
835
+ }
786
836
  };
787
837
 
788
838
 
@@ -853,23 +903,26 @@
853
903
 
854
904
  if (labels) {
855
905
 
856
- var font = prop['chart.text.font'];
857
- var size = prop['chart.text.size'];
858
- var valign = (prop['chart.labels.position'] == 'top' ? 'bottom' : 'top');
859
- var step = this.width / (labels.length - 1);
906
+ var font = prop['chart.text.font'],
907
+ size = prop['chart.text.size'],
908
+ valign = (prop['chart.labels.position'] == 'top' ? 'bottom' : 'top'),
909
+ step = this.width / (labels.length - 1),
910
+ offsetx = prop['chart.labels.offsetx'],
911
+ offsety = prop['chart.labels.offsety']
860
912
 
861
913
  co.beginPath();
862
914
  co.fillStyle = prop['chart.text.color'];
863
915
  for (var i=0; i<labels.length; ++i) {
864
- RG.Text2(this, {'font':font,
865
- 'size':size,
866
- 'x': this.gutterLeft + (step * i),
867
- 'y':prop['chart.labels.position'] == 'top' ? this.gutterTop - 7 : ca.height - this.gutterBottom + 7,
868
- 'text': labels[i],
869
- 'valign':valign,
870
- 'halign':'center',
871
- 'tag': 'labels.specific'
872
- });
916
+ RG.Text2(this, {
917
+ font:font,
918
+ size:size,
919
+ x: this.gutterLeft + (step * i) + offsetx,
920
+ y: prop['chart.labels.position'] == 'top' ? this.gutterTop - 7 + offsety: ca.height - this.gutterBottom + 7 + offsety,
921
+ text: labels[i],
922
+ valign:valign,
923
+ halign:'center',
924
+ tag: 'labels.specific'
925
+ });
873
926
  }
874
927
  co.fill();
875
928
  }
@@ -897,38 +950,28 @@
897
950
  var gutterTop = this.gutterTop;
898
951
  var width = tooltip.offsetWidth;
899
952
  var height = tooltip.offsetHeight;
953
+ var mouseXY = RG.getMouseXY(window.event);
900
954
 
901
955
  // Set the top position
902
956
  tooltip.style.left = 0;
903
- tooltip.style.top = canvasXY[1] + coordY - height - 7 + 'px';
957
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
904
958
 
905
959
  // By default any overflow is hidden
906
960
  tooltip.style.overflow = '';
907
-
908
- // The arrow
909
- var img = new Image();
910
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
911
- img.style.position = 'absolute';
912
- img.id = '__rgraph_tooltip_pointer__';
913
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
914
- tooltip.appendChild(img);
915
961
 
916
962
  // Reposition the tooltip if at the edges:
917
963
 
918
964
  // LEFT edge
919
- if ((canvasXY[0] + coordX + (coordW / 2) - (width / 2)) < 10) {
920
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.1)) + (coordW / 2) + 'px';
921
- img.style.left = ((width * 0.1) - 8.5) + 'px';
965
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
966
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
922
967
 
923
968
  // RIGHT edge
924
- } else if ((canvasXY[0] + (coordW / 2) + coordX + (width / 2)) > document.body.offsetWidth) {
925
- tooltip.style.left = canvasXY[0] + coordX - (width * 0.9) + (coordW / 2) + 'px';
926
- img.style.left = ((width * 0.9) - 8.5) + 'px';
969
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
970
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
927
971
 
928
972
  // Default positioning - CENTERED
929
973
  } else {
930
- tooltip.style.left = (canvasXY[0] + coordX + (coordW / 2) - (width * 0.5)) + 'px';
931
- img.style.left = ((width * 0.5) - 8.5) + 'px';
974
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
932
975
  }
933
976
  };
934
977
 
@@ -1075,23 +1118,45 @@
1075
1118
  co.save();
1076
1119
  // Draw a path to clip to
1077
1120
  co.beginPath();
1078
- co.rect(this.coords[0][0], this.coords[0][1], len, this.coords[0][3]);
1079
- co.clip();
1080
-
1081
- // Now draw the rect with a shadow
1082
- co.beginPath();
1083
-
1084
- co.shadowColor = 'black';
1085
- co.shadowOffsetX = 0;
1086
- co.shadowOffsetY = 0;
1087
- co.shadowBlur = 15;
1121
+ co.rect(
1122
+ this.coords[0][0],
1123
+ this.coords[0][1],
1124
+ len,
1125
+ this.coords[0][3]
1126
+ );
1127
+ co.clip();
1128
+
1129
+ co.save();
1130
+ // Draw a path to clip to
1131
+ co.beginPath();
1132
+ this.drawCurvedBar({
1133
+ x: this.coords[0][0],
1134
+ y: this.coords[0][1],
1135
+ width: len,
1136
+ height: this.coords[0][3]
1137
+ });
1138
+ co.clip();
1088
1139
 
1089
- co.lineWidth = 2;
1140
+ // Now draw the rect with a shadow
1141
+ co.beginPath();
1142
+
1143
+ co.shadowColor = 'black';
1144
+ co.shadowOffsetX = 0;
1145
+ co.shadowOffsetY = 0;
1146
+ co.shadowBlur = 15;
1147
+
1148
+ co.lineWidth = 2;
1149
+
1150
+ this.drawCurvedBar({
1151
+ x: this.coords[0][0] - 51,
1152
+ y: this.coords[0][1] - 1,
1153
+ width: len + 52,
1154
+ height: this.coords[0][3] + 2
1155
+ });
1090
1156
 
1091
- co.rect(this.coords[0][0] - 1, this.coords[0][1] - 1, len + 2, this.coords[0][3] + 2);
1092
-
1093
- co.stroke();
1094
-
1157
+ co.stroke();
1158
+
1159
+ co.restore();
1095
1160
  co.restore();
1096
1161
  };
1097
1162
 
@@ -1123,18 +1188,19 @@
1123
1188
  }
1124
1189
 
1125
1190
 
1126
- RG.Text2(this, {'font':font,
1127
- 'size':size,
1128
- 'x': typeof(prop['chart.title.x']) == 'number' ? prop['chart.title.x'] : x,
1129
- 'y': typeof(prop['chart.title.y']) == 'number' ? prop['chart.title.y'] : y,
1130
- 'text': text,
1131
- 'valign': prop['chart.title.valign'] ? prop['chart.title.valign'] : valign,
1132
- 'halign': prop['chart.title.halign'] ? prop['chart.title.halign'] : 'center',
1133
- 'bold':prop['chart.title.bold'],
1134
- 'bounding': prop['chart.title.background'] ? true : false,
1135
- 'boundingFill': prop['chart.title.background'],
1136
- 'tag': 'title'
1137
- });
1191
+ RG.Text2(this, {
1192
+ 'font':font,
1193
+ 'size':size,
1194
+ 'x': typeof(prop['chart.title.x']) == 'number' ? prop['chart.title.x'] : x,
1195
+ 'y': typeof(prop['chart.title.y']) == 'number' ? prop['chart.title.y'] : y,
1196
+ 'text': text,
1197
+ 'valign': prop['chart.title.valign'] ? prop['chart.title.valign'] : valign,
1198
+ 'halign': prop['chart.title.halign'] ? prop['chart.title.halign'] : 'center',
1199
+ 'bold':prop['chart.title.bold'],
1200
+ 'bounding': prop['chart.title.background'] ? true : false,
1201
+ 'boundingFill': prop['chart.title.background'],
1202
+ 'tag': 'title'
1203
+ });
1138
1204
  }
1139
1205
  };
1140
1206
 
@@ -1188,6 +1254,34 @@
1188
1254
 
1189
1255
 
1190
1256
 
1257
+ /**
1258
+ * Draws a bar with a curved end.
1259
+ *
1260
+ * DOESN'T DRAW A CURVED BAR ANY MORE - JUST A REGULAR SQUARE ENDED BAR
1261
+ *
1262
+ * @param object opt The coords and colours
1263
+ */
1264
+ this.drawCurvedBar = function (opt)
1265
+ {
1266
+ pa2(co, 'b r % % % %',
1267
+ opt.x, opt.y,
1268
+ opt.width, opt.height
1269
+ );
1270
+
1271
+ if (opt.stroke) {
1272
+ co.strokeStyle = opt.stroke;
1273
+ co.stroke();
1274
+ }
1275
+
1276
+ if (opt.fill) {
1277
+ co.fillStyle = opt.fill;
1278
+ co.fill();
1279
+ }
1280
+ }
1281
+
1282
+
1283
+
1284
+
1191
1285
  /**
1192
1286
  * This function runs once only
1193
1287
  * (put at the end of the file (before any effects))