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.
- checksums.yaml +8 -8
- data/.travis.yml +1 -0
- data/README.md +2 -2
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/images/bullet.png +0 -0
- data/vendor/assets/images/facebook-large.png +0 -0
- data/vendor/assets/images/google-plus-large.png +0 -0
- data/vendor/assets/images/logo.png +0 -0
- data/vendor/assets/images/rgraph.jpg +0 -0
- data/vendor/assets/javascripts/RGraph.bar.js +533 -242
- data/vendor/assets/javascripts/RGraph.bipolar.js +152 -169
- data/vendor/assets/javascripts/RGraph.common.annotate.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.context.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.core.js +688 -373
- data/vendor/assets/javascripts/RGraph.common.csv.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +188 -193
- data/vendor/assets/javascripts/RGraph.common.effects.js +62 -38
- data/vendor/assets/javascripts/RGraph.common.key.js +35 -15
- data/vendor/assets/javascripts/RGraph.common.resizing.js +38 -21
- data/vendor/assets/javascripts/RGraph.common.sheets.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +48 -40
- data/vendor/assets/javascripts/RGraph.common.zoom.js +2 -2
- data/vendor/assets/javascripts/RGraph.drawing.background.js +33 -49
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +27 -30
- data/vendor/assets/javascripts/RGraph.drawing.image.js +23 -26
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +47 -40
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +38 -42
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +24 -28
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +25 -39
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +27 -32
- data/vendor/assets/javascripts/RGraph.drawing.text.js +53 -58
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +24 -29
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +45 -51
- data/vendor/assets/javascripts/RGraph.fuel.js +11 -9
- data/vendor/assets/javascripts/RGraph.funnel.js +40 -43
- data/vendor/assets/javascripts/RGraph.gantt.js +34 -34
- data/vendor/assets/javascripts/RGraph.gauge.js +64 -55
- data/vendor/assets/javascripts/RGraph.hbar.js +194 -137
- data/vendor/assets/javascripts/RGraph.hprogress.js +261 -167
- data/vendor/assets/javascripts/RGraph.line.js +520 -512
- data/vendor/assets/javascripts/RGraph.meter.js +11 -10
- data/vendor/assets/javascripts/RGraph.modaldialog.js +11 -2
- data/vendor/assets/javascripts/RGraph.odo.js +11 -9
- data/vendor/assets/javascripts/RGraph.pie.js +385 -100
- data/vendor/assets/javascripts/RGraph.radar.js +36 -29
- data/vendor/assets/javascripts/RGraph.rose.js +58 -41
- data/vendor/assets/javascripts/RGraph.rscatter.js +40 -36
- data/vendor/assets/javascripts/RGraph.scatter.js +441 -499
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1015 -0
- data/vendor/assets/javascripts/RGraph.thermometer.js +37 -37
- data/vendor/assets/javascripts/RGraph.vprogress.js +285 -157
- data/vendor/assets/javascripts/RGraph.waterfall.js +62 -62
- data/vendor/assets/stylesheets/website.css +30 -16
- metadata +3 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
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
|
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
|
@@ -97,10 +97,13 @@
|
|
97
97
|
'chart.strokestyle': null,
|
98
98
|
'chart.border': true,
|
99
99
|
'chart.border.color': 'black',
|
100
|
-
'chart.text.font': 'Arial',
|
100
|
+
'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
101
101
|
'chart.text.size': 12,
|
102
102
|
'chart.text.color': 'black',
|
103
103
|
'chart.text.valign': 'center',
|
104
|
+
'chart.text.accessible': true,
|
105
|
+
'chart.text.accessible.overflow': 'visible',
|
106
|
+
'chart.text.accessible.pointerevents': false,
|
104
107
|
'chart.value.text.decimals': 0,
|
105
108
|
'chart.value.text.units.pre': '',
|
106
109
|
'chart.value.text.units.post': '',
|
@@ -173,7 +176,8 @@
|
|
173
176
|
'chart.angles.start': RGraph.PI,
|
174
177
|
'chart.angles.end': RGraph.TWOPI,
|
175
178
|
'chart.centerpin.stroke': 'black',
|
176
|
-
'chart.centerpin.fill': 'white'
|
179
|
+
'chart.centerpin.fill': 'white',
|
180
|
+
'chart.clearto': 'rgba(0,0,0,0)'
|
177
181
|
}
|
178
182
|
|
179
183
|
|
@@ -203,7 +207,6 @@
|
|
203
207
|
ca = this.canvas,
|
204
208
|
co = ca.getContext('2d'),
|
205
209
|
prop = this.properties,
|
206
|
-
pa = RG.Path,
|
207
210
|
pa2 = RG.path2,
|
208
211
|
win = window,
|
209
212
|
doc = document,
|
@@ -255,10 +258,9 @@
|
|
255
258
|
|
256
259
|
|
257
260
|
// Convert uppercase letters to dot+lower case letter
|
258
|
-
name
|
259
|
-
|
260
|
-
|
261
|
-
});
|
261
|
+
while(name.match(/([A-Z])/)) {
|
262
|
+
name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
|
263
|
+
}
|
262
264
|
|
263
265
|
|
264
266
|
|
@@ -769,7 +771,6 @@
|
|
769
771
|
co.drawImage(this.__needle_image__,
|
770
772
|
this.centerx + prop['chart.needle.image.offsetx'],
|
771
773
|
this.centery + prop['chart.needle.image.offsety']);
|
772
|
-
//pa(co, ['b', 'r', this.centerx, this.centery, 1, 1, 'f', 'red']);
|
773
774
|
co.restore();
|
774
775
|
}
|
775
776
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
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
|
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
|
@@ -39,6 +39,15 @@
|
|
39
39
|
|
40
40
|
// Install the event handlers
|
41
41
|
window.onresize = ModalDialog.Resize;
|
42
|
+
|
43
|
+
// Add an event listener so that the
|
44
|
+
// ESC key hides the dialog
|
45
|
+
document.body.addEventListener('keydown', function (e)
|
46
|
+
{
|
47
|
+
if (e.keyCode === 27) {
|
48
|
+
ModalDialog.hide();
|
49
|
+
}
|
50
|
+
}, false);
|
42
51
|
|
43
52
|
|
44
53
|
// Call them initially
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
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
|
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
|
@@ -95,7 +95,10 @@
|
|
95
95
|
'chart.needle.triangle.border': '#aaa',
|
96
96
|
'chart.text.size': 12,
|
97
97
|
'chart.text.color': 'black',
|
98
|
-
'chart.text.font': 'Arial',
|
98
|
+
'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
99
|
+
'chart.text.accessible': true,
|
100
|
+
'chart.text.accessible.overflow': 'visible',
|
101
|
+
'chart.text.accessible.pointerevents': false,
|
99
102
|
'chart.green.max': max * 0.75,
|
100
103
|
'chart.red.min': max * 0.9,
|
101
104
|
'chart.green.color': 'Gradient(white:#0c0)',
|
@@ -178,7 +181,8 @@
|
|
178
181
|
'chart.key.text.size': 10,
|
179
182
|
'chart.key.colors': null,
|
180
183
|
'chart.key.text.color': 'black',
|
181
|
-
'chart.adjustable': false
|
184
|
+
'chart.adjustable': false,
|
185
|
+
'chart.clearto': 'rgba(0,0,0,0)'
|
182
186
|
}
|
183
187
|
|
184
188
|
|
@@ -200,7 +204,6 @@
|
|
200
204
|
ca = this.canvas,
|
201
205
|
co = ca.getContext('2d'),
|
202
206
|
prop = this.properties,
|
203
|
-
pa = RG.Path,
|
204
207
|
pa2 = RG.path2,
|
205
208
|
win = window,
|
206
209
|
doc = document,
|
@@ -253,10 +256,9 @@
|
|
253
256
|
|
254
257
|
|
255
258
|
// Convert uppercase letters to dot+lower case letter
|
256
|
-
name
|
257
|
-
|
258
|
-
|
259
|
-
});
|
259
|
+
while(name.match(/([A-Z])/)) {
|
260
|
+
name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
|
261
|
+
}
|
260
262
|
|
261
263
|
if (name == 'chart.needle.style') {
|
262
264
|
alert('[RGRAPH] The RGraph property chart.needle.style has changed to chart.needle.color');
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
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
|
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
|
@@ -29,16 +29,16 @@
|
|
29
29
|
&& typeof conf.data === 'object'
|
30
30
|
&& typeof conf.id === 'string') {
|
31
31
|
|
32
|
-
var id = conf.id
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
var id = conf.id,
|
33
|
+
canvas = document.getElementById(id),
|
34
|
+
data = conf.data,
|
35
|
+
parseConfObjectForOptions = true; // Set this so the config is parsed (at the end of the constructor
|
36
36
|
|
37
37
|
} else {
|
38
38
|
|
39
|
-
var id = conf
|
40
|
-
|
41
|
-
|
39
|
+
var id = conf,
|
40
|
+
canvas = document.getElementById(id),
|
41
|
+
data = arguments[1];
|
42
42
|
}
|
43
43
|
|
44
44
|
|
@@ -67,25 +67,30 @@
|
|
67
67
|
this.firstDraw = true; // After the first draw this will be false
|
68
68
|
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
//
|
71
|
+
// Go through the data and convert strings to numbers
|
72
|
+
//
|
73
|
+
for (var i=0; i<this.data.length; ++i) {
|
74
|
+
if (typeof this.data[i] === 'string') {
|
75
|
+
this.data[i] = parseFloat(this.data[i]);
|
76
|
+
}
|
77
|
+
}
|
74
78
|
|
75
79
|
this.properties =
|
76
80
|
{
|
77
81
|
'chart.centerx.adjust': 0,
|
78
82
|
'chart.centery.adjust': 0,
|
79
|
-
'chart.colors': ['
|
83
|
+
'chart.colors': ['red', '#ccc', '#cfc', 'blue', 'pink', 'yellow', 'black', 'orange', 'cyan', 'purple', '#78CAEA', '#E284E9', 'white', 'blue', '#9E7BF6'],
|
80
84
|
'chart.strokestyle': 'white',
|
81
85
|
'chart.linewidth': 3,
|
82
86
|
'chart.labels': [],
|
83
87
|
'chart.labels.sticks': false,
|
84
88
|
'chart.labels.sticks.length': 7,
|
85
|
-
'chart.labels.sticks.
|
86
|
-
'chart.labels.sticks.usecolors':
|
89
|
+
'chart.labels.sticks.colors': null,
|
90
|
+
'chart.labels.sticks.usecolors': true,
|
87
91
|
'chart.labels.sticks.linewidth': 1,
|
88
92
|
'chart.labels.sticks.hlength': 5,
|
93
|
+
'chart.labels.sticks.list': false,
|
89
94
|
'chart.labels.ingraph': null,
|
90
95
|
'chart.labels.ingraph.color': null,
|
91
96
|
'chart.labels.ingraph.font': null,
|
@@ -98,7 +103,7 @@
|
|
98
103
|
'chart.labels.ingraph.radius': null,
|
99
104
|
'chart.labels.center': null,
|
100
105
|
'chart.labels.center.size': 26,
|
101
|
-
'chart.labels.center.font': 'Arial',
|
106
|
+
'chart.labels.center.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
102
107
|
'chart.labels.center.color': 'black',
|
103
108
|
'chart.labels.center.italic': false,
|
104
109
|
'chart.labels.center.bold': false,
|
@@ -125,7 +130,10 @@
|
|
125
130
|
'chart.shadow.blur': 15,
|
126
131
|
'chart.text.size': 12,
|
127
132
|
'chart.text.color': 'black',
|
128
|
-
'chart.text.font': 'Arial',
|
133
|
+
'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
134
|
+
'chart.text.accessible': true,
|
135
|
+
'chart.text.accessible.overflow': 'visible',
|
136
|
+
'chart.text.accessible.pointerevents': false,
|
129
137
|
'chart.contextmenu': null,
|
130
138
|
'chart.tooltips': null,
|
131
139
|
'chart.tooltips.event': 'onclick',
|
@@ -133,8 +141,9 @@
|
|
133
141
|
'chart.tooltips.css.class': 'RGraph_tooltip',
|
134
142
|
'chart.tooltips.highlight': true,
|
135
143
|
'chart.highlight.style': '2d',
|
136
|
-
'chart.highlight.style.
|
137
|
-
'chart.highlight.style.
|
144
|
+
'chart.highlight.style.twod.fill': 'rgba(255,255,255,0.7)',
|
145
|
+
'chart.highlight.style.twod.stroke': 'rgba(255,255,255,0.7)',
|
146
|
+
'chart.highlight.style.outline.width': null,
|
138
147
|
'chart.centerx': null,
|
139
148
|
'chart.centery': null,
|
140
149
|
'chart.radius': null,
|
@@ -188,7 +197,8 @@
|
|
188
197
|
'chart.centerpin.stroke': 'white',
|
189
198
|
'chart.origin': 0 - (Math.PI / 2),
|
190
199
|
'chart.events': true,
|
191
|
-
'chart.labels.colors': []
|
200
|
+
'chart.labels.colors': [],
|
201
|
+
'chart.clearto': 'rgba(0,0,0,0)'
|
192
202
|
}
|
193
203
|
|
194
204
|
|
@@ -223,7 +233,6 @@
|
|
223
233
|
ca = this.canvas,
|
224
234
|
co = ca.getContext('2d'),
|
225
235
|
prop = this.properties,
|
226
|
-
pa = RG.Path,
|
227
236
|
pa2 = RG.path2,
|
228
237
|
win = window,
|
229
238
|
doc = document,
|
@@ -273,13 +282,19 @@
|
|
273
282
|
|
274
283
|
|
275
284
|
// Convert uppercase letters to dot+lower case letter
|
276
|
-
name
|
277
|
-
|
278
|
-
|
279
|
-
|
285
|
+
while(name.match(/([A-Z])/)) {
|
286
|
+
name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
|
287
|
+
}
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
if (name == 'chart.highlight.style.twod.color') {
|
292
|
+
name = 'chart.highlight.style.twod.fill';
|
293
|
+
}
|
294
|
+
|
280
295
|
|
281
|
-
if (name == 'chart.
|
282
|
-
name = 'chart.
|
296
|
+
if (name == 'chart.labels.spaced') {
|
297
|
+
name = 'chart.labels.sticks.list';
|
283
298
|
}
|
284
299
|
|
285
300
|
|
@@ -314,8 +329,8 @@
|
|
314
329
|
return '.' + String(RegExp.$1).toLowerCase()
|
315
330
|
});
|
316
331
|
|
317
|
-
if (name == 'chart.highlight.style.
|
318
|
-
name = 'chart.highlight.style.
|
332
|
+
if (name == 'chart.highlight.style.twod.color') {
|
333
|
+
name = 'chart.highlight.style.twod.fill';
|
319
334
|
}
|
320
335
|
|
321
336
|
return prop[name];
|
@@ -376,7 +391,8 @@
|
|
376
391
|
// Don't want to do this again
|
377
392
|
this.colorsParsed = true;
|
378
393
|
}
|
379
|
-
|
394
|
+
|
395
|
+
|
380
396
|
|
381
397
|
|
382
398
|
/**
|
@@ -668,9 +684,7 @@
|
|
668
684
|
} else if (RGraph.ISOLD && radians == 0) {
|
669
685
|
radians = 0.001;
|
670
686
|
}
|
671
|
-
|
672
|
-
var context = co;
|
673
|
-
var canvas = ca;
|
687
|
+
|
674
688
|
var subTotal = this.subTotal;
|
675
689
|
radians = radians * prop['chart.effect.roundrobin.multiplier'];
|
676
690
|
|
@@ -681,11 +695,13 @@
|
|
681
695
|
co.lineWidth = 0;
|
682
696
|
|
683
697
|
if (prop['chart.shadow']) {
|
684
|
-
RG.
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
698
|
+
RG.setShadow(
|
699
|
+
this,
|
700
|
+
prop['chart.shadow.color'],
|
701
|
+
prop['chart.shadow.offsetx'],
|
702
|
+
prop['chart.shadow.offsety'],
|
703
|
+
prop['chart.shadow.blur']
|
704
|
+
);
|
689
705
|
}
|
690
706
|
|
691
707
|
/**
|
@@ -760,6 +776,11 @@
|
|
760
776
|
this.drawLabels =
|
761
777
|
this.DrawLabels = function ()
|
762
778
|
{
|
779
|
+
// New way of spacing labels out
|
780
|
+
if (prop['chart.labels'].length && prop['chart.labels.sticks.list']) {
|
781
|
+
return this.drawLabelsList();
|
782
|
+
}
|
783
|
+
|
763
784
|
var hAlignment = 'left';
|
764
785
|
var vAlignment = 'center';
|
765
786
|
var labels = prop['chart.labels'];
|
@@ -851,16 +872,18 @@
|
|
851
872
|
co.fillStyle = prop['chart.labels.colors'][i];
|
852
873
|
}
|
853
874
|
|
854
|
-
|
855
|
-
RG.
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
875
|
+
|
876
|
+
RG.text2(this, {
|
877
|
+
'font':font,
|
878
|
+
'size':text_size,
|
879
|
+
'x':x,
|
880
|
+
'y':y,
|
881
|
+
'text':labels[i],
|
882
|
+
'valign':vAlignment,
|
883
|
+
'halign':hAlignment,
|
884
|
+
'tag': 'labels',
|
885
|
+
color: prop['chart.labels.sticks.usecolors'] ? prop['chart.colors'][i] : 'black'
|
886
|
+
});
|
864
887
|
}
|
865
888
|
|
866
889
|
co.fill();
|
@@ -870,24 +893,243 @@
|
|
870
893
|
|
871
894
|
|
872
895
|
|
896
|
+
//
|
897
|
+
// A new way of spacing out labels
|
898
|
+
//
|
899
|
+
this.drawLabelsList = function ()
|
900
|
+
{
|
901
|
+
var segment = this.angles[i],
|
902
|
+
labels = prop['chart.labels'],
|
903
|
+
labels_right = [],
|
904
|
+
labels_left = [],
|
905
|
+
text_font = prop['chart.text.font'],
|
906
|
+
text_size = prop['chart.text.size'],
|
907
|
+
text_color = prop['chart.text.color'],
|
908
|
+
left = [],
|
909
|
+
right = [],
|
910
|
+
centerx = this.centerx,
|
911
|
+
centery = this.centery,
|
912
|
+
radius = this.radius,
|
913
|
+
offset = 50
|
914
|
+
|
915
|
+
|
916
|
+
|
917
|
+
|
918
|
+
|
919
|
+
|
920
|
+
|
921
|
+
|
922
|
+
//
|
923
|
+
// Draw the right hand side labels first
|
924
|
+
//
|
925
|
+
for (var i=0; i<this.angles.length; ++i) {
|
926
|
+
|
927
|
+
var angle = this.angles[i][0] + ((this.angles[i][1] - this.angles[i][0]) / 2), // Midpoint
|
928
|
+
endpoint_inner = RG.getRadiusEndPoint(centerx, centery, angle, radius + 5),
|
929
|
+
endpoint_outer = RG.getRadiusEndPoint(centerx, centery, angle, radius + 10),
|
930
|
+
explosion = [
|
931
|
+
(typeof prop['chart.exploded'] === 'number' ? prop['chart.exploded'] : prop['chart.exploded'][i]),
|
932
|
+
(ma.cos(angle) * (typeof prop['chart.exploded'] === 'number' ? prop['chart.exploded'] : prop['chart.exploded'][i])),
|
933
|
+
(ma.sin(angle) * (typeof prop['chart.exploded'] === 'number' ? prop['chart.exploded'] : prop['chart.exploded'][i]))
|
934
|
+
]
|
935
|
+
|
936
|
+
|
937
|
+
//
|
938
|
+
// Work out the color
|
939
|
+
//
|
940
|
+
if ( typeof prop['chart.labels.sticks.colors'] === 'object' && prop['chart.labels.sticks.colors'] && prop['chart.labels.sticks.colors'][i] ) {
|
941
|
+
var color = prop['chart.labels.sticks.colors'][i];
|
942
|
+
} else if ( prop['chart.labels.sticks.usecolors'] && prop['chart.colors'][i] ) {
|
943
|
+
var color = prop['chart.colors'][i];
|
944
|
+
} else {
|
945
|
+
var color = prop['chart.text.color'];
|
946
|
+
}
|
947
|
+
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
if (angle > (-1 * RG.HALFPI) && angle < RG.HALFPI) {
|
952
|
+
labels_right.push([
|
953
|
+
i,
|
954
|
+
angle,
|
955
|
+
labels[i] ? labels[i] : '',
|
956
|
+
endpoint_inner,
|
957
|
+
endpoint_outer,
|
958
|
+
color,
|
959
|
+
RG.arrayClone(explosion)
|
960
|
+
]);
|
961
|
+
} else {
|
962
|
+
labels_left.push([
|
963
|
+
i,
|
964
|
+
angle,
|
965
|
+
labels[i] ? labels[i] : '',
|
966
|
+
endpoint_inner,
|
967
|
+
endpoint_outer,
|
968
|
+
color,
|
969
|
+
RG.arrayClone(explosion)
|
970
|
+
]);
|
971
|
+
}
|
972
|
+
}
|
973
|
+
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
//
|
978
|
+
// Draw the right hand side labels first
|
979
|
+
//
|
980
|
+
|
981
|
+
|
982
|
+
// Calculate how much space there is for each label
|
983
|
+
var vspace_right = (ca.height - prop['chart.gutter.top'] - prop['chart.gutter.bottom']) / labels_right.length
|
984
|
+
|
985
|
+
for (var i=0,y=(prop['chart.gutter.top'] + (vspace_right / 2)); i<labels_right.length; y+=vspace_right,i++) {
|
986
|
+
|
987
|
+
if (labels_right[i][2]) {
|
988
|
+
|
989
|
+
var x = this.centerx + this.radius + offset,
|
990
|
+
idx = labels_right[i][0],
|
991
|
+
explosionX = labels_right[i][6][0] ? labels_right[i][6][1] : 0,
|
992
|
+
explosionY = labels_right[i][6][0] ? labels_right[i][6][2] : 0
|
993
|
+
|
994
|
+
var ret = RG.text2(this, {
|
995
|
+
font: text_font,
|
996
|
+
size: text_size,
|
997
|
+
x: x + explosionX,
|
998
|
+
y: y + explosionY,
|
999
|
+
text: labels_right[i][2],
|
1000
|
+
valign: 'center',
|
1001
|
+
halign: 'left',
|
1002
|
+
tag: 'labels',
|
1003
|
+
color: labels_right[i][5]
|
1004
|
+
});
|
1005
|
+
|
1006
|
+
if (ret && ret.node) {
|
1007
|
+
ret.node.__index__ = labels_right[i][0];
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
|
1011
|
+
pa2(co, 'lc round lw % b m % % l % % l % % l % % s %',
|
1012
|
+
|
1013
|
+
prop['chart.labels.sticks.linewidth'],
|
1014
|
+
|
1015
|
+
labels_right[i][3][0] + explosionX,
|
1016
|
+
labels_right[i][3][1] + explosionY,
|
1017
|
+
|
1018
|
+
labels_right[i][4][0] + explosionX,
|
1019
|
+
labels_right[i][4][1] + explosionY,
|
1020
|
+
|
1021
|
+
this.centerx + this.radius + 25 + explosionX,
|
1022
|
+
ma.round(labels_right[i][4][1] + explosionY),
|
1023
|
+
|
1024
|
+
ret.x - 5 ,
|
1025
|
+
ret.y + (ret.height / 2),
|
1026
|
+
|
1027
|
+
labels_right[i][5]
|
1028
|
+
);
|
1029
|
+
}
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
|
1033
|
+
|
1034
|
+
|
1035
|
+
|
1036
|
+
|
1037
|
+
|
1038
|
+
|
1039
|
+
|
1040
|
+
//
|
1041
|
+
// Draw the left hand side labels
|
1042
|
+
//
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
|
1047
|
+
|
1048
|
+
// Calculate how much space there is for each label
|
1049
|
+
var vspace_left = (ca.height - prop['chart.gutter.top'] - prop['chart.gutter.bottom']) / labels_left.length
|
1050
|
+
|
1051
|
+
for (var i=(labels_left.length - 1),y=(prop['chart.gutter.top'] + (vspace_left / 2)); i>=0; y+=vspace_left,i--) {
|
1052
|
+
|
1053
|
+
if (labels_left[i][2]) {
|
1054
|
+
|
1055
|
+
var x = this.centerx - this.radius - offset,
|
1056
|
+
idx = labels_left[i][0],
|
1057
|
+
explosionX = labels_left[i][6][0] ? labels_left[i][6][1] : 0,
|
1058
|
+
explosionY = labels_left[i][6][0] ? labels_left[i][6][2] : 0
|
1059
|
+
|
1060
|
+
var ret = RG.text2(this, {
|
1061
|
+
font: text_font,
|
1062
|
+
size: text_size,
|
1063
|
+
x: x + explosionX,
|
1064
|
+
y: y + explosionY,
|
1065
|
+
text: labels_left[i][2],
|
1066
|
+
valign: 'center',
|
1067
|
+
halign: 'right',
|
1068
|
+
tag: 'labels',
|
1069
|
+
color: labels_left[i][5]
|
1070
|
+
});
|
1071
|
+
|
1072
|
+
if (ret && ret.node) {
|
1073
|
+
ret.node.__index__ = labels_left[i][0];
|
1074
|
+
}
|
873
1075
|
|
1076
|
+
pa2(co,
|
1077
|
+
'lw % b m % % l % % l % % l % % s %',
|
1078
|
+
|
1079
|
+
prop['chart.labels.sticks.linewidth'],
|
1080
|
+
|
1081
|
+
labels_left[i][3][0] + explosionX,
|
1082
|
+
labels_left[i][3][1] + explosionY,
|
1083
|
+
|
1084
|
+
labels_left[i][4][0] + explosionX,
|
1085
|
+
labels_left[i][4][1] + explosionY,
|
1086
|
+
|
1087
|
+
this.centerx - this.radius - 25 + explosionX,
|
1088
|
+
ma.round(labels_left[i][4][1] + explosionY),
|
1089
|
+
|
1090
|
+
ret.x + 5 + ret.width,
|
1091
|
+
ret.y + (ret.height / 2),
|
1092
|
+
|
1093
|
+
labels_left[i][5]
|
1094
|
+
);
|
1095
|
+
}
|
1096
|
+
}
|
1097
|
+
};
|
1098
|
+
|
1099
|
+
|
1100
|
+
|
1101
|
+
|
1102
|
+
|
1103
|
+
|
1104
|
+
|
1105
|
+
|
1106
|
+
|
1107
|
+
|
1108
|
+
|
1109
|
+
|
1110
|
+
|
1111
|
+
|
1112
|
+
|
1113
|
+
|
1114
|
+
|
1115
|
+
|
1116
|
+
|
874
1117
|
/**
|
875
1118
|
* This function draws the pie chart sticks (for the labels)
|
876
1119
|
*/
|
877
1120
|
this.drawSticks =
|
878
1121
|
this.DrawSticks = function ()
|
879
1122
|
{
|
880
|
-
var
|
881
|
-
offset = prop['chart.linewidth'] / 2,
|
1123
|
+
var offset = prop['chart.linewidth'] / 2,
|
882
1124
|
exploded = prop['chart.exploded'],
|
883
1125
|
sticks = prop['chart.labels.sticks'],
|
884
1126
|
colors = prop['chart.colors'],
|
885
1127
|
cx = this.centerx,
|
886
1128
|
cy = this.centery,
|
887
1129
|
radius = this.radius,
|
888
|
-
points
|
889
|
-
linewidth
|
890
|
-
|
1130
|
+
points = [],
|
1131
|
+
linewidth = prop['chart.labels.sticks.linewidth']
|
1132
|
+
|
891
1133
|
for (var i=0,len=this.angles.length; i<len; ++i) {
|
892
1134
|
|
893
1135
|
var segment = this.angles[i];
|
@@ -900,9 +1142,13 @@
|
|
900
1142
|
var radians = segment[1] - segment[0];
|
901
1143
|
|
902
1144
|
co.beginPath();
|
903
|
-
co.strokeStyle = prop['chart.labels.sticks.
|
904
|
-
co.lineWidth =
|
1145
|
+
co.strokeStyle = typeof prop['chart.labels.sticks.colors'] === 'string' ? prop['chart.labels.sticks.colors'] : (!RG.isNull(prop['chart.labels.sticks.colors']) ? prop['chart.labels.sticks.colors'][0] : 'gray');
|
1146
|
+
co.lineWidth = linewidth;
|
905
1147
|
|
1148
|
+
if (typeof prop['chart.labels.sticks.color'] === 'string') {
|
1149
|
+
co.strokeStyle = prop['chart.labels.sticks.color'];
|
1150
|
+
}
|
1151
|
+
|
906
1152
|
//
|
907
1153
|
// Allow for labelsSticksUseColors
|
908
1154
|
//
|
@@ -1145,8 +1391,8 @@
|
|
1145
1391
|
this.highlight_segment = function (segment)
|
1146
1392
|
{
|
1147
1393
|
co.beginPath();
|
1148
|
-
co.strokeStyle = prop['chart.highlight.style.
|
1149
|
-
co.fillStyle = prop['chart.highlight.style.
|
1394
|
+
co.strokeStyle = prop['chart.highlight.style.twod.stroke'];
|
1395
|
+
co.fillStyle = prop['chart.highlight.style.twod.fill'];
|
1150
1396
|
co.moveTo(segment[0], segment[1]);
|
1151
1397
|
co.arc(segment[0], segment[1], segment[2], this.angles[segment[5]][0], this.angles[segment[5]][1], 0);
|
1152
1398
|
co.lineTo(segment[0], segment[1]);
|
@@ -1160,7 +1406,8 @@
|
|
1160
1406
|
|
1161
1407
|
|
1162
1408
|
/**
|
1163
|
-
* Each object type has its own Highlight() function which highlights
|
1409
|
+
* Each object type has its own Highlight() function which highlights
|
1410
|
+
* the appropriate shape
|
1164
1411
|
*
|
1165
1412
|
* @param object shape The shape to highlight
|
1166
1413
|
*/
|
@@ -1168,10 +1415,14 @@
|
|
1168
1415
|
this.Highlight = function (shape)
|
1169
1416
|
{
|
1170
1417
|
if (prop['chart.tooltips.highlight']) {
|
1418
|
+
|
1419
|
+
if (typeof prop['chart.highlight.style'] === 'function') {
|
1420
|
+
(prop['chart.highlight.style'])(shape);
|
1421
|
+
|
1171
1422
|
/**
|
1172
1423
|
* 3D style of highlighting
|
1173
1424
|
*/
|
1174
|
-
if (prop['chart.highlight.style'] == '3d') {
|
1425
|
+
} else if (prop['chart.highlight.style'] == '3d') {
|
1175
1426
|
|
1176
1427
|
co.lineWidth = 1;
|
1177
1428
|
|
@@ -1225,6 +1476,44 @@
|
|
1225
1476
|
co.arc(shape['x'] - extent, shape['y'] - extent, shape['radius'] - 2, shape['angle.start'], shape['angle.end'], false);
|
1226
1477
|
co.stroke();
|
1227
1478
|
}
|
1479
|
+
|
1480
|
+
|
1481
|
+
|
1482
|
+
|
1483
|
+
// Outline style of highlighting
|
1484
|
+
} else if (prop['chart.highlight.style'] === 'outline') {
|
1485
|
+
|
1486
|
+
var tooltip = RG.Registry.get('chart.tooltip'),
|
1487
|
+
index = tooltip.__index__,
|
1488
|
+
coords = this.angles[index],
|
1489
|
+
color = this.get('colors')[index]
|
1490
|
+
width = this.radius / 12.5;
|
1491
|
+
|
1492
|
+
// Allow custom setting of outline
|
1493
|
+
if (typeof prop['chart.highlight.style.outline.width'] === 'number') {
|
1494
|
+
width = prop['chart.highlight.style.outline.width'];
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
|
1498
|
+
|
1499
|
+
RGraph.path2(
|
1500
|
+
co,
|
1501
|
+
'ga 0.25 b a % % % % % false a % % % % % true c f % ga 1',
|
1502
|
+
coords[2],
|
1503
|
+
coords[3],
|
1504
|
+
this.radius + 2 + width,
|
1505
|
+
coords[0],
|
1506
|
+
coords[1],
|
1507
|
+
|
1508
|
+
coords[2],
|
1509
|
+
coords[3],
|
1510
|
+
this.radius + 2,
|
1511
|
+
coords[1],
|
1512
|
+
coords[0],
|
1513
|
+
color
|
1514
|
+
);
|
1515
|
+
|
1516
|
+
|
1228
1517
|
|
1229
1518
|
|
1230
1519
|
|
@@ -1234,8 +1523,8 @@
|
|
1234
1523
|
|
1235
1524
|
co.beginPath();
|
1236
1525
|
|
1237
|
-
co.strokeStyle = prop['chart.highlight.style.
|
1238
|
-
co.fillStyle = prop['chart.highlight.style.
|
1526
|
+
co.strokeStyle = prop['chart.highlight.style.twod.stroke'];
|
1527
|
+
co.fillStyle = prop['chart.highlight.style.twod.fill'];
|
1239
1528
|
|
1240
1529
|
if (prop['chart.variant'].indexOf('donut') > -1) {
|
1241
1530
|
co.arc(shape['x'], shape['y'], shape['radius'], shape['angle.start'], shape['angle.end'], false);
|
@@ -1246,7 +1535,7 @@
|
|
1246
1535
|
}
|
1247
1536
|
co.closePath();
|
1248
1537
|
|
1249
|
-
|
1538
|
+
co.stroke();
|
1250
1539
|
co.fill();
|
1251
1540
|
}
|
1252
1541
|
}
|
@@ -1305,6 +1594,7 @@
|
|
1305
1594
|
{
|
1306
1595
|
var coordX = obj.angles[idx][2];
|
1307
1596
|
var coordY = obj.angles[idx][3];
|
1597
|
+
var mouseXY = RG.getMouseXY(window.event);
|
1308
1598
|
var angleStart = obj.angles[idx][0];
|
1309
1599
|
var angleEnd = obj.angles[idx][1];
|
1310
1600
|
var angleCenter = ((angleEnd - angleStart) / 2) + angleStart;
|
@@ -1313,40 +1603,31 @@
|
|
1313
1603
|
var gutterTop = prop['chart.gutter.top'];
|
1314
1604
|
var width = tooltip.offsetWidth;
|
1315
1605
|
var height = tooltip.offsetHeight;
|
1316
|
-
var x = canvasXY[0] + this.angles[idx][2] + (Math.cos(angleCenter) * (prop['chart.variant'] == 'donut' && typeof(prop['chart.variant.donut.width']) == 'number' ? ((this.radius - prop['chart.variant.donut.width']) + (prop['chart.variant.donut.width'] / 2)) : (this.radius * 0.
|
1317
|
-
var y = canvasXY[1] + this.angles[idx][3] + (Math.sin(angleCenter) * (prop['chart.variant'] == 'donut' && typeof(prop['chart.variant.donut.width']) == 'number' ? ((this.radius - prop['chart.variant.donut.width']) + (prop['chart.variant.donut.width'] / 2)) : (this.radius * 0.
|
1606
|
+
var x = canvasXY[0] + this.angles[idx][2] + (Math.cos(angleCenter) * (prop['chart.variant'] == 'donut' && typeof(prop['chart.variant.donut.width']) == 'number' ? ((this.radius - prop['chart.variant.donut.width']) + (prop['chart.variant.donut.width'] / 2)) : (this.radius * 0.5)));
|
1607
|
+
var y = canvasXY[1] + this.angles[idx][3] + (Math.sin(angleCenter) * (prop['chart.variant'] == 'donut' && typeof(prop['chart.variant.donut.width']) == 'number' ? ((this.radius - prop['chart.variant.donut.width']) + (prop['chart.variant.donut.width'] / 2)) : (this.radius * 0.5)));
|
1318
1608
|
|
1319
1609
|
|
1320
1610
|
// By default any overflow is hidden
|
1321
1611
|
tooltip.style.overflow = '';
|
1322
|
-
|
1323
|
-
//
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
img.id = '__rgraph_tooltip_pointer__';
|
1328
|
-
img.style.top = (tooltip.offsetHeight - 2) + 'px';
|
1329
|
-
tooltip.appendChild(img);
|
1612
|
+
|
1613
|
+
// Set the top position
|
1614
|
+
tooltip.style.left = 0;
|
1615
|
+
tooltip.style.top = window.event.pageY - height - 5 + 'px';
|
1616
|
+
|
1330
1617
|
|
1331
1618
|
// Reposition the tooltip if at the edges:
|
1332
1619
|
|
1333
1620
|
// LEFT edge
|
1334
|
-
if (
|
1335
|
-
tooltip.style.left =
|
1336
|
-
tooltip.style.top = (y - height - 4) + 'px';
|
1337
|
-
img.style.left = ((width * 0.1) - 8.5) + 'px';
|
1621
|
+
if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
|
1622
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
|
1338
1623
|
|
1339
1624
|
// RIGHT edge
|
1340
|
-
} else if (
|
1341
|
-
tooltip.style.left =
|
1342
|
-
tooltip.style.top = (y - height - 4) + 'px';
|
1343
|
-
img.style.left = ((width * 0.9) - 8.5) + 'px';
|
1625
|
+
} else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
|
1626
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
|
1344
1627
|
|
1345
1628
|
// Default positioning - CENTERED
|
1346
1629
|
} else {
|
1347
|
-
tooltip.style.left =
|
1348
|
-
tooltip.style.top = (y - height - 4) + 'px';
|
1349
|
-
img.style.left = ((width * 0.5) - 8.5) + 'px';
|
1630
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
|
1350
1631
|
}
|
1351
1632
|
};
|
1352
1633
|
|
@@ -1508,8 +1789,8 @@
|
|
1508
1789
|
this.original_colors['chart.key.colors'] = RG.arrayClone(prop['chart.key.colors']);
|
1509
1790
|
this.original_colors['chart.strokestyle'] = RG.arrayClone(prop['chart.strokestyle']);
|
1510
1791
|
this.original_colors['chart.highlight.stroke'] = RG.arrayClone(prop['chart.highlight.stroke']);
|
1511
|
-
this.original_colors['chart.highlight.style.
|
1512
|
-
this.original_colors['chart.highlight.style.stroke']
|
1792
|
+
this.original_colors['chart.highlight.style.twod.fill'] = RG.arrayClone(prop['chart.highlight.style.twod.fill']);
|
1793
|
+
this.original_colors['chart.highlight.style.twod.stroke'] = RG.arrayClone(prop['chart.highlight.style.twod.stroke']);
|
1513
1794
|
this.original_colors['chart.ingraph.bounding.fill'] = RG.arrayClone(prop['chart.ingraph.bounding.fill']);
|
1514
1795
|
this.original_colors['chart.ingraph.color'] = RG.arrayClone(prop['chart.ingraph.color']);
|
1515
1796
|
}
|
@@ -1527,8 +1808,8 @@
|
|
1527
1808
|
|
1528
1809
|
prop['chart.strokestyle'] = this.parseSingleColorForGradient(prop['chart.strokestyle']);
|
1529
1810
|
prop['chart.highlight.stroke'] = this.parseSingleColorForGradient(prop['chart.highlight.stroke']);
|
1530
|
-
prop['chart.highlight.style.
|
1531
|
-
prop['chart.highlight.style.
|
1811
|
+
prop['chart.highlight.style.twod.fill'] = this.parseSingleColorForGradient(prop['chart.highlight.style.twod.fill']);
|
1812
|
+
prop['chart.highlight.style.twod.stroke'] = this.parseSingleColorForGradient(prop['chart.highlight.style.twod.stroke']);
|
1532
1813
|
prop['chart.labels.ingraph.bounding.fill'] = this.parseSingleColorForGradient(prop['chart.labels.ingraph.bounding.fill']);
|
1533
1814
|
prop['chart.labels.ingraph.color'] = this.parseSingleColorForGradient(prop['chart.labels.ingraph.color']);
|
1534
1815
|
};
|
@@ -1721,7 +2002,7 @@
|
|
1721
2002
|
if (prop['chart.variant'].indexOf('donut') !== -1) {
|
1722
2003
|
|
1723
2004
|
for (var j=0; j<this.angles.length; ++j) {
|
1724
|
-
|
2005
|
+
pa2(co,[
|
1725
2006
|
'b',
|
1726
2007
|
'a', this.angles[j][2], this.angles[j][3], this.radius + 1, this.angles[j][0], this.angles[j][1] * prop['chart.effect.roundrobin.multiplier'], false,
|
1727
2008
|
'a', this.angles[j][2], this.angles[j][3], this.radius / 2, this.angles[j][1] * prop['chart.effect.roundrobin.multiplier'], this.angles[j][0], true,
|
@@ -1734,7 +2015,7 @@
|
|
1734
2015
|
|
1735
2016
|
for (var j=0; j<this.angles.length; ++j) {
|
1736
2017
|
|
1737
|
-
|
2018
|
+
pa2(co,[
|
1738
2019
|
'b',
|
1739
2020
|
'm', this.angles[j][2], this.angles[j][3],
|
1740
2021
|
'a', this.angles[j][2],
|
@@ -1871,14 +2152,16 @@
|
|
1871
2152
|
this.roundrobin =
|
1872
2153
|
this.roundRobin = function ()
|
1873
2154
|
{
|
1874
|
-
var obj = this
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
2155
|
+
var obj = this,
|
2156
|
+
opt = arguments[0] || {},
|
2157
|
+
callback = arguments[1] || function () {},
|
2158
|
+
frame = 0,
|
2159
|
+
frames = opt.frames || 30,
|
2160
|
+
radius = obj.getRadius(),
|
2161
|
+
labels = obj.get('labels')
|
1880
2162
|
|
1881
2163
|
obj.Set('chart.events', false);
|
2164
|
+
obj.Set('chart.labels', []);
|
1882
2165
|
|
1883
2166
|
var iterator = function ()
|
1884
2167
|
{
|
@@ -1893,11 +2176,13 @@
|
|
1893
2176
|
RGraph.Effects.updateCanvas(iterator);
|
1894
2177
|
|
1895
2178
|
} else {
|
1896
|
-
|
1897
|
-
// Re-enable the events and redraw the chart.
|
1898
|
-
obj.set('events', true);
|
1899
|
-
RGraph.redrawCanvas(obj.canvas);
|
1900
2179
|
|
2180
|
+
obj.set({
|
2181
|
+
events: true,
|
2182
|
+
labels: labels
|
2183
|
+
});
|
2184
|
+
|
2185
|
+
RG.redrawCanvas(obj.canvas);
|
1901
2186
|
callback(obj);
|
1902
2187
|
}
|
1903
2188
|
};
|