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 |
@@ -64,11 +64,6 @@
64
64
 
65
65
 
66
66
 
67
- /**
68
- * Compatibility with older browsers
69
- */
70
- //RGraph.OldBrowserCompat(this.context);
71
-
72
67
 
73
68
  this.max = 0;
74
69
  this.stackedOrGrouped = false;
@@ -126,16 +121,32 @@
126
121
  'chart.title.valign': null,
127
122
  'chart.text.size': 12,
128
123
  'chart.text.color': 'black',
129
- 'chart.text.font': 'Arial',
124
+ 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
125
+ 'chart.text.accessible': true,
126
+ 'chart.text.accessible.overflow': 'visible',
127
+ 'chart.text.accessible.pointerevents': false,
130
128
  'chart.colors': ['Gradient(white:red)', 'Gradient(white:blue)', 'Gradient(white:green)', 'Gradient(white:pink)', 'Gradient(white:yellow)', 'Gradient(white:cyan)', 'Gradient(white:navy)', 'Gradient(white:gray)', 'Gradient(white:black)'],
131
129
  'chart.colors.sequential': false,
132
130
  'chart.xlabels.specific': null,
133
131
  'chart.labels': [],
134
132
  'chart.labels.bold': false,
135
133
  'chart.labels.color': null,
134
+
136
135
  'chart.labels.above': false,
137
136
  'chart.labels.above.decimals': 0,
138
137
  'chart.labels.above.specific': null,
138
+ 'chart.labels.above.color': null,
139
+ 'chart.labels.above.units.pre': '',
140
+ 'chart.labels.above.units.post': '',
141
+ 'chart.labels.above.font': null,
142
+ 'chart.labels.above.size': null,
143
+ 'chart.labels.above.bold': false,
144
+ 'chart.labels.above.italic': false,
145
+
146
+ 'chart.labels.offsetx': 0,
147
+ 'chart.labels.offsety': 0,
148
+ 'chart.xlabels.offsetx': 0,
149
+ 'chart.xlabels.offsety': 0,
139
150
  'chart.xlabels': true,
140
151
  'chart.xlabels.count': 5,
141
152
  'chart.contextmenu': null,
@@ -182,6 +193,7 @@
182
193
  'chart.tooltips.highlight': true,
183
194
  'chart.highlight.fill': 'rgba(255,255,255,0.7)',
184
195
  'chart.highlight.stroke': 'rgba(0,0,0,0)',
196
+ 'chart.highlight.style': null,
185
197
  'chart.annotatable': false,
186
198
  'chart.annotate.color': 'black',
187
199
  'chart.zoom.factor': 1.5,
@@ -200,7 +212,7 @@
200
212
  'chart.scale.point': '.',
201
213
  'chart.scale.thousand': ',',
202
214
  'chart.scale.decimals': null,
203
- 'chart.scale.zerostart': false,
215
+ 'chart.scale.zerostart': true,
204
216
  'chart.noredraw': false,
205
217
  'chart.events.click': null,
206
218
  'chart.events.mousemove': null,
@@ -218,7 +230,8 @@
218
230
  'chart.variant.threed.xaxis': true,
219
231
  'chart.variant.threed.yaxis': true,
220
232
  'chart.yaxispos': 'left',
221
- 'chart.variant': 'hbar'
233
+ 'chart.variant': 'hbar',
234
+ 'chart.clearto': 'rgba(0,0,0,0)'
222
235
  }
223
236
 
224
237
  // Check for support
@@ -227,9 +240,21 @@
227
240
  return;
228
241
  }
229
242
 
