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
@@ -33,7 +33,7 @@
33
33
  var parseConfObjectForOptions = true; // Set this so the config is parsed (at the end of the constructor)
34
34
 
35
35
  // Turn conf.data into a multi-d array if it's not already
36
- if (typeof conf.data[0] === 'number') {
36
+ if (typeof conf.data[0] === 'number' || typeof conf.data[0] === 'string') {
37
37
  conf.data = [conf.data];
38
38
  }
39
39
 
@@ -78,8 +78,19 @@
78
78
 
79
79
  /**
80
80
  * Add the data to the .original_data array and work out the max value
81
+ *
82
+ * 2/5/14 Now also use this loop to ensure that the data pieces
83
+ * are numbers
81
84
  */
82
85
  for (var i=0,len=conf.data.length; i<len; ++i) {
86
+
87
+ // Convert strings to numbers
88
+ for (var j=0; j<conf.data[i].length; ++j) {
89
+ if (typeof conf.data[i][j] === 'string') {
90
+ conf.data[i][j] = parseFloat(conf.data[i][j]);
91
+ }
92
+ }
93
+
83
94
  this.original_data.push(RGraph.arrayClone(conf.data[i]));
84
95
  this.data.push(RGraph.arrayClone(conf.data[i]));
85
96
  this.max = Math.max(this.max, RGraph.arrayMax(conf.data[i]));
@@ -119,8 +130,11 @@
119
130
  'chart.background.circles.spokes': 24,
120
131
  'chart.text.size': 12,
121
132
  'chart.text.size.scale': null,
122
- 'chart.text.font': 'Arial',
133
+ 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
123
134
  'chart.text.color': 'black',
135
+ 'chart.text.accessible': true,
136
+ 'chart.text.accessible.overflow': 'visible',
137
+ 'chart.text.accessible.pointerevents': false,
124
138
  'chart.title': '',
125
139
  'chart.title.background': null,
126
140
  'chart.title.hpos': null,
@@ -204,7 +218,8 @@
204
218
  'chart.fill.highlight.fill': 'rgba(255,255,255,0.7)',
205
219
  'chart.fill.highlight.stroke': 'rgba(0,0,0,0)',
206
220
  'chart.fill.mousemove.redraw': false,
207
- 'chart.animation.trace.clip': 1
221
+ 'chart.animation.trace.clip': 1,
222
+ 'chart.clearto': 'rgba(0,0,0,0)'
208
223
  }
209
224
 
210
225
 
@@ -248,7 +263,6 @@
248
263
  ca = this.canvas,
249
264
  co = ca.getContext('2d'),
250
265
  prop = this.properties,
251
- pa = RG.Path,
252
266
  pa2 = RG.path2,
253
267
  win = window,
254
268
  doc = document,
@@ -301,10 +315,9 @@
301
315
 
302
316
 
303
317
  // Convert uppercase letters to dot+lower case letter
304
- name = name.replace(/([A-Z])/g, function (str)
305
- {
306
- return '.' + String(RegExp.$1).toLowerCase();
307
- });
318
+ while(name.match(/([A-Z])/)) {
319
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
320
+ }
308
321
 
309
322
 
310
323
 
@@ -1232,8 +1245,11 @@
1232
1245
  this.highlight =
1233
1246
  this.Highlight = function (shape)
1234
1247
  {
1235
- // Add the new highlight
1236
- RG.Highlight.Point(this, shape);
1248
+ if (typeof prop['chart.highlight.style'] === 'function') {
1249
+ (prop['chart.highlight.style'])(shape);
1250
+ } else {
1251
+ RG.Highlight.Point(this, shape);
1252
+ }
1237
1253
  };
1238
1254
 
1239
1255
 
@@ -1282,38 +1298,29 @@
1282
1298
  var gutterLeft = this.gutterLeft;
1283
1299
  var gutterTop = this.gutterTop;
1284
1300
  var width = tooltip.offsetWidth;
1301
+ var height = tooltip.offsetHeight;
1302
+ var mouseXY = RG.getMouseXY(window.event);
1285
1303
 
1286
1304
  // Set the top position
1287
1305
  tooltip.style.left = 0;
1288
- tooltip.style.top = parseInt(tooltip.style.top) - 9 + 'px';
1306
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
1289
1307
 
1290
1308
  // By default any overflow is hidden
1291
1309
  tooltip.style.overflow = '';
1292
-
1293
- // The arrow
1294
- var img = new Image();
1295
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
1296
- img.style.position = 'absolute';
1297
- img.id = '__rgraph_tooltip_pointer__';
1298
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
1299
- tooltip.appendChild(img);
1300
1310
 
1301
1311
  // Reposition the tooltip if at the edges:
1302
1312
 
1303
1313
  // LEFT edge
1304
- if ((canvasXY[0] + coordX - (width / 2)) < 10) {
1305
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.1)) + 'px';
1306
- img.style.left = ((width * 0.1) - 8.5) + 'px';
1314
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
1315
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
1307
1316
 
