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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/javascripts/RGraph.bar.js +16 -8
- data/vendor/assets/javascripts/RGraph.bipolar.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.annotate.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.context.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.core.js +84 -7
- data/vendor/assets/javascripts/RGraph.common.csv.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.effects.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.key.js +3 -3
- data/vendor/assets/javascripts/RGraph.common.resizing.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.sheets.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.zoom.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.background.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.image.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.text.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +1 -1
- data/vendor/assets/javascripts/RGraph.fuel.js +1 -1
- data/vendor/assets/javascripts/RGraph.funnel.js +1 -1
- data/vendor/assets/javascripts/RGraph.gantt.js +1 -1
- data/vendor/assets/javascripts/RGraph.gauge.js +1 -1
- data/vendor/assets/javascripts/RGraph.hbar.js +228 -2
- data/vendor/assets/javascripts/RGraph.hprogress.js +1 -1
- data/vendor/assets/javascripts/RGraph.line.js +27 -5
- data/vendor/assets/javascripts/RGraph.meter.js +1 -1
- data/vendor/assets/javascripts/RGraph.modaldialog.js +1 -1
- data/vendor/assets/javascripts/RGraph.odo.js +1 -1
- data/vendor/assets/javascripts/RGraph.pie.js +1 -1
- data/vendor/assets/javascripts/RGraph.radar.js +1 -1
- data/vendor/assets/javascripts/RGraph.rose.js +1 -1
- data/vendor/assets/javascripts/RGraph.rscatter.js +1 -1
- data/vendor/assets/javascripts/RGraph.scatter.js +161 -34
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.bar.js +772 -103
- data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.common.core.js +806 -231
- data/vendor/assets/javascripts/RGraph.svg.common.csv.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.common.fx.js +24 -24
- data/vendor/assets/javascripts/RGraph.svg.common.key.js +206 -0
- data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +63 -22
- data/vendor/assets/javascripts/RGraph.svg.hbar.js +351 -91
- data/vendor/assets/javascripts/RGraph.svg.line.js +159 -64
- data/vendor/assets/javascripts/RGraph.svg.pie.js +402 -51
- data/vendor/assets/javascripts/RGraph.svg.radar.js +320 -143
- data/vendor/assets/javascripts/RGraph.svg.rose.js +1818 -0
- data/vendor/assets/javascripts/RGraph.svg.scatter.js +1262 -0
- data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +106 -57
- data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1253 -0
- data/vendor/assets/javascripts/RGraph.thermometer.js +7 -6
- data/vendor/assets/javascripts/RGraph.vprogress.js +1 -1
- data/vendor/assets/javascripts/RGraph.waterfall.js +1 -1
- data/vendor/assets/javascripts/financial-data.js +1067 -0
- metadata +8 -5
- data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
- data/vendor/assets/javascripts/RGraph.thermometer.old.js +0 -68
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2017-
|
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,56 @@
|
|
26
26
|
|
27
27
|
RG.SVG.Radar = 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
|
+
|
55
|
+
} else {
|
56
|
+
|
57
|
+
var ret = RG.SVG.commonSetter({
|
58
|
+
object: this,
|
59
|
+
name: name,
|
60
|
+
value: value
|
61
|
+
});
|
62
|
+
|
63
|
+
name = ret.name;
|
64
|
+
value = ret.value;
|
65
|
+
|
66
|
+
this.properties[name] = value;
|
67
|
+
}
|
68
|
+
|
69
|
+
return this;
|
70
|
+
};
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
29
79
|
this.id = conf.id;
|
30
80
|
this.uid = RG.SVG.createUID();
|
31
81
|
this.container = document.getElementById(this.id);
|
@@ -47,7 +97,7 @@
|
|
47
97
|
this.shadowNodes = [];
|
48
98
|
this.max = 0;
|
49
99
|
this.redraw = false;
|
50
|
-
this.
|
100
|
+
this.highlight_node = null;
|
51
101
|
|
52
102
|
// Add this object to the ObjectRegistry
|
53
103
|
RG.SVG.OR.add(this);
|
@@ -71,10 +121,11 @@
|
|
71
121
|
gutterBottom: 35,
|
72
122
|
|
73
123
|
backgroundGrid: true,
|
74
|
-
backgroundGridColor:
|
75
|
-
backgroundGridRadialsCount:
|
124
|
+
backgroundGridColor: '#ddd',
|
125
|
+
backgroundGridRadialsCount: null,
|
76
126
|
backgroundGridConcentricsCount: 5,
|
77
|
-
backgroundGridLinewidth:
|
127
|
+
backgroundGridLinewidth: 1,
|
128
|
+
backgroundGridPoly: true,
|
78
129
|
|
79
130
|
colors: [
|
80
131
|
'red', 'black', 'orange', 'green', '#6ff', '#ccc',
|
@@ -131,7 +182,7 @@
|
|
131
182
|
titleX: null,
|
132
183
|
titleY: null,
|
133
184
|
titleHalign: 'center',
|
134
|
-
titleValign:
|
185
|
+
titleValign: null,
|
135
186
|
titleColor: 'black',
|
136
187
|
titleFont: null,
|
137
188
|
titleBold: false,
|
@@ -142,7 +193,7 @@
|
|
142
193
|
titleSubtitleX: null,
|
143
194
|
titleSubtitleY: null,
|
144
195
|
titleSubtitleHalign: 'center',
|
145
|
-
titleSubtitleValign:
|
196
|
+
titleSubtitleValign: null,
|
146
197
|
titleSubtitleColor: '#aaa',
|
147
198
|
titleSubtitleFont: null,
|
148
199
|
titleSubtitleBold: false,
|
@@ -155,14 +206,26 @@
|
|
155
206
|
shadowOffsety: 2,
|
156
207
|
shadowBlur: 2,
|
157
208
|
shadowOpacity: 0.25,
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
key: null,
|
213
|
+
keyColors: null,
|
214
|
+
keyOffsetx: 0,
|
215
|
+
keyOffsety: 0,
|
216
|
+
keyTextOffsetx: 0,
|
217
|
+
keyTextOffsety: -1,
|
218
|
+
keyTextSize: null,
|
219
|
+
keyTextBold: null,
|
220
|
+
keyTextItalic: null,
|
158
221
|
|
159
222
|
attribution: true,
|
160
223
|
attributionX: null,
|
161
224
|
attributionY: null,
|
162
|
-
attributionHref:
|
225
|
+
attributionHref: null,// Default is set in RGraph.svg.common.core.js
|
163
226
|
attributionHalign: 'right',
|
164
227
|
attributionValign: 'bottom',
|
165
|
-
attributionSize:
|
228
|
+
attributionSize: 7,
|
166
229
|
attributionColor: 'gray',
|
167
230
|
attributionFont: 'sans-serif',
|
168
231
|
attributionItalic: false,
|
@@ -189,31 +252,6 @@
|
|
189
252
|
|
190
253
|
|
191
254
|
|
192
|
-
//
|
193
|
-
// A setter that the constructor uses (at the end)
|
194
|
-
// to set all of the properties
|
195
|
-
//
|
196
|
-
// @param string name The name of the property to set
|
197
|
-
// @param string value The value to set the property to
|
198
|
-
//
|
199
|
-
this.set = function (name, value)
|
200
|
-
{
|
201
|
-
if (arguments.length === 1 && typeof name === 'object') {
|
202
|
-
for (i in arguments[0]) {
|
203
|
-
if (typeof i === 'string') {
|
204
|
-
this.set(i, arguments[0][i]);
|
205
|
-
}
|
206
|
-
}
|
207
|
-
} else {
|
208
|
-
this.properties[name] = value;
|
209
|
-
}
|
210
|
-
|
211
|
-
return this;
|
212
|
-
};
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
255
|
|
218
256
|
|
219
257
|
|
@@ -339,17 +377,9 @@
|
|
339
377
|
|
340
378
|
|
341
379
|
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
* ** must be after the cx/cy/r has been calcuated **
|
346
|
-
*/
|
347
|
-
if (!this.colorsParsed) {
|
348
|
-
this.parseColors();
|
349
|
-
|
350
|
-
// Don't want to do this again
|
351
|
-
this.colorsParsed = true;
|
352
|
-
}
|
380
|
+
// Parse the colors for gradients
|
381
|
+
RG.SVG.resetColorsToOriginalValues({object:this});
|
382
|
+
this.parseColors();
|
353
383
|
|
354
384
|
//
|
355
385
|
// Get the scale
|
@@ -403,6 +433,19 @@
|
|
403
433
|
this.addTooltipHotspots();
|
404
434
|
|
405
435
|
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
// Draw the key
|
441
|
+
if (typeof prop.key !== null && RG.SVG.drawKey) {
|
442
|
+
RG.SVG.drawKey(this);
|
443
|
+
} else if (!RGraph.SVG.isNull(prop.key)) {
|
444
|
+
alert('The drawKey() function does not exist - have you forgotten to include the key library?');
|
445
|
+
}
|
446
|
+
|
447
|
+
|
448
|
+
|
406
449
|
|
407
450
|
|
408
451
|
// Add the attribution link. If you're adding this elsewhere on your page/site
|
@@ -427,9 +470,9 @@
|
|
427
470
|
// Add the event listener that clears the highlight if
|
428
471
|
// there is any. Must be MOUSEDOWN (ie before the click event)
|
429
472
|
var obj = this;
|
430
|
-
|
473
|
+
doc.body.addEventListener('mousedown', function (e)
|
431
474
|
{
|
432
|
-
|
475
|
+
obj.hideHighlight(obj);
|
433
476
|
}, false);
|
434
477
|
|
435
478
|
|
@@ -459,6 +502,7 @@
|
|
459
502
|
// Create the background grid group tag
|
460
503
|
var grid = RG.SVG.create({
|
461
504
|
svg: this.svg,
|
505
|
+
parent: this.svg.all,
|
462
506
|
type: 'g',
|
463
507
|
attr: {
|
464
508
|
className: 'rgraph_radar_grid',
|
@@ -468,7 +512,8 @@
|
|
468
512
|
});
|
469
513
|
|
470
514
|
// Draw the concentric "rings" grid lines that are
|
471
|
-
// arranged around the centerx/centery
|
515
|
+
// arranged around the centerx/centery along with
|
516
|
+
// the radials that eminate from the center outwards
|
472
517
|
|
473
518
|
var origin = 0 - (RG.SVG.TRIG.PI / 2),
|
474
519
|
radials = (typeof prop.backgroundGridRadialsCount === 'number' ? prop.backgroundGridRadialsCount : this.data[0].length),
|
@@ -518,36 +563,69 @@
|
|
518
563
|
|
519
564
|
// Draw the concentrics
|
520
565
|
if (concentrics > 0) {
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
var
|
525
|
-
cx: this.centerx,
|
526
|
-
cy: this.centery,
|
527
|
-
r: this.radius * (j/concentrics),
|
528
|
-
angle: origin + (i * step)
|
529
|
-
});
|
566
|
+
|
567
|
+
if (prop.backgroundGridPoly) {
|
568
|
+
for (var j=1; j<=concentrics; j++) {
|
569
|
+
for (var i=0,len=radials,path=[]; i<len; ++i) {
|
530
570
|
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
571
|
+
var coords = RG.SVG.TRIG.toCartesian({
|
572
|
+
cx: this.centerx,
|
573
|
+
cy: this.centery,
|
574
|
+
r: this.radius * (j/concentrics),
|
575
|
+
angle: origin + (i * step)
|
576
|
+
});
|
577
|
+
|
578
|
+
path.push('{1} {2} {3}'.format(
|
579
|
+
i === 0 ? 'M' : 'L',
|
580
|
+
coords.x,
|
581
|
+
coords.y
|
582
|
+
));
|
538
583
|
|
539
|
-
// Now add the path to the scene
|
540
|
-
RG.SVG.create({
|
541
|
-
svg: this.svg,
|
542
|
-
type: 'path',
|
543
|
-
parent: grid,
|
544
|
-
attr: {
|
545
|
-
d: path.join(' ') + ' z',
|
546
|
-
fill: 'transparent',
|
547
|
-
stroke: prop.backgroundGridColor,
|
548
|
-
'stroke-width': prop.backgroundGridLinewidth
|
549
584
|
}
|
550
|
-
|
585
|
+
|
586
|
+
// Now add the path to the scene
|
587
|
+
RG.SVG.create({
|
588
|
+
svg: this.svg,
|
589
|
+
type: 'path',
|
590
|
+
parent: grid,
|
591
|
+
attr: {
|
592
|
+
d: path.join(' ') + ' z',
|
593
|
+
fill: 'transparent',
|
594
|
+
stroke: prop.backgroundGridColor,
|
595
|
+
'stroke-width': prop.backgroundGridLinewidth
|
596
|
+
}
|
597
|
+
});
|
598
|
+
}
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
// Draw the background "grid" as concentric circles
|
605
|
+
} else {
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
for (var j=1; j<=concentrics; j++) {
|
613
|
+
|
614
|
+
// Add circle to the scene
|
615
|
+
RG.SVG.create({
|
616
|
+
svg: this.svg,
|
617
|
+
type: 'circle',
|
618
|
+
parent: grid,
|
619
|
+
attr: {
|
620
|
+
cx: this.centerx,
|
621
|
+
cy: this.centery,
|
622
|
+
r: this.radius * (j/concentrics),
|
623
|
+
fill: 'transparent',
|
624
|
+
stroke: prop.backgroundGridColor,
|
625
|
+
'stroke-width': prop.backgroundGridLinewidth
|
626
|
+
}
|
627
|
+
});
|
628
|
+
}
|
551
629
|
}
|
552
630
|
}
|
553
631
|
}
|
@@ -652,12 +730,14 @@
|
|
652
730
|
var path = RG.SVG.create({
|
653
731
|
svg: this.svg,
|
654
732
|
type: 'path',
|
733
|
+
parent: this.svg.all,
|
655
734
|
attr: {
|
656
735
|
d: path.join(" "),
|
657
736
|
stroke: prop.colors[dataset],
|
658
737
|
fill: prop.filled ? prop.colors[dataset] : 'transparent',
|
659
738
|
'fill-opacity': prop.filledOpacity,
|
660
739
|
'stroke-width': prop.linewidth,
|
740
|
+
'clip-path': this.isTrace ? 'url(#trace-effect-clip)' : '',
|
661
741
|
filter: prop.shadow ? 'url(#dropShadow)' : '',
|
662
742
|
}
|
663
743
|
});
|
@@ -710,6 +790,7 @@
|
|
710
790
|
RG.SVG.create({
|
711
791
|
svg: this.svg,
|
712
792
|
type: 'path',
|
793
|
+
parent: this.svg.all,
|
713
794
|
attr: {
|
714
795
|
d: path.join(" "),
|
715
796
|
stroke: prop.colors[dataset],
|
@@ -735,8 +816,10 @@
|
|
735
816
|
{
|
736
817
|
var group = RG.SVG.create({
|
737
818
|
svg: this.svg,
|
819
|
+
parent: this.svg.all,
|
738
820
|
type: 'g',
|
739
821
|
attr: {
|
822
|
+
className: 'rgraph_radar_tickmarks'
|
740
823
|
}
|
741
824
|
});
|
742
825
|
|
@@ -746,14 +829,15 @@
|
|
746
829
|
var c = RG.SVG.create({
|
747
830
|
svg: this.svg,
|
748
831
|
type: 'circle',
|
749
|
-
|
832
|
+
parent: group,
|
750
833
|
attr: {
|
751
834
|
cx: this.coords2[i][j][0],
|
752
835
|
cy: this.coords2[i][j][1],
|
753
836
|
r: prop.tickmarksSize,
|
754
837
|
fill: prop.tickmarks === 'filledcircle' ? prop.colors[i] : prop.tickmarksFill,
|
755
838
|
stroke: prop.colors[i],
|
756
|
-
'stroke-width': prop.tickmarksLinewidth
|
839
|
+
'stroke-width': prop.tickmarksLinewidth,
|
840
|
+
'clip-path': this.isTrace ? 'url(#trace-effect-clip)' : ''
|
757
841
|
}
|
758
842
|
});
|
759
843
|
|
@@ -769,7 +853,7 @@
|
|
769
853
|
var s = RG.SVG.create({
|
770
854
|
svg: this.svg,
|
771
855
|
type: 'rect',
|
772
|
-
|
856
|
+
parent: group,
|
773
857
|
attr: {
|
774
858
|
x: this.coords2[i][j][0] - halfTickmarkSize,
|
775
859
|
y: this.coords2[i][j][1] - halfTickmarkSize,
|
@@ -846,6 +930,7 @@
|
|
846
930
|
RG.SVG.text({
|
847
931
|
object: this,
|
848
932
|
svg: this.svg,
|
933
|
+
parent: this.svg.all,
|
849
934
|
text: labels[i],
|
850
935
|
size: typeof prop.labelsSize === 'number' ? prop.labelsSize : prop.textSize,
|
851
936
|
x: x,
|
@@ -877,10 +962,11 @@
|
|
877
962
|
var x = this.centerx;
|
878
963
|
var y = this.centery - (this.radius / this.scale.labels.length * (i+1) );
|
879
964
|
|
880
|
-
|
965
|
+
|
881
966
|
RG.SVG.text({
|
882
967
|
object: this,
|
883
968
|
svg: this.svg,
|
969
|
+
parent: this.svg.all,
|
884
970
|
text: this.scale.labels[i],
|
885
971
|
size: prop.scaleSize || prop.textSize - 2,
|
886
972
|
x: x,
|
@@ -911,6 +997,7 @@
|
|
911
997
|
RG.SVG.text({
|
912
998
|
object: this,
|
913
999
|
svg: this.svg,
|
1000
|
+
parent: this.svg.all,
|
914
1001
|
text: str,
|
915
1002
|
size: prop.scaleSize || prop.textSize - 2,
|
916
1003
|
x: this.centerx,
|
@@ -937,27 +1024,17 @@
|
|
937
1024
|
/**
|
938
1025
|
* This function can be used to highlight a segment on the chart
|
939
1026
|
*
|
940
|
-
* @param object
|
1027
|
+
* @param object circle The circle to highlight
|
941
1028
|
*/
|
942
1029
|
this.highlight = function (circle)
|
943
|
-
{
|
944
|
-
|
1030
|
+
{
|
1031
|
+
circle.setAttribute('fill', prop.highlightFill);
|
1032
|
+
circle.setAttribute('stroke', prop.highlightStroke);
|
1033
|
+
circle.setAttribute('stroke-width', prop.highlightLinewidth);
|
945
1034
|
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
window.addEventListener ('mousedown', function (e)
|
951
|
-
{
|
952
|
-
circle.setAttribute('fill', 'transparent');
|
953
|
-
circle.setAttribute('stroke', 'transparent');
|
954
|
-
circle.setAttribute('stroke-width', 0);
|
955
|
-
|
956
|
-
RG.SVG.REG.set('highlight', this);
|
957
|
-
}, false);
|
958
|
-
|
959
|
-
this.highlight_hotspot = circle;
|
960
|
-
}
|
1035
|
+
this.highlight_node = circle;
|
1036
|
+
|
1037
|
+
RG.SVG.REG.set('highlight', circle);
|
961
1038
|
};
|
962
1039
|
|
963
1040
|
|
@@ -968,16 +1045,15 @@
|
|
968
1045
|
|
969
1046
|
|
970
1047
|
// Add the hide function
|
971
|
-
this.hideHighlight = function ()
|
972
|
-
{
|
973
|
-
|
974
|
-
this.highlight_hotspot.setAttribute('fill', 'transparent');
|
975
|
-
this.highlight_hotspot.setAttribute('stroke', 'transparent');
|
976
|
-
this.highlight_hotspot.setAttribute('stroke-width', 0);
|
1048
|
+
//this.hideHighlight = function ()
|
1049
|
+
//{
|
1050
|
+
// var highlight = RG.SVG.REG.get('highlight');
|
977
1051
|
|
978
|
-
|
979
|
-
|
980
|
-
|
1052
|
+
// if (highlight) {
|
1053
|
+
// highlight.setAttribute('fill', 'transparent');
|
1054
|
+
// highlight.setAttribute('stroke', 'transparent');
|
1055
|
+
// }
|
1056
|
+
//};
|
981
1057
|
|
982
1058
|
|
983
1059
|
|
@@ -1082,6 +1158,7 @@
|
|
1082
1158
|
var group = RG.SVG.create({
|
1083
1159
|
svg: this.svg,
|
1084
1160
|
type: 'g',
|
1161
|
+
parent: this.svg.all,
|
1085
1162
|
attr: {
|
1086
1163
|
className: 'rgraph-radar-tooltip-hotspots'
|
1087
1164
|
}
|
@@ -1100,52 +1177,50 @@
|
|
1100
1177
|
r: prop.tickmarksSize,
|
1101
1178
|
fill: 'transparent',
|
1102
1179
|
stroke: 'transparent',
|
1103
|
-
'stroke-width': 0
|
1180
|
+
'stroke-width': 0,
|
1181
|
+
'data-sequential-index': seq
|
1104
1182
|
},
|
1105
1183
|
style: {
|
1106
|
-
cursor: 'pointer'
|
1184
|
+
cursor: prop['tooltips'][seq] ? 'pointer' : 'default'
|
1107
1185
|
}
|
1108
1186
|
});
|
1109
1187
|
|
1110
1188
|
(function (dataset, index, seq, obj)
|
1111
1189
|
{
|
1112
|
-
|
1113
|
-
|
1114
|
-
var tooltip = RG.SVG.REG.get('tooltip');
|
1115
|
-
|
1116
|
-
if (tooltip && tooltip.__sequentialIndex__ === seq) {
|
1117
|
-
return;
|
1118
|
-
}
|
1119
|
-
|
1120
|
-
RG.SVG.hideTooltip();
|
1121
|
-
obj.hideHighlight();
|
1122
|
-
|
1123
|
-
// Show the tooltip
|
1124
|
-
RG.SVG.tooltip({
|
1125
|
-
object: obj,
|
1126
|
-
dataset: dataset,
|
1127
|
-
index: index,
|
1128
|
-
sequentialIndex: seq,
|
1129
|
-
text: prop.tooltips[seq],
|
1130
|
-
event: e
|
1131
|
-
});
|
1132
|
-
|
1133
|
-
// Highlight the rect that has been clicked on
|
1134
|
-
obj.highlight(this);
|
1135
|
-
|
1136
|
-
if (prop.tooltipsEvent === 'mousemove') {
|
1137
|
-
highlight.style.cursor = 'pointer';
|
1138
|
-
}
|
1139
|
-
|
1140
|
-
}, false);
|
1141
|
-
|
1142
|
-
// Install the event listener that changes the
|
1143
|
-
// cursor if necessary
|
1144
|
-
if (prop.tooltipsEvent === 'click') {
|
1145
|
-
circle.addEventListener('mousemove', function (e)
|
1190
|
+
if (prop.tooltips[seq]) {
|
1191
|
+
circle.addEventListener(prop.tooltipsEvent, function (e)
|
1146
1192
|
{
|
1147
|
-
|
1193
|
+
var tooltip = RG.SVG.REG.get('tooltip');
|
1194
|
+
|
1195
|
+
//obj.hideHighlight();
|
1196
|
+
|
1197
|
+
if (tooltip && tooltip.__sequentialIndex__ === seq) {
|
1198
|
+
return;
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
// Show the tooltip
|
1202
|
+
RG.SVG.tooltip({
|
1203
|
+
object: obj,
|
1204
|
+
dataset: dataset,
|
1205
|
+
index: index,
|
1206
|
+
sequentialIndex: seq,
|
1207
|
+
text: prop.tooltips[seq],
|
1208
|
+
event: e
|
1209
|
+
});
|
1210
|
+
|
1211
|
+
// Highlight the shape that has been clicked on
|
1212
|
+
obj.highlight(this);
|
1213
|
+
|
1148
1214
|
}, false);
|
1215
|
+
|
1216
|
+
// Install the event listener that changes the
|
1217
|
+
// cursor if necessary
|
1218
|
+
if (prop.tooltipsEvent === 'click') {
|
1219
|
+
circle.addEventListener('mousemove', function (e)
|
1220
|
+
{
|
1221
|
+
e.target.style.cursor = 'pointer';
|
1222
|
+
}, false);
|
1223
|
+
}
|
1149
1224
|
}
|
1150
1225
|
|
1151
1226
|
}(dataset, i, seq++, this));
|
@@ -1305,6 +1380,108 @@
|
|
1305
1380
|
|
1306
1381
|
|
1307
1382
|
|
1383
|
+
//
|
1384
|
+
// Removes the tooltip highlight from the chart
|
1385
|
+
//
|
1386
|
+
this.removeHighlight =
|
1387
|
+
this.hideHighlight = function ()
|
1388
|
+
{
|
1389
|
+
var highlight = RG.SVG.REG.get('highlight');
|
1390
|
+
|
1391
|
+
if (highlight && this.highlight_node) {
|
1392
|
+
this.highlight_node.setAttribute('fill','transparent');
|
1393
|
+
this.highlight_node.setAttribute('stroke','transparent');
|
1394
|
+
|
1395
|
+
RG.SVG.REG.set('highlight', null);
|
1396
|
+
}
|
1397
|
+
};
|
1398
|
+
|
1399
|
+
|
1400
|
+
|
1401
|
+
|
1402
|
+
|
1403
|
+
|
1404
|
+
|
1405
|
+
|
1406
|
+
//
|
1407
|
+
// The trace effect
|
1408
|
+
//
|
1409
|
+
// @param ... object Options to the effect
|
1410
|
+
// @param ... function A callback function to run when the effect finishes
|
1411
|
+
//
|
1412
|
+
this.trace = function ()
|
1413
|
+
{
|
1414
|
+
var opt = arguments[0] || {},
|
1415
|
+
frame = 1,
|
1416
|
+
frames = opt.frames || 120,
|
1417
|
+
obj = this
|
1418
|
+
step = 360 / frames;
|
1419
|
+
|
1420
|
+
this.isTrace = true;
|
1421
|
+
|
1422
|
+
this.draw();
|
1423
|
+
|
1424
|
+
// Create the clip area
|
1425
|
+
var clipPath = RG.SVG.create({
|
1426
|
+
svg: this.svg,
|
1427
|
+
parent: this.svg.defs,
|
1428
|
+
type: 'clipPath',
|
1429
|
+
attr: {
|
1430
|
+
id: 'trace-effect-clip'
|
1431
|
+
}
|
1432
|
+
});
|
1433
|
+
|
1434
|
+
clipPathArcPath = RG.SVG.TRIG.getArcPath2({
|
1435
|
+
cx: this.angles[0].cx,
|
1436
|
+
cy: this.angles[0].cy,
|
1437
|
+
r: this.angles[0].r * 2,
|
1438
|
+
start: 0,
|
1439
|
+
end: 0
|
1440
|
+
});
|
1441
|
+
|
1442
|
+
var clipPathArc = RG.SVG.create({
|
1443
|
+
svg: this.svg,
|
1444
|
+
parent: clipPath,
|
1445
|
+
type: 'path',
|
1446
|
+
attr: {
|
1447
|
+
d: clipPathArcPath
|
1448
|
+
}
|
1449
|
+
});
|
1450
|
+
|
1451
|
+
|
1452
|
+
var iterator = function ()
|
1453
|
+
{
|
1454
|
+
var width = (frame++) / frames * obj.width;
|
1455
|
+
var deg = (360 / frames) * frame++,
|
1456
|
+
rad = (RG.SVG.TRIG.TWOPI / 360) * deg
|
1457
|
+
|
1458
|
+
clipPathArc.setAttribute('d', RG.SVG.TRIG.getArcPath2({
|
1459
|
+
cx: obj.angles[0].cx,
|
1460
|
+
cy: obj.angles[0].cy,
|
1461
|
+
r: obj.angles[0].r * 2,
|
1462
|
+
start: 0,
|
1463
|
+
end: rad
|
1464
|
+
}));
|
1465
|
+
|
1466
|
+
if (frame <= frames) {
|
1467
|
+
RG.SVG.FX.update(iterator);
|
1468
|
+
} else if (opt.callback) {
|
1469
|
+
(opt.callback)(obj);
|
1470
|
+
}
|
1471
|
+
};
|
1472
|
+
|
1473
|
+
iterator();
|
1474
|
+
|
1475
|
+
return this;
|
1476
|
+
};
|
1477
|
+
|
1478
|
+
|
1479
|
+
|
1480
|
+
|
1481
|
+
|
1482
|
+
|
1483
|
+
|
1484
|
+
|
1308
1485
|
//
|
1309
1486
|
// Set the options that the user has provided
|
1310
1487
|
//
|