243
+ // This loop is used to check for stacked or grouped charts and now
244
+ // also to convert strings to numbers
230
245
  for (i=0,len=this.data.length; i<len; ++i) {
231
- if (typeof this.data[i] == 'object') {
246
+ if (typeof this.data[i] == 'object' && !RGraph.isNull(this.data[i])) {
247
+
232
248
  this.stackedOrGrouped = true;
249
+
250
+ for (var j=0,len2=this.data[i].length; j<len2; ++j) {
251
+ if (typeof this.data[i][j] === 'string') {
252
+ this.data[i][j] = parseFloat(this.data[i][j]);
253
+ }
254
+ }
255
+
256
+ } else if (typeof this.data[i] == 'string') {
257
+ this.data[i] = parseFloat(this.data[i]) || 0;
233
258
  }
234
259
  }
235
260
 
@@ -268,7 +293,6 @@
268
293
  ca = this.canvas,
269
294
  co = ca.getContext('2d'),
270
295
  prop = this.properties,
271
- pa = RG.Path,
272
296
  pa2 = RG.path2,
273
297
  win = window,
274
298
  doc = document,
@@ -319,10 +343,9 @@
319
343
 
320
344
 
321
345
  // Convert uppercase letters to dot+lower case letter
322
- name = name.replace(/([A-Z])/g, function (str)
323
- {
324
- return '.' + String(RegExp.$1).toLowerCase()
325
- });
346
+ while(name.match(/([A-Z])/)) {
347
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
348
+ }
326
349
 
327
350
  if (name == 'chart.labels.abovebar') {
328
351
  name = 'chart.labels.above';
@@ -385,8 +408,14 @@
385
408
  //
386
409
  // If the chart is 3d then angle it it
387
410
  //
411
+
388
412
  if (prop['chart.variant'] === '3d') {
389
- co.setTransform(1,prop['chart.variant.threed.angle'],0,1,0.5,0.5);
413
+
414
+ if (prop['chart.text.accessible']) {
415
+ // Nada
416
+ } else {
417
+ co.setTransform(1,prop['chart.variant.threed.angle'],0,1,0.5,0.5);
418
+ }
390
419
 
391
420
  // Enlarge the gutter if its 25
392
421
  if (prop['chart.gutter.bottom'] === 25) {
@@ -720,7 +749,9 @@
720
749
  var units_pre = prop['chart.units.pre'],
721
750
  units_post = prop['chart.units.post'],
722
751
  text_size = prop['chart.text.size'],
723
- font = prop['chart.text.font'];
752
+ font = prop['chart.text.font'],
753
+ offsetx = prop['chart.xlabels.offsetx'],
754
+ offsety = prop['chart.xlabels.offsety']
724
755
 
725
756
 
726
757
 
@@ -742,7 +773,7 @@
742
773
  * Specific X labels
743
774
  */
744
775
  if (RG.isArray(prop['chart.xlabels.specific'])) {
745
-
776
+
746
777
  if (prop['chart.yaxispos'] == 'center') {
747
778
 
748
779
  var halfGraphWidth = this.graphwidth / 2;
@@ -750,27 +781,31 @@
750
781
  var interval = (this.graphwidth / 2) / (labels.length - 1);
751
782
 
752
783
  co.fillStyle = prop['chart.text.color'];
753
-
784
+
754
785
  for (var i=0; i<labels.length; i+=1) {
755
- RG.Text2(this, {'font':font,
756
- 'size':text_size,
757
- 'x':this.gutterLeft + halfGraphWidth + (interval * i),
758
- 'y':ca.height - this.gutterBottom,
759
- 'text':labels[i],
760
- 'valign':'top',
761
- 'halign':'center',
762
- 'tag': 'scale'});
786
+ RG.text2(this, {
787
+ 'font':font,
788
+ 'size':text_size,
789
+ 'x':this.gutterLeft + halfGraphWidth + (interval * i) + offsetx,
790
+ 'y':ca.height - this.gutterBottom + offsetx,
791
+ 'text':labels[i],
792
+ 'valign':'top',
793
+ 'halign':'center',
794
+ 'tag': 'scale'
795
+ });
763
796
  }
764
797
 
765
798
  for (var i=(labels.length - 1); i>0; i-=1) {
766
- RG.Text2(this, {'font':font,
767
- 'size':text_size,
768
- 'x':this.gutterLeft + (interval * (labels.length - i - 1)),
769
- 'y':ca.height - this.gutterBottom,
770
- 'text':labels[i],
771
- 'valign':'top',
772
- 'halign':'center',
773
- 'tag': 'scale'});
799
+ RG.Text2(this, {
800
+ 'font':font,
801
+ 'size':text_size,
802
+ 'x':this.gutterLeft + (interval * (labels.length - i - 1)) + offsetx,
803
+ 'y':ca.height - this.gutterBottom + offsety,
804
+ 'text':labels[i],
805
+ 'valign':'top',
806
+ 'halign':'center',
807
+ 'tag': 'scale'
808
+ });
774
809
  }
775
810
 
776
811
  } else if (prop['chart.yaxispos'] == 'right') {
@@ -781,14 +816,16 @@
781
816
  co.fillStyle = prop['chart.text.color'];
782
817
 
783
818
  for (var i=0; i<labels.length; i+=1) {
784
- RG.Text2(this, {'font':font,
785
- 'size':text_size,
786
- 'x':this.gutterLeft + (interval * i),
787
- 'y':ca.height - this.gutterBottom,
788
- 'text':labels[labels.length - i - 1],
789
- 'valign':'top',
790
- 'halign':'center',
791
- 'tag': 'scale'});
819
+ RG.text2(this, {
820
+ 'font':font,
821
+ 'size':text_size,
822
+ 'x':this.gutterLeft + (interval * i) + offsetx,
823
+ 'y':ca.height - this.gutterBottom + offsety,
824
+ 'text':labels[labels.length - i - 1],
825
+ 'valign':'top',
826
+ 'halign':'center',
827
+ 'tag': 'scale'
828
+ });
792
829
  }
793
830
 
794
831
  } else {
@@ -799,14 +836,16 @@
799
836
  co.fillStyle = prop['chart.text.color'];
800
837
 
801
838
  for (var i=0; i<labels.length; i+=1) {
802
- RG.Text2(this, {'font':font,
803
- 'size':text_size,
804
- 'x':this.gutterLeft + (interval * i),
805
- 'y':ca.height - this.gutterBottom,
806
- 'text':labels[i],
807
- 'valign':'top',
808
- 'halign':'center',
809
- 'tag': 'scale'});
839
+ RG.Text2(this, {
840
+ 'font':font,
841
+ 'size':text_size,
842
+ 'x':this.gutterLeft + (interval * i) + offsetx,
843
+ 'y':ca.height - this.gutterBottom + offsety,
844
+ 'text':labels[i],
845
+ 'valign':'top',
846
+ 'halign':'center',
847
+ 'tag': 'scale'
848
+ });
810
849
  }
811
850
  }
812
851
 
@@ -827,8 +866,8 @@
827
866
  RG.text2(this, {
828
867
  'font':font,
829
868
  'size':text_size,
830
- 'x':this.gutterLeft + (this.graphwidth / 2) - ((this.graphwidth / 2) * ((i+1)/this.scale2.labels.length)),
831
- 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap,
869
+ 'x':this.gutterLeft + (this.graphwidth / 2) - ((this.graphwidth / 2) * ((i+1)/this.scale2.labels.length)) + offsetx,
870
+ 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap + offsety,
832
871
  'text':'-' + this.scale2.labels[i],
833
872
  'valign':'center',
834
873
  'halign':'center',
@@ -840,8 +879,8 @@
840
879
  RG.text2(this, {
841
880
  'font':font,
842
881
  'size':text_size,
843
- 'x':this.gutterLeft + ((this.graphwidth / 2) * ((i+1)/this.scale2.labels.length)) + (this.graphwidth / 2),
844
- 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap,
882
+ 'x':this.gutterLeft + ((this.graphwidth / 2) * ((i+1)/this.scale2.labels.length)) + (this.graphwidth / 2) + offsetx,
883
+ 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap + offsety,
845
884
  'text':this.scale2.labels[i],
846
885
  'valign':'center',
847
886
  'halign':'center',
@@ -856,8 +895,8 @@
856
895
  RG.Text2(this, {
857
896
  'font':font,
858
897
  'size':text_size,
859
- 'x':this.gutterLeft + (i * (this.graphwidth / len)),
860
- 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap,
898
+ 'x':this.gutterLeft + (i * (this.graphwidth / len)) + offsetx,
899
+ 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap + offsety,
861
900
  'text':'-' + this.scale2.labels[len - 1 - i],
862
901
  'valign':'center',
863
902
  'halign':'center',
@@ -871,8 +910,8 @@
871
910
  RG.Text2(this, {
872
911
  'font':font,
873
912
  'size':text_size,
874
- 'x':this.gutterLeft + (this.graphwidth * ((i+1)/len)),
875
- 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap,
913
+ 'x':this.gutterLeft + (this.graphwidth * ((i+1)/len)) + offsetx,
914
+ 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap + offsety,
876
915
  'text':this.scale2.labels[i],
877
916
  'valign':'center',
878
917
  'halign':'center',
@@ -898,8 +937,8 @@
898
937
  RG.text2(this, {
899
938
  'font':font,
900
939
  'size':text_size,
901
- 'x':x,
902
- 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap,
940
+ 'x':x + offsetx,
941
+ 'y':this.gutterTop + this.halfTextHeight + this.graphheight + gap + offsety,
903
942
  'text':RG.numberFormat(this, prop['chart.xmin'].toFixed(prop['chart.scale.decimals']), units_pre, units_post),
904
943
  'valign':'center',
905
944
  'halign':'center',
@@ -926,7 +965,9 @@
926
965
  var xOffset = prop['chart.variant'] === '3d' && prop['chart.yaxispos'] === 'right' ? 15 : 5,
927
966
  font = prop['chart.text.font'],
928
967
  color = prop['chart.labels.color'] || prop['chart.text.color'],
929
- bold = prop['chart.labels.bold']
968
+ bold = prop['chart.labels.bold'],
969
+ offsetx = prop['chart.labels.offsetx'],
970
+ offsety = prop['chart.labels.offsety']
930
971
 
931
972
 
932
973
  // Draw the X axis labels
@@ -957,8 +998,8 @@
957
998
  'font': font,
958
999
  'size': prop['chart.text.size'],
959
1000
  'bold': bold,
960
- 'x': x,
961
- 'y': y,
1001
+ 'x': x + offsetx,
1002
+ 'y': y + offsety,
962
1003
  'text': String(prop['chart.labels'][i++]),
963
1004
  'halign': halign,
964
1005
  'valign': 'center',
@@ -1675,15 +1716,18 @@
1675
1716
  co.strokeStyle = prop['chart.strokestyle'];
1676
1717
 
1677
1718
  for (var i=0; i<coords.length; ++i) {
1678
-
1719
+
1679
1720
  if (prop['chart.shadow']) {
1680
- co.beginPath();
1681
- co.strokeStyle = prop['chart.strokestyle'];
1682
- co.fillStyle = coords[i][4];
1683
- co.lineWidth = prop['chart.linewidth'];
1684
- co.rect(coords[i][0], coords[i][1], coords[i][2], coords[i][3]);
1685
- co.stroke();
1686
- co.fill();
1721
+
1722
+ pa2(co, 'b lw % r % % % % s % f %',
1723
+ prop['chart.linewidth'],
1724
+ coords[i][0],
1725
+ coords[i][1],
1726
+ coords[i][2],
1727
+ coords[i][3],
1728
+ prop['chart.strokestyle'],
1729
+ coords[i][4]
1730
+ );
1687
1731
  }
1688
1732
 
1689
1733
  /**
@@ -1692,20 +1736,20 @@
1692
1736
  var halign = 'left';
1693
1737
  if (prop['chart.labels.above'] && coords[i][6]) {
1694
1738
 
1695
- co.fillStyle = prop['chart.text.color'];
1696
- co.strokeStyle = 'black';
1739
+ var border = (coords[i][0] + coords[i][2] + 7 + co.measureText(prop['chart.labels.above.units.pre'] + this.coords[i][5] + prop['chart.labels.above.units.post']).width) > ca.width ? true : false,
1740
+ text = RG.numberFormat(this, (this.coords[i][5]).toFixed(prop['chart.labels.above.decimals']), prop['chart.labels.above.units.pre'], prop['chart.labels.above.units.post']);
1741
+
1697
1742
  RG.noShadow(this);
1698
-
1699
- var border = (coords[i][0] + coords[i][2] + 7 + co.measureText(prop['chart.units.pre'] + this.coords[i][5] + prop['chart.units.post']).width) > ca.width ? true : false;
1700
1743
 
1701
1744
  /**
1702
1745
  * Default to the value - then check for specific labels
1703
1746
  */
1704
- var text = RG.numberFormat(this, (this.coords[i][5]).toFixed(prop['chart.labels.above.decimals']), prop['chart.units.pre'], prop['chart.units.post']);
1705
- if (typeof prop['chart.labels.above.specific'] == 'object' && prop['chart.labels.above.specific'] && prop['chart.labels.above.specific'][i]) {
1747
+
1748
+
1749
+ if (typeof prop['chart.labels.above.specific'] === 'object' && prop['chart.labels.above.specific'] && prop['chart.labels.above.specific'][i]) {
1706
1750
  text = prop['chart.labels.above.specific'][i];
1707
1751
  }
1708
-
1752
+
1709
1753
  var x = coords[i][0] + coords[i][2] + 5;
1710
1754
  var y = coords[i][1] + (coords[i][3] / 2);
1711
1755
 
@@ -1718,14 +1762,17 @@
1718
1762
  }
1719
1763
 
1720
1764
  RG.text2(this, {
1721
- 'font': font,
1722
- 'size': size,
1723
- 'x': x,
1724
- 'y': y,
1725
- 'text': text,
1726
- 'valign': 'center',
1727
- 'halign': halign,
1728
- 'tag': 'labels.above'
1765
+ font: typeof prop['chart.labels.above.font'] === 'string' ? prop['chart.labels.above.font'] : font,
1766
+ size: typeof prop['chart.labels.above.size'] === 'number' ? prop['chart.labels.above.size'] : size,
1767
+ color: typeof prop['chart.labels.above.color'] ==='string' ? prop['chart.labels.above.color'] : color,
1768
+ x: x,
1769
+ y: y,
1770
+ bold: prop['chart.labels.above.bold'],
1771
+ italic: prop['chart.labels.above.italic'],
1772
+ text: text,
1773
+ valign: 'center',
1774
+ halign: halign,
1775
+ tag: 'labels.above'
1729
1776
  });
1730
1777
  }
1731
1778
  }
@@ -1762,7 +1809,7 @@
1762
1809
 
1763
1810
  // Recreate the path/rectangle so that it can be tested
1764
1811
  // ** DO NOT STROKE OR FILL IT **
1765
- pa(co,['b','r',left,top,width,height]);
1812
+ pa2(co,['b','r',left,top,width,height]);
1766
1813
 
1767
1814
  if (co.isPointInPath(mouseX, mouseY)) {
1768
1815
 
@@ -1841,8 +1888,11 @@
1841
1888
  this.highlight =
1842
1889
  this.Highlight = function (shape)
1843
1890
  {
1844
- // Add the new highlight
1845
- RG.Highlight.Rect(this, shape);
1891
+ if (typeof prop['chart.highlight.style'] === 'function') {
1892
+ (prop['chart.highlight.style'])(shape);
1893
+ } else {
1894
+ RG.Highlight.Rect(this, shape);
1895
+ }
1846
1896
  };
1847
1897
 
1848
1898
 
@@ -1912,35 +1962,24 @@
1912
1962
 
1913
1963
  // Set the top position
1914
1964
  tooltip.style.left = 0;
1915
- tooltip.style.top = canvasXY[1] + coordY - height + 5 + (adjustment || 0) + 'px';
1965
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
1916
1966
 
1917
1967
  // By default any overflow is hidden
1918
1968
  tooltip.style.overflow = '';
1919
-
1920
- // The arrow
1921
- var img = new Image();
1922
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
1923
- img.style.position = 'absolute';
1924
- img.id = '__rgraph_tooltip_pointer__';
1925
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
1926
- tooltip.appendChild(img);
1927
1969
 
1928
1970
  // Reposition the tooltip if at the edges:
1929
1971
 
1930
1972
  // LEFT edge
1931
- if ((canvasXY[0] + coordX + (coordW / 2) - (width / 2)) < 10) {
1932
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.1)) + (coordW / 2) + 'px';
1933
- img.style.left = ((width * 0.1) - 8.5) + 'px';
1973
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
1974
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
1934
1975
 
1935
1976
  // RIGHT edge
1936
- } else if ((canvasXY[0] + (coordW / 2) + coordX + (width / 2)) > doc.body.offsetWidth) {
1937
- tooltip.style.left = canvasXY[0] + coordX - (width * 0.9) + (coordW / 2) + 'px';
1938
- img.style.left = ((width * 0.9) - 8.5) + 'px';
1977
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
1978
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
1939
1979
 
1940
1980
  // Default positioning - CENTERED
1941
1981
  } else {
1942
- tooltip.style.left = (canvasXY[0] + coordX + (coordW / 2) - (width * 0.5)) + 'px';
1943
- img.style.left = ((width * 0.5) - 8.5) + 'px';
1982
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
1944
1983
  }
1945
1984
  };
1946
1985
 
@@ -2142,11 +2181,14 @@
2142
2181
  */
2143
2182
  this.grow = function ()
2144
2183
  {
2145
- var obj = this,
2146
- opt = arguments[0] || {},
2147
- frames = opt.frames || 30,
2148
- frame = 0,
2149
- callback = arguments[1] || function () {};
2184
+ var obj = this,
2185
+ opt = arguments[0] || {},
2186
+ frames = opt.frames || 30,
2187
+ frame = 0,
2188
+ callback = arguments[1] || function () {},
2189
+ labelsAbove = prop['chart.labels.above'];
2190
+
2191
+ this.set('labelsAbove', false);
2150
2192
 
2151
2193
 
2152
2194
  // Save the data
@@ -2197,6 +2239,12 @@
2197
2239
  frame += 1;
2198
2240
  RG.Effects.updateCanvas(iterator);
2199
2241
  } else {
2242
+
2243
+ if (labelsAbove) {
2244
+ obj.set('labelsAbove', true);
2245
+ RG.redraw();
2246
+ }
2247
+
2200
2248
  callback(obj);
2201
2249
  }
2202
2250
  }
@@ -2227,7 +2275,10 @@
2227
2275
  var framesperbar = opt.frames / 3,
2228
2276
  frame = -1,
2229
2277
  callback = arguments[1] || function () {},
2230
- original = RG.arrayClone(obj.data);
2278
+ original = RG.arrayClone(obj.data),
2279
+ labelsAbove = prop['chart.labels.above'];
2280
+
2281
+ this.set('labelsAbove', false);
2231
2282
 
2232
2283
  for (var i=0,len=obj.data.length; i<len; i+=1) {
2233
2284
  opt.startFrames[i] = ((opt.frames / 2) / (obj.data.length - 1)) * i;
@@ -2254,39 +2305,45 @@
2254
2305
  ++frame;
2255
2306
 
2256
2307
  for (var i=0,len=obj.data.length; i<len; i+=1) {
2257
- if (frame > opt.startFrames[i]) {
2258
- if (typeof obj.data[i] === 'number') {
2308
+ if (frame > opt.startFrames[i]) {
2309
+ if (typeof obj.data[i] === 'number') {
2310
+
2311
+ obj.data[i] = ma.min(
2312
+ ma.abs(original[i]),
2313
+ ma.abs(original[i] * ( (opt.counters[i]++) / framesperbar))
2314
+ );
2315
+
2316
+ // Make the number negative if the original was
2317
+ if (original[i] < 0) {
2318
+ obj.data[i] *= -1;
2319
+ }
2320
+ } else if (!RG.isNull(obj.data[i])) {
2321
+ for (var j=0,len2=obj.data[i].length; j<len2; j+=1) {
2259
2322
 
2260
- obj.data[i] = ma.min(
2261
- ma.abs(original[i]),
2262
- ma.abs(original[i] * ( (opt.counters[i]++) / framesperbar))
2323
+ obj.data[i][j] = ma.min(
2324
+ ma.abs(original[i][j]),
2325
+ ma.abs(original[i][j] * ( (opt.counters[i][j]++) / framesperbar))
2263
2326
  );
2264
-
2265
- // Make the number negative if the original was
2266
- if (original[i] < 0) {
2267
- obj.data[i] *= -1;
2268
- }
2269
- } else if (!RG.isNull(obj.data[i])) {
2270
- for (var j=0,len2=obj.data[i].length; j<len2; j+=1) {
2271
-
2272
- obj.data[i][j] = ma.min(
2273
- ma.abs(original[i][j]),
2274
- ma.abs(original[i][j] * ( (opt.counters[i][j]++) / framesperbar))
2275
- );
2276
2327
 
2277
- // Make the number negative if the original was
2278
- if (original[i][j] < 0) {
2279
- obj.data[i][j] *= -1;
2280
- }
2328
+ // Make the number negative if the original was
2329
+ if (original[i][j] < 0) {
2330
+ obj.data[i][j] *= -1;
2281
2331
  }
2282
2332
  }
2283
- } else {
2284
- obj.data[i] = typeof obj.data[i] === 'object' && obj.data[i] ? RG.arrayPad([], obj.data[i].length, 0) : (RG.isNull(obj.data[i]) ? null : 0);
2285
2333
  }
2334
+ } else {
2335
+ obj.data[i] = typeof obj.data[i] === 'object' && obj.data[i] ? RG.arrayPad([], obj.data[i].length, 0) : (RG.isNull(obj.data[i]) ? null : 0);
2336
+ }
2286
2337
  }
2287
2338
 
2288
2339
 
2289
2340
  if (frame >= opt.frames) {
2341
+
2342
+ if (labelsAbove) {
2343
+ obj.set('labelsAbove', true);
2344
+ RG.redrawCanvas(obj.canvas);
2345
+ }
2346
+
2290
2347
  callback(obj);
2291
2348
  } else {
2292
2349
  RG.redrawCanvas(obj.canvas);