1308
1317
  // RIGHT edge
1309
- } else if ((canvasXY[0] + coordX + (width / 2)) > doc.body.offsetWidth) {
1310
- tooltip.style.left = canvasXY[0] + coordX - (width * 0.9) + 'px';
1311
- img.style.left = ((width * 0.9) - 8.5) + 'px';
1318
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
1319
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
1312
1320
 
1313
1321
  // Default positioning - CENTERED
1314
1322
  } else {
1315
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.5)) + 'px';
1316
- img.style.left = ((width * 0.5) - 8.5) + 'px';
1323
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
1317
1324
  }
1318
1325
  };
1319
1326
 
@@ -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
@@ -104,8 +104,11 @@
104
104
  'chart.labels.boxed': false,
105
105
  'chart.labels.offset': 0,
106
106
  'chart.text.color': 'black',
107
- 'chart.text.font': 'Arial',
107
+ 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
108
108
  'chart.text.size': 12,
109
+ 'chart.text.accessible': true,
110
+ 'chart.text.accessible.overflow': 'visible',
111
+ 'chart.text.accessible.pointerevents': false,
109
112
  'chart.key': null,
110
113
  'chart.key.background': 'white',
111
114
  'chart.key.position': 'graph',
@@ -168,8 +171,25 @@
168
171
  'chart.segment.highlight': false,
169
172
  'chart.segment.highlight.count': null,
170
173
  'chart.segment.highlight.fill': 'rgba(0,255,0,0.5)',
171
- 'chart.segment.highlight.stroke': 'rgba(0,0,0,0)'
174
+ 'chart.segment.highlight.stroke': 'rgba(0,0,0,0)',
175
+ 'chart.clearto': 'rgba(0,0,0,0)'
172
176
  }
177
+
178
+
179
+
180
+ // Go through the data converting it to numbers
181
+ for (var i=0; i<this.data.length; ++i) {
182
+ if (typeof this.data[i] === 'string') {
183
+ this.data[i] = parseFloat(this.data[i]);
184
+ } else if (typeof this.data[i] === 'object') {
185
+ for (var j=0; j<this.data[i].length; ++j) {
186
+ if (typeof this.data[i][j] === 'string') {
187
+ this.data[i][j] = parseFloat(this.data[i][j]);
188
+ }
189
+ }
190
+ }
191
+ }
192
+
173
193
 
174
194
 
175
195
 
@@ -201,7 +221,6 @@
201
221
  ca = this.canvas,
202
222
  co = ca.getContext('2d'),
203
223
  prop = this.properties,
204
- pa = RG.Path,
205
224
  pa2 = RG.path2,
206
225
  win = window,
207
226
  doc = document,
@@ -251,10 +270,9 @@
251
270
 
252
271
 
253
272
  // Convert uppercase letters to dot+lower case letter
254
- name = name.replace(/([A-Z])/g, function (str)
255
- {
256
- return '.' + String(RegExp.$1).toLowerCase();
257
- });
273
+ while(name.match(/([A-Z])/)) {
274
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
275
+ }
258
276
 
259
277
 
260
278
 
@@ -414,7 +432,7 @@
414
432
 
415
433
  var a = this.angles[j];
416
434
 
