highcharts-rails 4.0.4.1 → 4.1.0
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/CHANGELOG.markdown +92 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/highcharts.js +1865 -1219
- data/app/assets/javascripts/highcharts/adapters/standalone-framework.js +1 -1
- data/app/assets/javascripts/highcharts/highcharts-3d.js +174 -239
- data/app/assets/javascripts/highcharts/highcharts-more.js +195 -187
- data/app/assets/javascripts/highcharts/modules/canvas-tools.js +1 -1
- data/app/assets/javascripts/highcharts/modules/data.js +125 -196
- data/app/assets/javascripts/highcharts/modules/drilldown.js +104 -80
- data/app/assets/javascripts/highcharts/modules/exporting.js +14 -4
- data/app/assets/javascripts/highcharts/modules/funnel.js +7 -7
- data/app/assets/javascripts/highcharts/modules/heatmap.js +26 -69
- data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +2 -2
- data/app/assets/javascripts/highcharts/modules/solid-gauge.js +32 -17
- data/app/assets/javascripts/highcharts/modules/treemap.js +806 -0
- data/app/assets/javascripts/highcharts/themes/dark-unica.js +1 -1
- data/app/assets/javascripts/highcharts/themes/grid-light.js +1 -1
- data/app/assets/javascripts/highcharts/themes/sand-signika.js +1 -1
- data/lib/highcharts/version.rb +1 -1
- metadata +13 -12
- checksums.yaml.gz.asc +0 -18
- data.tar.gz.asc +0 -18
- metadata.gz.asc +0 -18
@@ -2,7 +2,7 @@
|
|
2
2
|
// @compilation_level SIMPLE_OPTIMIZATIONS
|
3
3
|
|
4
4
|
/**
|
5
|
-
* @license Highcharts JS v4.0
|
5
|
+
* @license Highcharts JS v4.1.0 (2015-02-16)
|
6
6
|
*
|
7
7
|
* (c) 2009-2013 Torstein Hønsi
|
8
8
|
*
|
@@ -23,52 +23,76 @@ var PI = Math.PI,
|
|
23
23
|
deg2rad = (PI / 180), // degrees to radians
|
24
24
|
sin = Math.sin,
|
25
25
|
cos = Math.cos,
|
26
|
-
|
26
|
+
pick = Highcharts.pick,
|
27
27
|
round = Math.round;
|
28
28
|
|
29
|
-
function perspective(points,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
var result = [],
|
34
|
-
xe,
|
35
|
-
ye,
|
36
|
-
ze;
|
29
|
+
function perspective(points, chart, insidePlotArea) {
|
30
|
+
var options3d = chart.options.chart.options3d,
|
31
|
+
inverted = false,
|
32
|
+
origin;
|
37
33
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
34
|
+
if (insidePlotArea) {
|
35
|
+
inverted = chart.inverted;
|
36
|
+
origin = {
|
37
|
+
x: chart.plotWidth / 2,
|
38
|
+
y: chart.plotHeight / 2,
|
39
|
+
z: options3d.depth / 2,
|
40
|
+
vd: pick(options3d.depth, 1) * pick(options3d.viewDistance, 0)
|
41
|
+
};
|
42
|
+
} else {
|
43
|
+
origin = {
|
44
|
+
x: chart.plotLeft + (chart.plotWidth / 2),
|
45
|
+
y: chart.plotTop + (chart.plotHeight / 2),
|
46
|
+
z: options3d.depth / 2,
|
47
|
+
vd: pick(options3d.depth, 1) * pick(options3d.viewDistance, 0)
|
48
|
+
};
|
49
|
+
}
|
46
50
|
|
47
|
-
var
|
51
|
+
var result = [],
|
52
|
+
xe = origin.x,
|
53
|
+
ye = origin.y,
|
54
|
+
ze = origin.z,
|
55
|
+
vd = origin.vd,
|
56
|
+
angle1 = deg2rad * (inverted ? options3d.beta : -options3d.beta),
|
57
|
+
angle2 = deg2rad * (inverted ? -options3d.alpha : options3d.alpha),
|
58
|
+
s1 = sin(angle1),
|
48
59
|
c1 = cos(angle1),
|
49
60
|
s2 = sin(angle2),
|
50
61
|
c2 = cos(angle2);
|
51
62
|
|
52
|
-
var x, y, z,
|
63
|
+
var x, y, z, px, py, pz;
|
53
64
|
|
54
65
|
Highcharts.each(points, function (point) {
|
55
|
-
x = point.x - xe;
|
56
|
-
y = point.y - ye;
|
57
|
-
z = point.z || 0;
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
66
|
+
x = (inverted ? point.y : point.x) - xe;
|
67
|
+
y = (inverted ? point.x : point.y) - ye;
|
68
|
+
z = (point.z || 0) - ze;
|
69
|
+
|
70
|
+
//Apply 3-D rotation
|
71
|
+
px = c1 * x - s1 * z;
|
72
|
+
py = -s1 * s2 * x - c1 * s2 * z + c2 * y;
|
73
|
+
pz = s1 * c2 * x + c1 * c2 * z + s2 * y;
|
74
|
+
|
75
|
+
//Apply perspective
|
76
|
+
if ((vd > 0) && (vd < Number.POSITIVE_INFINITY)) {
|
77
|
+
px = px * (vd / (pz + ze + vd));
|
78
|
+
py = py * (vd / (pz + ze + vd));
|
79
|
+
}
|
64
80
|
|
65
|
-
|
66
|
-
|
81
|
+
//Apply translation
|
82
|
+
px = px + xe;
|
83
|
+
py = py + ye;
|
84
|
+
pz = pz + ze;
|
67
85
|
|
68
|
-
result.push({
|
86
|
+
result.push({
|
87
|
+
x: (inverted ? py : px),
|
88
|
+
y: (inverted ? px : py),
|
89
|
+
z: pz
|
90
|
+
});
|
69
91
|
});
|
70
92
|
return result;
|
71
93
|
}
|
94
|
+
// Make function acessible to plugins
|
95
|
+
Highcharts.perspective = perspective;
|
72
96
|
/***
|
73
97
|
EXTENSION TO THE SVG-RENDERER TO ENABLE 3D SHAPES
|
74
98
|
***/
|
@@ -79,6 +103,26 @@ function defined(obj) {
|
|
79
103
|
return obj !== undefined && obj !== null;
|
80
104
|
}
|
81
105
|
|
106
|
+
//Shoelace algorithm -- http://en.wikipedia.org/wiki/Shoelace_formula
|
107
|
+
function shapeArea(vertexes) {
|
108
|
+
var area = 0,
|
109
|
+
i,
|
110
|
+
j;
|
111
|
+
for (i = 0; i < vertexes.length; i++) {
|
112
|
+
j = (i + 1) % vertexes.length;
|
113
|
+
area += vertexes[i].x * vertexes[j].y - vertexes[j].x * vertexes[i].y;
|
114
|
+
}
|
115
|
+
return area / 2;
|
116
|
+
}
|
117
|
+
|
118
|
+
function averageZ(vertexes) {
|
119
|
+
var z = 0,
|
120
|
+
i;
|
121
|
+
for (i = 0; i < vertexes.length; i++) {
|
122
|
+
z += vertexes[i].z;
|
123
|
+
}
|
124
|
+
return vertexes.length ? z / vertexes.length : 0;
|
125
|
+
}
|
82
126
|
|
83
127
|
function curveTo(cx, cy, rx, ry, start, end, dx, dy) {
|
84
128
|
var result = [];
|
@@ -113,12 +157,14 @@ Highcharts.SVGRenderer.prototype.toLinePath = function (points, closed) {
|
|
113
157
|
result.push('L', point.x, point.y);
|
114
158
|
});
|
115
159
|
|
116
|
-
|
117
|
-
|
160
|
+
if (points.length) {
|
161
|
+
// Set the first element to M
|
162
|
+
result[0] = 'M';
|
118
163
|
|
119
|
-
|
120
|
-
|
121
|
-
|
164
|
+
// If it is a closed line, add Z
|
165
|
+
if (closed) {
|
166
|
+
result.push('Z');
|
167
|
+
}
|
122
168
|
}
|
123
169
|
|
124
170
|
return result;
|
@@ -205,10 +251,9 @@ Highcharts.SVGRenderer.prototype.cuboidPath = function (shapeArgs) {
|
|
205
251
|
z = shapeArgs.z,
|
206
252
|
h = shapeArgs.height,
|
207
253
|
w = shapeArgs.width,
|
208
|
-
d = shapeArgs.depth,
|
209
|
-
|
210
|
-
|
211
|
-
origin = shapeArgs.origin;
|
254
|
+
d = shapeArgs.depth,
|
255
|
+
chart = Highcharts.charts[this.chartIndex],
|
256
|
+
map = Highcharts.map;
|
212
257
|
|
213
258
|
var pArr = [
|
214
259
|
{x: x, y: y, z: z},
|
@@ -221,71 +266,36 @@ Highcharts.SVGRenderer.prototype.cuboidPath = function (shapeArgs) {
|
|
221
266
|
{x: x, y: y, z: z + d}
|
222
267
|
];
|
223
268
|
|
224
|
-
pArr = perspective(pArr,
|
269
|
+
pArr = perspective(pArr, chart, shapeArgs.insidePlotArea);
|
225
270
|
|
226
|
-
var path1,
|
227
|
-
|
228
|
-
|
271
|
+
var pickShape = function (path1, path2) {
|
272
|
+
path1 = map(path1, function (i) { return pArr[i]; });
|
273
|
+
path2 = map(path2, function (i) { return pArr[i]; });
|
274
|
+
if (shapeArea(path1) < 0) {
|
275
|
+
return path1;
|
276
|
+
} else if (shapeArea(path2) < 0) {
|
277
|
+
return path2;
|
278
|
+
} else {
|
279
|
+
return [];
|
280
|
+
}
|
281
|
+
};
|
229
282
|
|
230
|
-
// front
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
'L', pArr[2].x, pArr[2].y,
|
235
|
-
'L', pArr[3].x, pArr[3].y,
|
236
|
-
'Z'
|
237
|
-
];
|
238
|
-
var z1 = (pArr[0].z + pArr[1].z + pArr[2].z + pArr[3].z) / 4;
|
283
|
+
// front or back
|
284
|
+
var front = [3, 2, 1, 0];
|
285
|
+
var back = [7, 6, 5, 4];
|
286
|
+
var path1 = pickShape(front, back);
|
239
287
|
|
240
288
|
// top or bottom
|
241
|
-
var top = [
|
242
|
-
|
243
|
-
|
244
|
-
'L', pArr[6].x, pArr[6].y,
|
245
|
-
'L', pArr[1].x, pArr[1].y,
|
246
|
-
'Z'
|
247
|
-
];
|
248
|
-
var bottom = [
|
249
|
-
'M', pArr[3].x, pArr[3].y,
|
250
|
-
'L', pArr[2].x, pArr[2].y,
|
251
|
-
'L', pArr[5].x, pArr[5].y,
|
252
|
-
'L', pArr[4].x, pArr[4].y,
|
253
|
-
'Z'
|
254
|
-
];
|
255
|
-
if (pArr[7].y < pArr[1].y) {
|
256
|
-
path2 = top;
|
257
|
-
} else if (pArr[4].y > pArr[2].y) {
|
258
|
-
path2 = bottom;
|
259
|
-
} else {
|
260
|
-
path2 = [];
|
261
|
-
}
|
262
|
-
var z2 = (beta > 0 ? (pArr[0].z + pArr[7].z + pArr[6].z + pArr[1].z) / 4 : (pArr[3].z + pArr[2].z + pArr[5].z + pArr[4].z) / 4);
|
289
|
+
var top = [1, 6, 7, 0];
|
290
|
+
var bottom = [4, 5, 2, 3];
|
291
|
+
var path2 = pickShape(top, bottom);
|
263
292
|
|
264
293
|
// side
|
265
|
-
var right = [
|
266
|
-
|
267
|
-
|
268
|
-
'L', pArr[5].x, pArr[5].y,
|
269
|
-
'L', pArr[6].x, pArr[6].y,
|
270
|
-
'Z'
|
271
|
-
];
|
272
|
-
var left = [
|
273
|
-
'M', pArr[0].x, pArr[0].y,
|
274
|
-
'L', pArr[7].x, pArr[7].y,
|
275
|
-
'L', pArr[4].x, pArr[4].y,
|
276
|
-
'L', pArr[3].x, pArr[3].y,
|
277
|
-
'Z'
|
278
|
-
];
|
279
|
-
if (pArr[6].x > pArr[1].x) {
|
280
|
-
path3 = right;
|
281
|
-
} else if (pArr[7].x < pArr[0].x) {
|
282
|
-
path3 = left;
|
283
|
-
} else {
|
284
|
-
path3 = [];
|
285
|
-
}
|
286
|
-
var z3 = (alpha > 0 ? (pArr[1].z + pArr[2].z + pArr[5].z + pArr[6].z) / 4 : (pArr[0].z + pArr[7].z + pArr[4].z + pArr[3].z) / 4);
|
294
|
+
var right = [1, 2, 5, 6];
|
295
|
+
var left = [0, 7, 4, 3];
|
296
|
+
var path3 = pickShape(right, left);
|
287
297
|
|
288
|
-
return [path1, path2, path3,
|
298
|
+
return [this.toLinePath(path1, true), this.toLinePath(path2, true), this.toLinePath(path3, true), averageZ(path1), averageZ(path2), averageZ(path3)];
|
289
299
|
};
|
290
300
|
|
291
301
|
////// SECTORS //////
|
@@ -302,8 +312,8 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
|
|
302
312
|
result.shapeArgs = shapeArgs; // Store for later use
|
303
313
|
|
304
314
|
result.top = renderer.path(paths.top).attr({zIndex: paths.zTop}).add(result);
|
305
|
-
result.side1 = renderer.path(paths.side2).attr({zIndex: paths.
|
306
|
-
result.side2 = renderer.path(paths.side1).attr({zIndex: paths.
|
315
|
+
result.side1 = renderer.path(paths.side2).attr({zIndex: paths.zSide1});
|
316
|
+
result.side2 = renderer.path(paths.side1).attr({zIndex: paths.zSide2});
|
307
317
|
result.inn = renderer.path(paths.inn).attr({zIndex: paths.zInn});
|
308
318
|
result.out = renderer.path(paths.out).attr({zIndex: paths.zOut});
|
309
319
|
|
@@ -569,6 +579,17 @@ Highcharts.wrap(Highcharts.Chart.prototype, 'redraw', function (proceed) {
|
|
569
579
|
proceed.apply(this, [].slice.call(arguments, 1));
|
570
580
|
});
|
571
581
|
|
582
|
+
// Draw the series in the reverse order (#3803)
|
583
|
+
Highcharts.Chart.prototype.renderSeries = function () {
|
584
|
+
var serie,
|
585
|
+
i = this.series.length;
|
586
|
+
while (i--) {
|
587
|
+
serie = this.series[i];
|
588
|
+
serie.translate();
|
589
|
+
serie.render();
|
590
|
+
}
|
591
|
+
};
|
592
|
+
|
572
593
|
Highcharts.Chart.prototype.retrieveStacks = function (grouping, stacking) {
|
573
594
|
|
574
595
|
var stacks = {},
|
@@ -588,7 +609,7 @@ Highcharts.Chart.prototype.retrieveStacks = function (grouping, stacking) {
|
|
588
609
|
return stacks;
|
589
610
|
};
|
590
611
|
|
591
|
-
/***
|
612
|
+
/***
|
592
613
|
EXTENSION TO THE AXIS
|
593
614
|
***/
|
594
615
|
Highcharts.wrap(Highcharts.Axis.prototype, 'init', function (proceed) {
|
@@ -611,8 +632,6 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
|
611
632
|
var chart = this.chart,
|
612
633
|
renderer = chart.renderer,
|
613
634
|
options3d = chart.options.chart.options3d,
|
614
|
-
alpha = options3d.alpha,
|
615
|
-
beta = options3d.beta * (chart.yAxis[0].opposite ? -1 : 1),
|
616
635
|
frame = options3d.frame,
|
617
636
|
fbottom = frame.bottom,
|
618
637
|
fback = frame.back,
|
@@ -623,12 +642,6 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
|
623
642
|
left = this.left,
|
624
643
|
top = this.top;
|
625
644
|
|
626
|
-
var origin = {
|
627
|
-
x: chart.plotLeft + (chart.plotWidth / 2),
|
628
|
-
y: chart.plotTop + (chart.plotHeight / 2),
|
629
|
-
z: depth,
|
630
|
-
vd: options3d.viewDistance
|
631
|
-
};
|
632
645
|
if (this.horiz) {
|
633
646
|
/// BOTTOM
|
634
647
|
if (this.axisLine) {
|
@@ -641,12 +654,10 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
|
641
654
|
width: width,
|
642
655
|
height: fbottom.size,
|
643
656
|
depth: depth,
|
644
|
-
|
645
|
-
beta: beta,
|
646
|
-
origin: origin
|
657
|
+
insidePlotArea: false
|
647
658
|
};
|
648
659
|
if (!this.bottomFrame) {
|
649
|
-
this.bottomFrame = renderer.cuboid(bottomShape).attr({fill: fbottom.color, zIndex: (chart.yAxis[0].reversed && alpha > 0 ? 4 : -1)}).css({stroke: fbottom.color}).add();
|
660
|
+
this.bottomFrame = renderer.cuboid(bottomShape).attr({fill: fbottom.color, zIndex: (chart.yAxis[0].reversed && options3d.alpha > 0 ? 4 : -1)}).css({stroke: fbottom.color}).add();
|
650
661
|
} else {
|
651
662
|
this.bottomFrame.animate(bottomShape);
|
652
663
|
}
|
@@ -659,9 +670,7 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
|
659
670
|
width: width,
|
660
671
|
height: height + fbottom.size,
|
661
672
|
depth: fback.size,
|
662
|
-
|
663
|
-
beta: beta,
|
664
|
-
origin: origin
|
673
|
+
insidePlotArea: false
|
665
674
|
};
|
666
675
|
if (!this.backFrame) {
|
667
676
|
this.backFrame = renderer.cuboid(backShape).attr({fill: fback.color, zIndex: -3}).css({stroke: fback.color}).add();
|
@@ -679,9 +688,7 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
|
679
688
|
width: fside.size,
|
680
689
|
height: height + fbottom.size,
|
681
690
|
depth: depth + fback.size,
|
682
|
-
|
683
|
-
beta: beta,
|
684
|
-
origin: origin
|
691
|
+
insidePlotArea: false
|
685
692
|
};
|
686
693
|
if (!this.sideFrame) {
|
687
694
|
this.sideFrame = renderer.cuboid(sideShape).attr({fill: fside.color, zIndex: -2}).css({stroke: fside.color}).add();
|
@@ -693,7 +700,7 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
|
693
700
|
|
694
701
|
Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function (proceed) {
|
695
702
|
var path = proceed.apply(this, [].slice.call(arguments, 1));
|
696
|
-
|
703
|
+
|
697
704
|
// Do not do this if the chart is not 3D
|
698
705
|
if (!this.chart.is3d()) {
|
699
706
|
return path;
|
@@ -706,13 +713,6 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function (proceed)
|
|
706
713
|
|
707
714
|
var d = options3d.depth;
|
708
715
|
|
709
|
-
options3d.origin = {
|
710
|
-
x: chart.plotLeft + (chart.plotWidth / 2),
|
711
|
-
y: chart.plotTop + (chart.plotHeight / 2),
|
712
|
-
z: d,
|
713
|
-
vd: options3d.viewDistance
|
714
|
-
};
|
715
|
-
|
716
716
|
var pArr = [
|
717
717
|
{ x: path[1], y: path[2], z : (this.horiz || this.opposite ? d : 0)},
|
718
718
|
{ x: path[1], y: path[2], z : d },
|
@@ -720,12 +720,7 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function (proceed)
|
|
720
720
|
{ x: path[4], y: path[5], z : (this.horiz || this.opposite ? 0 : d)}
|
721
721
|
];
|
722
722
|
|
723
|
-
|
724
|
-
beta = chart.options.inverted ? options3d.alpha : options3d.beta;
|
725
|
-
|
726
|
-
beta *= (chart.yAxis[0].opposite ? -1 : 1);
|
727
|
-
|
728
|
-
pArr = perspective(pArr, alpha, beta, options3d.origin);
|
723
|
+
pArr = perspective(pArr, this.chart, false);
|
729
724
|
path = this.chart.renderer.toLinePath(pArr, false);
|
730
725
|
|
731
726
|
return path;
|
@@ -772,27 +767,12 @@ Highcharts.wrap(Highcharts.Tick.prototype, 'getMarkPath', function (proceed) {
|
|
772
767
|
return path;
|
773
768
|
}
|
774
769
|
|
775
|
-
var chart = this.axis.chart,
|
776
|
-
options3d = chart.options.chart.options3d;
|
777
|
-
|
778
|
-
var origin = {
|
779
|
-
x: chart.plotLeft + (chart.plotWidth / 2),
|
780
|
-
y: chart.plotTop + (chart.plotHeight / 2),
|
781
|
-
z: options3d.depth,
|
782
|
-
vd: options3d.viewDistance
|
783
|
-
};
|
784
|
-
|
785
770
|
var pArr = [
|
786
771
|
{x: path[1], y: path[2], z: 0},
|
787
772
|
{x: path[4], y: path[5], z: 0}
|
788
773
|
];
|
789
|
-
|
790
|
-
var alpha = chart.inverted ? options3d.beta : options3d.alpha,
|
791
|
-
beta = chart.inverted ? options3d.alpha : options3d.beta;
|
792
|
-
|
793
|
-
beta *= (chart.yAxis[0].opposite ? -1 : 1);
|
794
774
|
|
795
|
-
pArr = perspective(pArr,
|
775
|
+
pArr = perspective(pArr, this.axis.chart, false);
|
796
776
|
path = [
|
797
777
|
'M', pArr[0].x, pArr[0].y,
|
798
778
|
'L', pArr[1].x, pArr[1].y
|
@@ -808,22 +788,9 @@ Highcharts.wrap(Highcharts.Tick.prototype, 'getLabelPosition', function (proceed
|
|
808
788
|
return pos;
|
809
789
|
}
|
810
790
|
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
var origin = {
|
815
|
-
x: chart.plotLeft + (chart.plotWidth / 2),
|
816
|
-
y: chart.plotTop + (chart.plotHeight / 2),
|
817
|
-
z: options3d.depth,
|
818
|
-
vd: options3d.viewDistance
|
819
|
-
};
|
820
|
-
|
821
|
-
var alpha = chart.inverted ? options3d.beta : options3d.alpha,
|
822
|
-
beta = chart.inverted ? options3d.alpha : options3d.beta;
|
823
|
-
|
824
|
-
beta *= (chart.yAxis[0].opposite ? -1 : 1);
|
791
|
+
pos = perspective([{x: pos.x, y: pos.y, z: 0}], this.axis.chart, false)[0];
|
792
|
+
pos.x = pos.x - (!this.axis.horiz && this.axis.opposite ? this.axis.transA : 0); //#3788
|
825
793
|
|
826
|
-
pos = perspective([{x: pos.x, y: pos.y, z: 0}], alpha, beta, origin)[0];
|
827
794
|
return pos;
|
828
795
|
});
|
829
796
|
|
@@ -838,7 +805,8 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'drawCrosshair', function (proceed) {
|
|
838
805
|
}
|
839
806
|
}
|
840
807
|
proceed.apply(this, [].slice.call(args, 1));
|
841
|
-
})
|
808
|
+
});
|
809
|
+
/***
|
842
810
|
EXTENSION FOR 3D COLUMNS
|
843
811
|
***/
|
844
812
|
Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'translate', function (proceed) {
|
@@ -851,21 +819,10 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'translate', function (
|
|
851
819
|
|
852
820
|
var series = this,
|
853
821
|
chart = series.chart,
|
854
|
-
|
855
|
-
|
856
|
-
options3d = options.chart.options3d,
|
857
|
-
|
858
|
-
depth = seriesOptions.depth || 25,
|
859
|
-
origin = {
|
860
|
-
x: chart.plotWidth / 2,
|
861
|
-
y: chart.plotHeight / 2,
|
862
|
-
z: options3d.depth,
|
863
|
-
vd: options3d.viewDistance
|
864
|
-
},
|
865
|
-
alpha = options3d.alpha,
|
866
|
-
beta = options3d.beta * (chart.yAxis[0].opposite ? -1 : 1);
|
822
|
+
seriesOptions = series.options,
|
823
|
+
depth = seriesOptions.depth || 25;
|
867
824
|
|
868
|
-
var stack = seriesOptions.stacking ? (seriesOptions.stack || 0) : series._i;
|
825
|
+
var stack = seriesOptions.stacking ? (seriesOptions.stack || 0) : series._i;
|
869
826
|
var z = stack * (depth + (seriesOptions.groupZPadding || 1));
|
870
827
|
|
871
828
|
if (seriesOptions.grouping !== false) { z = 0; }
|
@@ -878,14 +835,12 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'translate', function (
|
|
878
835
|
tooltipPos = point.tooltipPos;
|
879
836
|
|
880
837
|
point.shapeType = 'cuboid';
|
881
|
-
shapeArgs.alpha = alpha;
|
882
|
-
shapeArgs.beta = beta;
|
883
838
|
shapeArgs.z = z;
|
884
|
-
shapeArgs.origin = origin;
|
885
839
|
shapeArgs.depth = depth;
|
840
|
+
shapeArgs.insidePlotArea = true;
|
886
841
|
|
887
842
|
// Translate the tooltip position in 3d space
|
888
|
-
tooltipPos = perspective([{ x: tooltipPos[0], y: tooltipPos[1], z: z }],
|
843
|
+
tooltipPos = perspective([{ x: tooltipPos[0], y: tooltipPos[1], z: z }], chart, false)[0];
|
889
844
|
point.tooltipPos = [tooltipPos.x, tooltipPos.y];
|
890
845
|
}
|
891
846
|
});
|
@@ -999,23 +954,13 @@ Highcharts.wrap(Highcharts.Series.prototype, 'alignDataLabel', function (proceed
|
|
999
954
|
// Only do this for 3D columns and columnranges
|
1000
955
|
if (this.chart.is3d() && (this.type === 'column' || this.type === 'columnrange')) {
|
1001
956
|
var series = this,
|
1002
|
-
chart = series.chart
|
1003
|
-
options = chart.options,
|
1004
|
-
options3d = options.chart.options3d,
|
1005
|
-
origin = {
|
1006
|
-
x: chart.plotWidth / 2,
|
1007
|
-
y: chart.plotHeight / 2,
|
1008
|
-
z: options3d.depth,
|
1009
|
-
vd: options3d.viewDistance
|
1010
|
-
},
|
1011
|
-
alpha = options3d.alpha,
|
1012
|
-
beta = options3d.beta * (chart.yAxis[0].opposite ? -1 : 1);
|
957
|
+
chart = series.chart;
|
1013
958
|
|
1014
959
|
var args = arguments,
|
1015
960
|
alignTo = args[4];
|
1016
961
|
|
1017
962
|
var pos = ({x: alignTo.x, y: alignTo.y, z: 0});
|
1018
|
-
pos = perspective([pos],
|
963
|
+
pos = perspective([pos], chart, true)[0];
|
1019
964
|
alignTo.x = pos.x;
|
1020
965
|
alignTo.y = pos.y;
|
1021
966
|
}
|
@@ -1187,13 +1132,14 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'drawDataLabels', function
|
|
1187
1132
|
var shapeArgs = point.shapeArgs,
|
1188
1133
|
r = shapeArgs.r,
|
1189
1134
|
d = shapeArgs.depth,
|
1190
|
-
a1 = shapeArgs.alpha * deg2rad,
|
1135
|
+
a1 = (shapeArgs.alpha || series.chart.options.chart.options3d.alpha) * deg2rad, //#3240 issue with datalabels for 0 and null values
|
1191
1136
|
a2 = (shapeArgs.start + shapeArgs.end) / 2,
|
1192
1137
|
labelPos = point.labelPos;
|
1193
1138
|
|
1194
1139
|
labelPos[1] += (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0);
|
1195
1140
|
labelPos[3] += (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0);
|
1196
1141
|
labelPos[5] += (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0);
|
1142
|
+
|
1197
1143
|
});
|
1198
1144
|
}
|
1199
1145
|
|
@@ -1277,36 +1223,38 @@ Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'translate', function
|
|
1277
1223
|
|
1278
1224
|
var series = this,
|
1279
1225
|
chart = series.chart,
|
1280
|
-
|
1281
|
-
alpha = options3d.alpha,
|
1282
|
-
beta = options3d.beta,
|
1283
|
-
origin = {
|
1284
|
-
x: chart.inverted ? chart.plotHeight / 2 : chart.plotWidth / 2,
|
1285
|
-
y: chart.inverted ? chart.plotWidth / 2 : chart.plotHeight / 2,
|
1286
|
-
z: options3d.depth,
|
1287
|
-
vd: options3d.viewDistance
|
1288
|
-
},
|
1289
|
-
depth = options3d.depth,
|
1226
|
+
depth = chart.options.chart.options3d.depth,
|
1290
1227
|
zAxis = chart.options.zAxis || { min : 0, max: depth };
|
1291
|
-
|
1292
|
-
var rangeModifier = depth / (zAxis.max - zAxis.min);
|
1293
|
-
|
1294
|
-
Highcharts.each(series.data, function (point) {
|
1295
|
-
var pCo = {
|
1296
|
-
x: point.plotX,
|
1297
|
-
y: point.plotY,
|
1298
|
-
z: (point.z - zAxis.min) * rangeModifier
|
1299
|
-
};
|
1300
1228
|
|
1301
|
-
|
1229
|
+
var rangeModifier = depth / (zAxis.max - zAxis.min),
|
1230
|
+
raw_points = [],
|
1231
|
+
raw_point,
|
1232
|
+
projected_points,
|
1233
|
+
projected_point,
|
1234
|
+
i;
|
1235
|
+
|
1236
|
+
for (i = 0; i < series.data.length; i++) {
|
1237
|
+
raw_point = series.data[i];
|
1238
|
+
raw_points.push({
|
1239
|
+
x: raw_point.plotX,
|
1240
|
+
y: raw_point.plotY,
|
1241
|
+
z: (raw_point.z - zAxis.min) * rangeModifier
|
1242
|
+
});
|
1243
|
+
}
|
1302
1244
|
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1245
|
+
projected_points = perspective(raw_points, chart, true);
|
1246
|
+
|
1247
|
+
for (i = 0; i < series.data.length; i++) {
|
1248
|
+
raw_point = series.data[i];
|
1249
|
+
projected_point = projected_points[i];
|
1250
|
+
|
1251
|
+
raw_point.plotXold = raw_point.plotX;
|
1252
|
+
raw_point.plotYold = raw_point.plotY;
|
1253
|
+
|
1254
|
+
raw_point.plotX = projected_point.x;
|
1255
|
+
raw_point.plotY = projected_point.y;
|
1256
|
+
raw_point.plotZ = projected_point.z;
|
1257
|
+
}
|
1310
1258
|
});
|
1311
1259
|
|
1312
1260
|
Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'init', function (proceed) {
|
@@ -1325,7 +1273,8 @@ Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'init', function (proc
|
|
1325
1273
|
}
|
1326
1274
|
}
|
1327
1275
|
return result;
|
1328
|
-
})
|
1276
|
+
});
|
1277
|
+
/**
|
1329
1278
|
* Extension to the VML Renderer
|
1330
1279
|
*/
|
1331
1280
|
if (Highcharts.VMLRenderer) {
|
@@ -1347,20 +1296,6 @@ Highcharts.VMLRenderer.prototype.arc3d = function (shapeArgs) {
|
|
1347
1296
|
|
1348
1297
|
Highcharts.VMLRenderer.prototype.arc3dPath = Highcharts.SVGRenderer.prototype.arc3dPath;
|
1349
1298
|
|
1350
|
-
// Draw the series in the reverse order
|
1351
|
-
Highcharts.Chart.prototype.renderSeries = function () {
|
1352
|
-
var serie,
|
1353
|
-
i = this.series.length;
|
1354
|
-
while (i--) {
|
1355
|
-
serie = this.series[i];
|
1356
|
-
serie.translate();
|
1357
|
-
if (serie.setTooltipPoints) {
|
1358
|
-
serie.setTooltipPoints();
|
1359
|
-
}
|
1360
|
-
serie.render();
|
1361
|
-
}
|
1362
|
-
};
|
1363
|
-
|
1364
1299
|
Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
|
1365
1300
|
proceed.apply(this, [].slice.call(arguments, 1));
|
1366
1301
|
// VML doesn't support a negative z-index
|