rgraph-rails 1.0.8 → 4.62

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/rgraph-rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/RGraph.bar.js +16 -8
  5. data/vendor/assets/javascripts/RGraph.bipolar.js +1 -1
  6. data/vendor/assets/javascripts/RGraph.common.annotate.js +1 -1
  7. data/vendor/assets/javascripts/RGraph.common.context.js +1 -1
  8. data/vendor/assets/javascripts/RGraph.common.core.js +84 -7
  9. data/vendor/assets/javascripts/RGraph.common.csv.js +1 -1
  10. data/vendor/assets/javascripts/RGraph.common.deprecated.js +1 -1
  11. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1 -1
  12. data/vendor/assets/javascripts/RGraph.common.effects.js +1 -1
  13. data/vendor/assets/javascripts/RGraph.common.key.js +3 -3
  14. data/vendor/assets/javascripts/RGraph.common.resizing.js +1 -1
  15. data/vendor/assets/javascripts/RGraph.common.sheets.js +1 -1
  16. data/vendor/assets/javascripts/RGraph.common.tooltips.js +1 -1
  17. data/vendor/assets/javascripts/RGraph.common.zoom.js +1 -1
  18. data/vendor/assets/javascripts/RGraph.drawing.background.js +1 -1
  19. data/vendor/assets/javascripts/RGraph.drawing.circle.js +1 -1
  20. data/vendor/assets/javascripts/RGraph.drawing.image.js +1 -1
  21. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +1 -1
  22. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +1 -1
  23. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +1 -1
  24. data/vendor/assets/javascripts/RGraph.drawing.poly.js +1 -1
  25. data/vendor/assets/javascripts/RGraph.drawing.rect.js +1 -1
  26. data/vendor/assets/javascripts/RGraph.drawing.text.js +1 -1
  27. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +1 -1
  28. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +1 -1
  29. data/vendor/assets/javascripts/RGraph.fuel.js +1 -1
  30. data/vendor/assets/javascripts/RGraph.funnel.js +1 -1
  31. data/vendor/assets/javascripts/RGraph.gantt.js +1 -1
  32. data/vendor/assets/javascripts/RGraph.gauge.js +1 -1
  33. data/vendor/assets/javascripts/RGraph.hbar.js +228 -2
  34. data/vendor/assets/javascripts/RGraph.hprogress.js +1 -1
  35. data/vendor/assets/javascripts/RGraph.line.js +27 -5
  36. data/vendor/assets/javascripts/RGraph.meter.js +1 -1
  37. data/vendor/assets/javascripts/RGraph.modaldialog.js +1 -1
  38. data/vendor/assets/javascripts/RGraph.odo.js +1 -1
  39. data/vendor/assets/javascripts/RGraph.pie.js +1 -1
  40. data/vendor/assets/javascripts/RGraph.radar.js +1 -1
  41. data/vendor/assets/javascripts/RGraph.rose.js +1 -1
  42. data/vendor/assets/javascripts/RGraph.rscatter.js +1 -1
  43. data/vendor/assets/javascripts/RGraph.scatter.js +161 -34
  44. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1 -1
  45. data/vendor/assets/javascripts/RGraph.svg.bar.js +772 -103
  46. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +1 -1
  47. data/vendor/assets/javascripts/RGraph.svg.common.core.js +806 -231
  48. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +1 -1
  49. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +24 -24
  50. data/vendor/assets/javascripts/RGraph.svg.common.key.js +206 -0
  51. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +1 -1
  52. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +63 -22
  53. data/vendor/assets/javascripts/RGraph.svg.hbar.js +351 -91
  54. data/vendor/assets/javascripts/RGraph.svg.line.js +159 -64
  55. data/vendor/assets/javascripts/RGraph.svg.pie.js +402 -51
  56. data/vendor/assets/javascripts/RGraph.svg.radar.js +320 -143
  57. data/vendor/assets/javascripts/RGraph.svg.rose.js +1818 -0
  58. data/vendor/assets/javascripts/RGraph.svg.scatter.js +1262 -0
  59. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +106 -57
  60. data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1253 -0
  61. data/vendor/assets/javascripts/RGraph.thermometer.js +7 -6
  62. data/vendor/assets/javascripts/RGraph.vprogress.js +1 -1
  63. data/vendor/assets/javascripts/RGraph.waterfall.js +1 -1
  64. data/vendor/assets/javascripts/financial-data.js +1067 -0
  65. metadata +8 -5
  66. data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
  67. data/vendor/assets/javascripts/RGraph.thermometer.old.js +0 -68