417
- pa(co, [
435
+ pa2(co, [
418
436
  'b',
419
437
  'm', a[4], a[5],
420
438
  'a', a[4], a[5], a[3] + 1.5, a[0] - 0.01, a[1] + 0.01, false,
@@ -1014,8 +1032,8 @@
1014
1032
  'valign':'center',
1015
1033
  'halign':'right',
1016
1034
  'bounding':true,
1017
- 'boundingFill':color,
1018
- 'boundingStroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1035
+ 'bounding.fill':color,
1036
+ 'bounding.stroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1019
1037
  'tag': 'scale'
1020
1038
  });
1021
1039
  }
@@ -1033,8 +1051,8 @@
1033
1051
  'valign':'center',
1034
1052
  'halign':'right',
1035
1053
  'bounding':true,
1036
- 'boundingFill':color,
1037
- 'boundingStroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1054
+ 'bounding.fill':color,
1055
+ 'bounding.stroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1038
1056
  'tag': 'scale'
1039
1057
  });
1040
1058
  }
@@ -1052,8 +1070,8 @@
1052
1070
  'valign':'top',
1053
1071
  'halign':'center',
1054
1072
  'bounding':true,
1055
- 'boundingFill':color,
1056
- 'boundingStroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1073
+ 'bounding.fill':color,
1074
+ 'bounding.stroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1057
1075
  'tag': 'scale'
1058
1076
  });
1059
1077
  }
@@ -1071,8 +1089,8 @@
1071
1089
  'valign':'top',
1072
1090
  'halign':'center',
1073
1091
  'bounding':true,
1074
- 'boundingFill':color,
1075
- 'boundingStroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1092
+ 'bounding.fill':color,
1093
+ 'bounding.stroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1076
1094
  'tag': 'scale'
1077
1095
  });
1078
1096
  }
@@ -1088,8 +1106,8 @@
1088
1106
  'valign':'center',
1089
1107
  'halign':'center',
1090
1108
  'bounding':true,
1091
- 'boundingFill':color,
1092
- 'boundingStroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1109
+ 'bounding.fill':color,
1110
+ 'bounding.stroke':prop['chart.labels.boxed'] ? 'black' : 'rgba(0,0,0,0)',
1093
1111
  'tag': 'scale'
1094
1112
  });
1095
1113
  }
@@ -1342,6 +1360,14 @@
1342
1360
  this.Highlight = function (shape)