@@ -1,4 +1,4 @@
1
- // version: 2017-01-02
1
+ // version: 2017-05-08
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -26,6 +26,55 @@
26
26
 
27
27
  RG.SVG.Line = function (conf)
28
28
  {
29
+ //
30
+ // A setter that the constructor uses (at the end)
31
+ // to set all of the properties
32
+ //
33
+ // @param string name The name of the property to set
34
+ // @param string value The value to set the property to
35
+ //
36
+ this.set = function (name, value)
37
+ {
38
+ if (arguments.length === 1 && typeof name === 'object') {
39
+ for (i in arguments[0]) {
40
+ if (typeof i === 'string') {
41
+
42
+ var ret = RG.SVG.commonSetter({
43
+ object: this,
44
+ name: i,
45
+ value: arguments[0][i]
46
+ });
47
+
48
+ name = ret.name;
49
+ value = ret.value;
50
+
51
+ this.set(name, value);
52
+ }
53
+ }
54
+ } else {
55
+
56
+ var ret = RG.SVG.commonSetter({
57
+ object: this,
58
+ name: name,
59
+ value: value
60
+ });
61
+
62
+ name = ret.name;
63
+ value = ret.value;
64
+
65
+ this.properties[name] = value;
66
+ }
67
+
68
+ return this;
69
+ };
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
29
78
  this.id = conf.id;
30
79
  this.uid = RG.SVG.createUID();
31
80
  this.container = document.getElementById(this.id);
@@ -65,18 +114,27 @@
65
114
  gutterTop: 35,
66
115
  gutterBottom: 35,
67
116
 
68
- backgroundGrid: true,
69
- backgroundGridColor: '#ddd',
70
- backgroundGridLinewidth: 1,
71
- backgroundGridHlines: true,
72
- backgroundGridHlinesCount: null,
73
- backgroundGridVlines: true,
74
- backgroundGridVlinesCount: null,
75
- backgroundGridBorder: true,
117
+ backgroundColor: null,
118
+ backgroundImage: null,
119
+ backgroundImageStretch: true,
120
+ backgroundImageAspect: 'none',
121
+ backgroundImageOpacity: null,
122
+ backgroundImageX: null,
123
+ backgroundImageY: null,
124
+ backgroundImageW: null,
125
+ backgroundImageH: null,
126
+ backgroundGrid: true,
127
+ backgroundGridColor: '#ddd',
128
+ backgroundGridLinewidth: 1,
129
+ backgroundGridHlines: true,
130
+ backgroundGridHlinesCount: null,
131
+ backgroundGridVlines: true,
132
+ backgroundGridVlinesCount: null,
133
+ backgroundGridBorder: true,
76
134
 
77
135
  colors: ['red', '#0f0', 'blue', '#ff0', '#0ff', 'green'],
78
136
 
79
- fill: false,
137
+ filled: false,
80
138
  filledColors: [],
81
139
  filledClick: null,
82
140
  filledOpacity: 1,
@@ -88,13 +146,11 @@
88
146
  yaxisTickmarks: true,
89
147
  yaxisTickmarksLength: 3,
90
148
  yaxisColor: 'black',
91
-
92
149
  yaxisScale: true,
93
150
  yaxisLabels: null,
94
151
  yaxisLabelsOffsetx: 0,
95
152
  yaxisLabelsOffsety: 0,
96
153
  yaxisLabelsCount: 5,
97
-
98
154
  yaxisUnitsPre: '',
99
155
  yaxisUnitsPost: '',
100
156
  yaxisStrict: false,
@@ -108,7 +164,7 @@
108
164
 
109
165
  xaxis: true,
110
166
  xaxisTickmarks: true,
111
- xaxisTickmarksLength: 3,
167
+ xaxisTickmarksLength: 5,
112
168
  xaxisLabels: null,
113
169
  xaxisLabelsOffsetx: 0,
114
170
  xaxisLabelsOffsety: 0,
@@ -157,6 +213,7 @@
157
213
  labelsAboveOffsety: -10,
158
214
  labelsAboveHalign: 'center',
159
215
  labelsAboveValign: 'bottom',
216
+ labelsAboveSpecific: null,
160
217
 
161
218
  shadow: false,
162
219
  shadowOffsetx: 2,
@@ -171,7 +228,7 @@
171
228
  titleX: null,
172
229
  titleY: null,
173
230
  titleHalign: 'center',
174
- titleValign: 'bottom',
231
+ titleValign: null,
175
232
  titleColor: null,
176
233
  titleFont: null,
177
234
  titleBold: false,
@@ -182,19 +239,36 @@
182
239
  titleSubtitleX: null,
183
240
  titleSubtitleY: null,
184
241
  titleSubtitleHalign: 'center',
185
- titleSubtitleValign: 'top',
242
+ titleSubtitleValign: null,
186
243
  titleSubtitleColor: '#aaa',
187
244
  titleSubtitleFont: null,
188
245
  titleSubtitleBold: false,
189
246
  titleSubtitleItalic: false,
190
-
247
+
248
+
249
+
250
+
251
+ key: null,
252
+ keyColors: null,
253
+ keyOffsetx: 0,
254
+ keyOffsety: 0,
255
+ keyTextOffsetx: 0,
256
+ keyTextOffsety: -1,
257
+ keyTextSize: null,
258
+ keyTextBold: null,
259
+ keyTextItalic: null,
260
+
261
+
262
+
263
+
264
+
191
265
  attribution: true,
192
266
  attributionX: null,
193
267
  attributionY: null,
194
- attributionHref: 'http://www.rgraph.net/svg/index.html',
268
+ attributionHref: null,// Default is set in RGraph.svg.common.core.js
195
269
  attributionHalign: 'right',
196
270
  attributionValign: 'bottom',
197
- attributionSize: 8,
271
+ attributionSize: 7,
198
272
  attributionColor: 'gray',
199
273
  attributionFont: 'sans-serif',
200
274
  attributionItalic: false,
@@ -220,31 +294,6 @@
220
294
 
221
295
 
222
296
 
223
- //
224
- // A setter that the constructor uses (at the end)
225
- // to set all of the properties
226
- //
227
- // @param string name The name of the property to set
228
- // @param string value The value to set the property to
229
- //
230
- this.set = function (name, value)
231
- {
232
- if (arguments.length === 1 && typeof name === 'object') {
233
- for (i in arguments[0]) {
234
- if (typeof i === 'string') {
235
- this.set(i, arguments[0][i]);
236
- }
237
- }
238
- } else {
239
- this.properties[name] = value;
240
- }
241
-
242
- return this;
243
- };
244
-
245
-
246
-
247
-
248
297
 
249
298
 
250
299
 
@@ -273,16 +322,9 @@
273
322
 
274
323
 
275
324
 
276
- /**
277
- * Parse the colors. This allows for simple gradient syntax
278
- */
279
- if (!this.colorsParsed) {
280
-
281
- this.parseColors();
282
-
283
- // Don't want to do this again
284
- this.colorsParsed = true;
285
- }
325
+ // Parse the colors for gradients
326
+ RG.SVG.resetColorsToOriginalValues({object:this});
327
+ this.parseColors();
286
328
 
287
329
  // Clear the coords arrays
288
330
  this.coords = [];
@@ -400,6 +442,27 @@
400
442
  this.redrawLines();
401
443
 
402
444
 
445
+
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+ // Draw the key
454
+ if (typeof prop.key !== null && RG.SVG.drawKey) {
455
+ RG.SVG.drawKey(this);
456
+ } else if (!RGraph.SVG.isNull(prop.key)) {
457
+ alert('The drawKey() function does not exist - have you forgotten to include the key library?');
458
+ }
459
+
460
+
461
+
462
+
463
+
464
+
465
+
403
466
  // Draw the labelsAbove labels
404
467
  this.drawLabelsAbove();
405
468
 
@@ -570,6 +633,7 @@
570
633
  // Add the fill path to the scene
571
634
  var fillPathObject = RG.SVG.create({
572
635
  svg: this.svg,
636
+ parent: this.svg.all,
573
637
  type: 'path',
574
638
  attr: {
575
639
  d: fillPath.join(' '),
@@ -585,14 +649,15 @@
585
649
  if (prop.filledClick) {
586
650
 
587
651
  var obj = this;
588
- fillPathObject.onclick = function (e)
652
+ fillPathObject.addEventListener('click', function (e)
589
653
  {
590
654
  prop.filledClick(e, obj, index);
591
- };
592
- fillPathObject.onmousemove = function (e)
655
+ }, false);
656
+
657
+ fillPathObject.addEventListener('mousemove', function (e)
593
658
  {
594
659
  e.target.style.cursor = 'pointer';
595
- }
660
+ }, false);
596
661
  }
597
662
  }
598
663
 
@@ -643,6 +708,7 @@
643
708
 
644
709
  var line = RG.SVG.create({
645
710
  svg: this.svg,
711
+ parent: this.svg.all,
646
712
  type: 'path',
647
713
  attr: {
648
714
  d: str,
@@ -673,6 +739,7 @@
673
739
 
674
740
  var line = RG.SVG.create({
675
741
  svg: this.svg,
742
+ parent: this.svg.all,
676
743
  type: 'path',
677
744
  attr: {
678
745
  d: path2,
@@ -696,6 +763,7 @@
696
763
 
697
764
  var group = RG.SVG.create({
698
765
  svg: this.svg,
766
+ parent: this.svg.all,
699
767
  type: 'g',
700
768
  attr: {
701
769
  'fill': 'transparent',
@@ -707,9 +775,9 @@
707
775
  });
708
776
 
709
777
 
710
- for (var i=0; i<this.coords[index].length; ++i,++this.tooltipsSequentialIndex) {
711
-
712
- if (this.coords[index][i][0] && this.coords[index][i][1]) {
778
+ //for (var i=0; i<this.coords[index].length; ++i,++this.tooltipsSequentialIndex) {
779
+ for (var i=0; i<this.coords[index].length && this.tooltipsSequentialIndex < prop.tooltips.length; ++i,++this.tooltipsSequentialIndex) {
780
+ if (prop.tooltips[this.tooltipsSequentialIndex] && this.coords[index][i][0] && this.coords[index][i][1]) {
713
781
 
714
782
  var hotspot = RG.SVG.create({
715
783
  svg: this.svg,
@@ -758,6 +826,7 @@
758
826
  // Highlight the chart here
759
827
  var outer_highlight1 = RG.SVG.create({
760
828
  svg: obj.svg,
829
+ parent: obj.svg.all,
761
830
  type: 'circle',
762
831
  attr: {
763
832
  cx: obj.coords[dataset][index][0],
@@ -774,6 +843,7 @@
774
843
 
775
844
  var outer_highlight2 = RG.SVG.create({
776
845
  svg: obj.svg,
846
+ parent: obj.svg.all,
777
847
  type: 'circle',
778
848
  attr: {
779
849
  cx: obj.coords[dataset][index][0],
@@ -790,6 +860,7 @@
790
860
 
791
861
  var inner_highlight1 = RG.SVG.create({
792
862
  svg: obj.svg,
863
+ parent: obj.svg.all,
793
864
  type: 'circle',
794
865
  attr: {
795
866
  cx: obj.coords[dataset][index][0],
@@ -805,6 +876,7 @@
805
876
 
806
877
  var inner_highlight2 = RG.SVG.create({
807
878
  svg: obj.svg,
879
+ parent: obj.svg.all,
808
880
  type: 'circle',
809
881
  attr: {
810
882
  cx: obj.coords[dataset][index][0],
@@ -858,6 +930,7 @@
858
930
  if (prop.tickmarksStyle === 'filledcircle' || (i === 0 || i === data.length - 1) ) {
859
931
  var circle = RG.SVG.create({
860
932
  svg: this.svg,
933
+ parent: this.svg.all,
861
934
  type: 'circle',
862
935
  attr: {
863
936
  cx: coords[index][i][0],
@@ -880,6 +953,7 @@
880
953
 
881
954
  var outerCircle = RG.SVG.create({
882
955
  svg: this.svg,
956
+ parent: this.svg.all,
883
957
  type: 'circle',
884
958
  attr: {
885
959
  cx: coords[index][i][0],
@@ -893,6 +967,7 @@
893
967
 
894
968
  var innerCircle = RG.SVG.create({
895
969
  svg: this.svg,
970
+ parent: this.svg.all,
896
971
  type: 'circle',
897
972
  attr: {
898
973
  cx: coords[index][i][0],
@@ -916,6 +991,7 @@
916
991
 
917
992
  var rect = RG.SVG.create({
918
993
  svg: this.svg,
994
+ parent: this.svg.all,
919
995
  type: 'rect',
920
996
  attr: {
921
997
  x: coords[index][i][0] - half,
@@ -942,6 +1018,7 @@
942
1018
 
943
1019
  var rect = RG.SVG.create({
944
1020
  svg: this.svg,
1021
+ parent: this.svg.all,
945
1022
  type: 'rect',
946
1023
  attr: {
947
1024
  x: coords[index][i][0] - half,
@@ -999,6 +1076,7 @@
999
1076
 
1000
1077
  RG.SVG.create({
1001
1078
  svg: this.svg,
1079
+ parent: this.svg.all,
1002
1080
  type: 'path',
1003
1081
  attr: {
1004
1082
  d: path,
@@ -1051,6 +1129,7 @@
1051
1129
 
1052
1130
  RG.SVG.create({
1053
1131
  svg: this.svg,
1132
+ parent: this.svg.all,
1054
1133
  type: 'path',
1055
1134
  attr: {
1056
1135
  d: path,
@@ -1267,7 +1346,8 @@
1267
1346
  colors: RG.SVG.arrayClone(prop.colors),
1268
1347
  filledColors: RG.SVG.arrayClone(prop.filledColors),
1269
1348
  backgroundGridColor: RG.SVG.arrayClone(prop.backgroundGridColor),
1270
- highlightFill: RG.SVG.arrayClone(prop.highlightFill)
1349
+ highlightFill: RG.SVG.arrayClone(prop.highlightFill),
1350
+ backgroundColor: RG.SVG.arrayClone(prop.backgroundColor)
1271
1351
  }
1272
1352
  }
1273
1353
 
@@ -1298,6 +1378,7 @@
1298
1378
 
1299
1379
  prop.backgroundGridColor = RG.SVG.parseColorLinear({object: this, color: prop.backgroundGridColor});
1300
1380
  prop.highlightFill = RG.SVG.parseColorLinear({object: this, color: prop.highlightFill});
1381
+ prop.backgroundColor = RG.SVG.parseColorLinear({object: this, color: prop.backgroundColor});
1301
1382
  };
1302
1383
 
1303
1384
 
@@ -1314,9 +1395,12 @@
1314
1395
  {
1315
1396
  // Go through the above labels
1316
1397
  if (prop.labelsAbove) {
1398
+
1399
+ var data_seq = RG.SVG.arrayLinearize(this.data),
1400
+ seq = 0;
1317
1401
 
1318
- for (var dataset=0; dataset<this.coords.length; ++dataset) {
1319
- for (var i=0; i<this.coords[dataset].length; ++i) {
1402
+ for (var dataset=0; dataset<this.coords.length; ++dataset,seq++) {
1403
+ for (var i=0; i<this.coords[dataset].length; ++i,seq++) {
1320
1404
 
1321
1405
  var str = RG.SVG.numberFormat({
1322
1406
  object: this,
@@ -1327,9 +1411,17 @@
1327
1411
  thousand: typeof prop.labelsAboveThousand === 'string' ? prop.labelsAboveThousand : null,
1328
1412
  formatter: typeof prop.labelsAboveFormatter === 'function' ? prop.labelsAboveFormatter : null
1329
1413
  });
1414
+
1415
+ // Facilitate labelsAboveSpecific
1416
+ if (prop.labelsAboveSpecific && prop.labelsAboveSpecific.length && (typeof prop.labelsAboveSpecific[seq] === 'string' || typeof prop.labelsAboveSpecific[seq] === 'number') ) {
1417
+ str = prop.labelsAboveSpecific[seq];
1418
+ } else if ( prop.labelsAboveSpecific && prop.labelsAboveSpecific.length && typeof prop.labelsAboveSpecific[seq] !== 'string' && typeof prop.labelsAboveSpecific[seq] !== 'number') {
1419
+ continue;
1420
+ }
1330
1421
 
1331
1422
  RG.SVG.text({
1332
1423
  object: this,
1424
+ parent: this.svg.all,
1333
1425
  text: str,
1334
1426
  x: parseFloat(this.coords[dataset][i][0]) + prop.labelsAboveOffsetx,
1335
1427
  y: parseFloat(this.coords[dataset][i][1]) + prop.labelsAboveOffsety,
@@ -1344,6 +1436,9 @@
1344
1436
  padding: prop.labelsAboveBackgroundPadding || 0
1345
1437
  });
1346
1438
  }
1439
+
1440
+ // Necessary so that the seq doesn't get incremented twice
1441
+ seq--;
1347
1442
  }
1348
1443
  }
1349
1444
  };
@@ -1420,7 +1515,7 @@
1420
1515
  // Create the clip area
1421
1516
  var clipPath = RG.SVG.create({
1422
1517
  svg: this.svg,
1423
- parent: this.defs,
1518
+ parent: this.svg.defs,
1424
1519
  type: 'clipPath',
1425
1520
  attr: {
1426
1521
  id: 'trace-effect-clip'