1343
1361
  {
1344
1362
  if (prop['chart.tooltips.highlight']) {
1363
+
1364
+
1365
+ if (typeof prop['chart.highlight.style'] === 'function'){
1366
+ (prop['chart.highlight.style'])(shape);
1367
+ return;
1368
+ }
1369
+
1370
+
1345
1371
  // Add the new segment highlight
1346
1372
  co.beginPath();
1347
1373
 
@@ -1437,42 +1463,33 @@
1437
1463
  radius = ((radiusEnd - radiusStart) / 2) + radiusStart,
1438
1464
  angleCenter = ((angleEnd - angleStart) / 2) + angleStart,
1439
1465
  canvasXY = RG.getCanvasXY(this.canvas),
1466
+ mouseXY = RG.getMouseXY(window.event),
1440
1467
  gutterLeft = this.gutterLeft,
1441
1468
  gutterTop = this.gutterTop,
1442
1469
  width = tooltip.offsetWidth,
1443
1470
  height = tooltip.offsetHeight
1444
-
1471
+
1472
+
1473
+ // Set the top position
1474
+ tooltip.style.left = 0;
1475
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
1476
+
1445
1477
  // By default any overflow is hidden
1446
1478
  tooltip.style.overflow = '';
1447
-
1448
- // The arrow
1449
- var img = new Image();
1450
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
1451
- img.style.position = 'absolute';
1452
- img.id = '__rgraph_tooltip_pointer__';
1453
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
1454
- tooltip.appendChild(img);
1455
1479
 
1456
1480
  // Reposition the tooltip if at the edges:
1457
1481
 
1458
1482
  // LEFT edge
1459
- if ((canvasXY[0] + coordX + (Math.cos(angleCenter) * radius) - (width / 2)) < 10) {
1460
- tooltip.style.left = (canvasXY[0] + coordX + (Math.cos(angleCenter) * (radius * (prop['chart.variant'].indexOf('3d') !== -1 ? 1.5 : 1)) )- (width * 0.1)) + 'px';
1461
- tooltip.style.top = (canvasXY[1] + coordY + (Math.sin(angleCenter) * radius)- height - 5) + 'px';
1462
- img.style.left = ((width * 0.1) - 8.5) + 'px';
1483
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
1484
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
1463
1485
 
1464
1486
  // RIGHT edge
1465
- } else if ((canvasXY[0] + coordX + (Math.cos(angleCenter) * radius) + (width / 2)) > (doc.body.offsetWidth - 10) ) {
1466
- tooltip.style.left = (canvasXY[0] + coordX + (Math.cos(angleCenter) * (radius * (prop['chart.variant'].indexOf('3d') !== -1 ? 1.5 : 1)) ) - (width * 0.9)) + 'px';
1467
- tooltip.style.top = (canvasXY[1] + coordY + (Math.sin(angleCenter) * radius)- height - 5) + 'px';
1468
- img.style.left = ((width * 0.9) - 8.5) + 'px';
1487
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
1488
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
1469
1489
 
1470
1490
  // Default positioning - CENTERED
1471
1491
  } else {
1472
-
1473
- tooltip.style.left = (canvasXY[0] + coordX + (ma.cos(angleCenter) * (radius * (prop['chart.variant'].indexOf('3d') !== -1 ? 1.5 : 1) ) )- (width / 2)) + 'px';
1474
- tooltip.style.top = (canvasXY[1] + coordY + (ma.sin(angleCenter) * radius)- height - 5) + 'px';
1475
- img.style.left = ((width * 0.5) - 8.5) + 'px';
1492
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
1476
1493
  }
1477
1494
  };
1478
1495
 
@@ -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
@@ -91,17 +91,25 @@
91
91
  this.firstDraw = true; // After the first draw this will be false
92
92
 
93
93
 
94
- /**
95
- * Compatibility with older browsers
96
- */
97
- //RGraph.OldBrowserCompat(this.context);
98
-
99
-
100
94
  this.centerx = 0;
101
95
  this.centery = 0;
102
96
  this.radius = 0;
103
97
  this.max = 0;
104
-
98
+
99
+ // Convert all of the data pieces to numbers
100
+ for (var i=0; i<this.data.length; ++i) {
101
+ for (var j=0; j<this.data[i].length; ++j) {
102
+ if (typeof this.data[i][j][0] === 'string') {
103
+ this.data[i][j][0] = parseFloat(this.data[i][j][0]);
104
+ }
105
+
106
+ if (typeof this.data[i][j][1] === 'string') {
107
+ this.data[i][j][1] = parseFloat(this.data[i][j][1]);
108
+ }
109
+ }
110
+ }
111
+
112
+
105
113
  this.properties =
106
114
  {
107
115
  'chart.background.color': 'transparent',
@@ -135,8 +143,11 @@
135
143
  'chart.labels.axes.background': 'rgba(255,255,255,0.8)',
136
144
  'chart.labels.count': 5,
137
145
  'chart.text.color': 'black',
138
- 'chart.text.font': 'Arial',
146
+ 'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
139
147
  'chart.text.size': 12,
148
+ 'chart.text.accessible': true,
149
+ 'chart.text.accessible.overflow': 'visible',
150
+ 'chart.text.accessible.pointerevents': false,
140
151
  'chart.key': null,
141
152
  'chart.key.background': 'white',
142
153
  'chart.key.position': 'graph',
@@ -210,7 +221,8 @@
210
221
  'chart.line.shadow.color': 'black',
211
222
  'chart.line.shadow.blur': 2,
212
223
  'chart.line.shadow.offsetx': 3,
213
- 'chart.line.shadow.offsety': 3
224
+ 'chart.line.shadow.offsety': 3,
225
+ 'chart.clearto': 'rgba(0,0,0,0)'
214
226
  }
215
227
 
216
228
 
@@ -247,7 +259,6 @@
247
259
  ca = this.canvas,
248
260
  co = ca.getContext('2d'),
249
261
  prop = this.properties,
250
- pa = RG.Path,
251
262
  pa2 = RG.path2,
252
263
  win = window,
253
264
  doc = document,
@@ -298,10 +309,9 @@
298
309
 
299
310
 
300
311
  // Convert uppercase letters to dot+lower case letter
301
- name = name.replace(/([A-Z])/g, function (str)
302
- {
303
- return '.' + String(RegExp.$1).toLowerCase();
304
- });
312
+ while(name.match(/([A-Z])/)) {
313
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
314
+ }
305
315
 
306
316
 
307
317
 
@@ -596,7 +606,7 @@
596
606
  // Draw the background color first
597
607
  //
598
608
  if (prop['chart.background.color'] != 'transparent') {
599
- pa(co, ['b','a', this.centerx, this.centery, this.radius, 0, 2 * ma.PI, -1, 'f', prop['chart.background.color']]);
609
+ pa2(co, ['b','a', this.centerx, this.centery, this.radius, 0, 2 * ma.PI, -1, 'f', prop['chart.background.color']]);
600
610
  }
601
611
 
602
612
 
@@ -1132,8 +1142,11 @@
1132
1142
  this.highlight =
1133
1143
  this.Highlight = function (shape)
1134
1144
  {
1135
- // Add the new highlight
1136
- RG.Highlight.Point(this, shape);
1145
+ if (typeof prop['chart.highlight.style'] === 'function') {
1146
+ (prop['chart.highlight.style'])(shape);
1147
+ } else {
1148
+ RG.Highlight.Point(this, shape);
1149
+ }
1137
1150
  };
1138
1151
 
1139
1152
 
@@ -1182,41 +1195,32 @@
1182
1195
  var coordX = obj.coords[tooltip.__index__][0];
1183
1196
  var coordY = obj.coords[tooltip.__index__][1];
1184
1197
  var canvasXY = RG.getCanvasXY(obj.canvas);
1198
+ var mouseXY = RG.getMouseXY(window.event);
1185
1199
  var gutterLeft = obj.gutterLeft;
1186
1200
  var gutterTop = obj.gutterTop;
1187
1201
  var width = tooltip.offsetWidth;
1202
+ var height = tooltip.offsetHeight;
1188
1203
 
1189
1204
  // Set the top position
1190
1205
  tooltip.style.left = 0;
1191
- tooltip.style.top = parseInt(tooltip.style.top) - 7 + 'px';
1206
+ tooltip.style.top = window.event.pageY - height - 5 + 'px';
1192
1207
 
1193
1208
  // By default any overflow is hidden
1194
1209
  tooltip.style.overflow = '';
1195
-
1196
- // The arrow
1197
- var img = new Image();
1198
- img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
1199
- img.style.position = 'absolute';
1200
- img.id = '__rgraph_tooltip_pointer__';
1201
- img.style.top = (tooltip.offsetHeight - 2) + 'px';
1202
- tooltip.appendChild(img);
1203
1210
 
1204
1211
  // Reposition the tooltip if at the edges:
1205
1212
 
1206
1213
  // LEFT edge
1207
- if ((canvasXY[0] + coordX - (width / 2)) < 10) {
1208
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.1)) + 'px';
1209
- img.style.left = ((width * 0.1) - 8.5) + 'px';
1214
+ if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
1215
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
1210
1216
 
1211
1217
  // RIGHT edge
1212
- } else if ((canvasXY[0] + coordX + (width / 2)) > doc.body.offsetWidth) {
1213
- tooltip.style.left = canvasXY[0] + coordX - (width * 0.9) + 'px';
1214
- img.style.left = ((width * 0.9) - 8.5) + 'px';
1218
+ } else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
1219
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
1215
1220
 
1216
1221
  // Default positioning - CENTERED
1217
1222
  } else {
1218
- tooltip.style.left = (canvasXY[0] + coordX - (width * 0.5)) + 'px';
1219
- img.style.left = ((width * 0.5) - 8.5) + 'px';
1223
+ tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
1220
1224
  }
1221
1225
  };
1222
1226