highcharts-rails 4.1.5 → 4.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v4.1.5 (2015-04-13)
2
+ * @license Highcharts JS v4.1.6 (2015-06-12)
3
3
  *
4
4
  * Standalone Highcharts Framework
5
5
  *
@@ -2,7 +2,7 @@
2
2
  // @compilation_level SIMPLE_OPTIMIZATIONS
3
3
 
4
4
  /**
5
- * @license Highcharts JS v4.1.5 (2015-04-13)
5
+ * @license Highcharts JS v4.1.6 (2015-06-12)
6
6
  *
7
7
  * (c) 2009-2013 Torstein Hønsi
8
8
  *
@@ -26,6 +26,15 @@ var PI = Math.PI,
26
26
  pick = Highcharts.pick,
27
27
  round = Math.round;
28
28
 
29
+ /**
30
+ * Transforms a given array of points according to the angles in chart.options.
31
+ * Parameters:
32
+ * - points: the array of points
33
+ * - chart: the chart
34
+ * - insidePlotArea: wether to verifiy the points are inside the plotArea
35
+ * Returns:
36
+ * - an array of transformed points
37
+ */
29
38
  function perspective(points, chart, insidePlotArea) {
30
39
  var options3d = chart.options.chart.options3d,
31
40
  inverted = false,
@@ -62,6 +71,7 @@ function perspective(points, chart, insidePlotArea) {
62
71
 
63
72
  var x, y, z, px, py, pz;
64
73
 
74
+ // Transform each point
65
75
  Highcharts.each(points, function (point) {
66
76
  x = (inverted ? point.y : point.x) - xe;
67
77
  y = (inverted ? point.x : point.y) - ye;
@@ -124,6 +134,9 @@ function averageZ(vertexes) {
124
134
  return vertexes.length ? z / vertexes.length : 0;
125
135
  }
126
136
 
137
+ /** Method to construct a curved path
138
+ * Can 'wrap' around more then 180 degrees
139
+ */
127
140
  function curveTo(cx, cy, rx, ry, start, end, dx, dy) {
128
141
  var result = [];
129
142
  if ((end > start) && (end - start > PI / 2 + 0.0001)) {
@@ -176,10 +189,12 @@ Highcharts.SVGRenderer.prototype.cuboid = function (shapeArgs) {
176
189
  var result = this.g(),
177
190
  paths = this.cuboidPath(shapeArgs);
178
191
 
192
+ // create the 3 sides
179
193
  result.front = this.path(paths[0]).attr({zIndex: paths[3], 'stroke-linejoin': 'round'}).add(result);
180
194
  result.top = this.path(paths[1]).attr({zIndex: paths[4], 'stroke-linejoin': 'round'}).add(result);
181
195
  result.side = this.path(paths[2]).attr({zIndex: paths[5], 'stroke-linejoin': 'round'}).add(result);
182
196
 
197
+ // apply the fill everywhere, the top a bit brighter, the side a bit darker
183
198
  result.fillSetter = function (color) {
184
199
  var c0 = color,
185
200
  c1 = Highcharts.Color(color).brighten(0.1).get(),
@@ -193,6 +208,7 @@ Highcharts.SVGRenderer.prototype.cuboid = function (shapeArgs) {
193
208
  return this;
194
209
  };
195
210
 
211
+ // apply opacaity everywhere
196
212
  result.opacitySetter = function (opacity) {
197
213
  this.front.attr({opacity: opacity});
198
214
  this.top.attr({opacity: opacity});
@@ -230,6 +246,7 @@ Highcharts.SVGRenderer.prototype.cuboid = function (shapeArgs) {
230
246
  return this;
231
247
  };
232
248
 
249
+ // destroy all children
233
250
  result.destroy = function () {
234
251
  this.front.destroy();
235
252
  this.top.destroy();
@@ -244,7 +261,9 @@ Highcharts.SVGRenderer.prototype.cuboid = function (shapeArgs) {
244
261
  return result;
245
262
  };
246
263
 
247
-
264
+ /**
265
+ * Generates a cuboid
266
+ */
248
267
  Highcharts.SVGRenderer.prototype.cuboidPath = function (shapeArgs) {
249
268
  var x = shapeArgs.x,
250
269
  y = shapeArgs.y,
@@ -255,6 +274,7 @@ Highcharts.SVGRenderer.prototype.cuboidPath = function (shapeArgs) {
255
274
  chart = Highcharts.charts[this.chartIndex],
256
275
  map = Highcharts.map;
257
276
 
277
+ // The 8 corners of the cube
258
278
  var pArr = [
259
279
  {x: x, y: y, z: z},
260
280
  {x: x + w, y: y, z: z},
@@ -266,8 +286,10 @@ Highcharts.SVGRenderer.prototype.cuboidPath = function (shapeArgs) {
266
286
  {x: x, y: y, z: z + d}
267
287
  ];
268
288
 
289
+ // apply perspective
269
290
  pArr = perspective(pArr, chart, shapeArgs.insidePlotArea);
270
291
 
292
+ // helper method to decide which side is visible
271
293
  var pickShape = function (path1, path2) {
272
294
  path1 = map(path1, function (i) { return pArr[i]; });
273
295
  path2 = map(path2, function (i) { return pArr[i]; });
@@ -311,12 +333,14 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
311
333
 
312
334
  result.shapeArgs = shapeArgs; // Store for later use
313
335
 
314
- result.top = renderer.path(paths.top).attr({zIndex: paths.zTop}).add(result);
336
+ // create the different sub sections of the shape
337
+ result.top = renderer.path(paths.top).setRadialReference(shapeArgs.center).attr({zIndex: paths.zTop}).add(result);
315
338
  result.side1 = renderer.path(paths.side2).attr({zIndex: paths.zSide1});
316
339
  result.side2 = renderer.path(paths.side1).attr({zIndex: paths.zSide2});
317
340
  result.inn = renderer.path(paths.inn).attr({zIndex: paths.zInn});
318
341
  result.out = renderer.path(paths.out).attr({zIndex: paths.zOut});
319
342
 
343
+ // apply the fill to the top and a darker shade to the sides
320
344
  result.fillSetter = function (color) {
321
345
  this.color = color;
322
346
 
@@ -331,6 +355,7 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
331
355
  return this;
332
356
  };
333
357
 
358
+ // apply the translation to all
334
359
  result.translateXSetter = function (value) {
335
360
  this.out.attr({translateX: value});
336
361
  this.inn.attr({translateX: value});
@@ -389,6 +414,7 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
389
414
  return this;
390
415
  };
391
416
 
417
+ // destroy all children
392
418
  result.destroy = function () {
393
419
  this.top.destroy();
394
420
  this.out.destroy();
@@ -398,6 +424,7 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
398
424
 
399
425
  Highcharts.SVGElement.prototype.destroy.call(this);
400
426
  };
427
+ // hide all children
401
428
  result.hide = function () {
402
429
  this.top.hide();
403
430
  this.out.hide();
@@ -411,36 +438,38 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
411
438
  this.inn.show();
412
439
  this.side1.show();
413
440
  this.side2.show();
414
- };
415
-
441
+ };
442
+ // show all children
416
443
  result.zIndex = zIndex;
417
444
  result.attr({zIndex: zIndex});
418
445
  return result;
419
446
  };
420
447
 
421
-
448
+ /**
449
+ * Generate the paths required to draw a 3D arc
450
+ */
422
451
  Highcharts.SVGRenderer.prototype.arc3dPath = function (shapeArgs) {
423
- var cx = shapeArgs.x,
424
- cy = shapeArgs.y,
425
- start = shapeArgs.start,
426
- end = shapeArgs.end - 0.00001,
427
- r = shapeArgs.r,
428
- ir = shapeArgs.innerR,
429
- d = shapeArgs.depth,
430
- alpha = shapeArgs.alpha,
431
- beta = shapeArgs.beta;
432
-
433
- // Some Variables
434
- var cs = cos(start),
435
- ss = sin(start),
436
- ce = cos(end),
437
- se = sin(end),
438
- rx = r * cos(beta),
439
- ry = r * cos(alpha),
440
- irx = ir * cos(beta),
441
- iry = ir * cos(alpha),
442
- dx = d * sin(beta),
443
- dy = d * sin(alpha);
452
+ var cx = shapeArgs.x, // x coordinate of the center
453
+ cy = shapeArgs.y, // y coordinate of the center
454
+ start = shapeArgs.start, // start angle
455
+ end = shapeArgs.end - 0.00001, // end angle
456
+ r = shapeArgs.r, // radius
457
+ ir = shapeArgs.innerR, // inner radius
458
+ d = shapeArgs.depth, // depth
459
+ alpha = shapeArgs.alpha, // alpha rotation of the chart
460
+ beta = shapeArgs.beta; // beta rotation of the chart
461
+
462
+ // Derived Variables
463
+ var cs = cos(start), // cosinus of the start angle
464
+ ss = sin(start), // sinus of the start angle
465
+ ce = cos(end), // cosinus of the end angle
466
+ se = sin(end), // sinus of the end angle
467
+ rx = r * cos(beta), // x-radius
468
+ ry = r * cos(alpha), // y-radius
469
+ irx = ir * cos(beta), // x-radius (inner)
470
+ iry = ir * cos(alpha), // y-radius (inner)
471
+ dx = d * sin(beta), // distance between top and bottom in x
472
+ dy = d * sin(alpha); // distance between top and bottom in y
444
473
 
445
474
  // TOP
446
475
  var top = ['M', cx + (rx * cs), cy + (ry * ss)];
@@ -513,7 +542,7 @@ Highcharts.SVGRenderer.prototype.arc3dPath = function (shapeArgs) {
513
542
  ***/
514
543
  // Shorthand to check the is3d flag
515
544
  Highcharts.Chart.prototype.is3d = function () {
516
- return this.options.chart.options3d && this.options.chart.options3d.enabled;
545
+ return !this.inverted && this.options.chart.options3d && this.options.chart.options3d.enabled; // #4160 3D should not work with inverted charts
517
546
  };
518
547
 
519
548
  Highcharts.wrap(Highcharts.Chart.prototype, 'isInsidePlot', function (proceed) {
@@ -648,14 +677,12 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
648
677
  left = this.left,
649
678
  top = this.top;
650
679
 
651
- if (this.horiz) {
652
- /// BOTTOM
653
- if (this.axisLine) {
654
- this.axisLine.hide();
655
- }
680
+ if (this.isZAxis) {
681
+ return;
682
+ } else if (this.horiz) {
656
683
  var bottomShape = {
657
684
  x: left,
658
- y: top + (chart.yAxis[0].reversed ? -fbottom.size : height),
685
+ y: top + (chart.xAxis[0].opposite ? -fbottom.size : height),
659
686
  z: 0,
660
687
  width: width,
661
688
  height: fbottom.size,
@@ -663,41 +690,53 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'render', function (proceed) {
663
690
  insidePlotArea: false
664
691
  };
665
692
  if (!this.bottomFrame) {
666
- this.bottomFrame = renderer.cuboid(bottomShape).attr({fill: fbottom.color, zIndex: (chart.yAxis[0].reversed && options3d.alpha > 0 ? 4 : -1)}).css({stroke: fbottom.color}).add();
693
+ this.bottomFrame = renderer.cuboid(bottomShape).attr({
694
+ fill: fbottom.color,
695
+ zIndex: (chart.yAxis[0].reversed && options3d.alpha > 0 ? 4 : -1)
696
+ })
697
+ .css({
698
+ stroke: fbottom.color
699
+ }).add();
667
700
  } else {
668
701
  this.bottomFrame.animate(bottomShape);
669
702
  }
670
703
  } else {
671
704
  // BACK
672
705
  var backShape = {
673
- x: left,
674
- y: top,
675
- z: depth + 1,
676
- width: width,
706
+ x: left + (chart.yAxis[0].opposite ? 0 : -fside.size),
707
+ y: top + (chart.xAxis[0].opposite ? -fbottom.size : 0),
708
+ z: depth,
709
+ width: width + fside.size,
677
710
  height: height + fbottom.size,
678
711
  depth: fback.size,
679
712
  insidePlotArea: false
680
713
  };
681
714
  if (!this.backFrame) {
682
- this.backFrame = renderer.cuboid(backShape).attr({fill: fback.color, zIndex: -3}).css({stroke: fback.color}).add();
715
+ this.backFrame = renderer.cuboid(backShape).attr({
716
+ fill: fback.color,
717
+ zIndex: -3
718
+ }).css({
719
+ stroke: fback.color
720
+ }).add();
683
721
  } else {
684
722
  this.backFrame.animate(backShape);
685
723
  }
686
- // SIDE
687
- if (this.axisLine) {
688
- this.axisLine.hide();
689
- }
690
724
  var sideShape = {
691
- x: (chart.yAxis[0].opposite ? width : 0) + left - fside.size,
692
- y: top,
725
+ x: left + (chart.yAxis[0].opposite ? width : -fside.size),
726
+ y: top + (chart.xAxis[0].opposite ? -fbottom.size : 0),
693
727
  z: 0,
694
728
  width: fside.size,
695
729
  height: height + fbottom.size,
696
- depth: depth + fback.size,
730
+ depth: depth,
697
731
  insidePlotArea: false
698
732
  };
699
733
  if (!this.sideFrame) {
700
- this.sideFrame = renderer.cuboid(sideShape).attr({fill: fside.color, zIndex: -2}).css({stroke: fside.color}).add();
734
+ this.sideFrame = renderer.cuboid(sideShape).attr({
735
+ fill: fside.color,
736
+ zIndex: -2
737
+ }).css({
738
+ stroke: fside.color
739
+ }).add();
701
740
  } else {
702
741
  this.sideFrame.animate(sideShape);
703
742
  }
@@ -717,13 +756,16 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function (proceed)
717
756
  var chart = this.chart,
718
757
  options3d = chart.options.chart.options3d;
719
758
 
720
- var d = options3d.depth;
721
-
759
+ var d = this.isZAxis ? this.chart.plotWidth : options3d.depth,
760
+ opposite = this.opposite;
761
+ if (this.horiz) {
762
+ opposite = !opposite;
763
+ }
722
764
  var pArr = [
723
- { x: path[1], y: path[2], z : (this.horiz || this.opposite ? d : 0)},
724
- { x: path[1], y: path[2], z : d },
725
- { x: path[4], y: path[5], z : d },
726
- { x: path[4], y: path[5], z : (this.horiz || this.opposite ? 0 : d)}
765
+ this.swapZ({ x: path[1], y: path[2], z: (opposite ? d : 0)}),
766
+ this.swapZ({ x: path[1], y: path[2], z: d }),
767
+ this.swapZ({ x: path[4], y: path[5], z: d }),
768
+ this.swapZ({ x: path[4], y: path[5], z: (opposite ? 0 : d)})
727
769
  ];
728
770
 
729
771
  pArr = perspective(pArr, this.chart, false);
@@ -732,6 +774,11 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function (proceed)
732
774
  return path;
733
775
  });
734
776
 
777
+ Highcharts.wrap(Highcharts.Axis.prototype, 'getLinePath', function () {
778
+ // do not draw axislines in 3D ?
779
+ return [];
780
+ });
781
+
735
782
  Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotBandPath', function (proceed) {
736
783
  // Do not do this if the chart is not 3D
737
784
  if (!this.chart.is3d()) {
@@ -743,13 +790,19 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotBandPath', function (proceed)
743
790
 
744
791
  var toPath = this.getPlotLinePath(to),
745
792
  path = this.getPlotLinePath(from);
746
-
793
+
747
794
  if (path && toPath) {
748
795
  path.push(
749
- toPath[7], // These two do not exist in the regular getPlotLine
750
- toPath[8], // ---- # 3005
796
+ 'L',
797
+ toPath[10], // These two do not exist in the regular getPlotLine
798
+ toPath[11], // ---- # 3005
799
+ 'L',
800
+ toPath[7],
801
+ toPath[8],
802
+ 'L',
751
803
  toPath[4],
752
804
  toPath[5],
805
+ 'L',
753
806
  toPath[1],
754
807
  toPath[2]
755
808
  );
@@ -774,29 +827,48 @@ Highcharts.wrap(Highcharts.Tick.prototype, 'getMarkPath', function (proceed) {
774
827
  }
775
828
 
776
829
  var pArr = [
777
- {x: path[1], y: path[2], z: 0},
778
- {x: path[4], y: path[5], z: 0}
830
+ this.axis.swapZ({x: path[1], y: path[2], z: 0}),
831
+ this.axis.swapZ({x: path[4], y: path[5], z: 0})
779
832
  ];
780
833
 
781
834
  pArr = perspective(pArr, this.axis.chart, false);
782
835
  path = [
783
836
  'M', pArr[0].x, pArr[0].y,
784
837
  'L', pArr[1].x, pArr[1].y
785
- ];
838
+ ];
786
839
  return path;
787
840
  });
788
841
 
789
842
  Highcharts.wrap(Highcharts.Tick.prototype, 'getLabelPosition', function (proceed) {
790
843
  var pos = proceed.apply(this, [].slice.call(arguments, 1));
791
-
844
+
792
845
  // Do not do this if the chart is not 3D
793
846
  if (!this.axis.chart.is3d()) {
794
847
  return pos;
795
- }
848
+ }
849
+
850
+ var new_pos = perspective([this.axis.swapZ({x: pos.x, y: pos.y, z: 0})], this.axis.chart, false)[0];
851
+ new_pos.x = new_pos.x - (!this.axis.horiz && this.axis.opposite ? this.axis.transA : 0); //#3788
852
+ new_pos.old = pos;
853
+ return new_pos;
854
+ });
855
+
856
+ Highcharts.wrap(Highcharts.Tick.prototype, 'handleOverflow', function (proceed, xy) {
857
+ if (this.axis.chart.is3d()) {
858
+ xy = xy.old;
859
+ }
860
+ return proceed.call(this, xy);
861
+ });
796
862
 
797
- pos = perspective([{x: pos.x, y: pos.y, z: 0}], this.axis.chart, false)[0];
798
- pos.x = pos.x - (!this.axis.horiz && this.axis.opposite ? this.axis.transA : 0); //#3788
863
+ Highcharts.wrap(Highcharts.Axis.prototype, 'getTitlePosition', function (proceed) {
864
+ var pos = proceed.apply(this, [].slice.call(arguments, 1));
799
865
 
866
+ // Do not do this if the chart is not 3D
867
+ if (!this.chart.is3d()) {
868
+ return pos;
869
+ }
870
+
871
+ pos = perspective([this.swapZ({x: pos.x, y: pos.y, z: 0})], this.chart, false)[0];
800
872
  return pos;
801
873
  });
802
874
 
@@ -812,6 +884,105 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'drawCrosshair', function (proceed) {
812
884
  }
813
885
  proceed.apply(this, [].slice.call(args, 1));
814
886
  });
887
+
888
+ /***
889
+ Z-AXIS
890
+ ***/
891
+
892
+ Highcharts.Axis.prototype.swapZ = function (p, insidePlotArea) {
893
+ if (this.isZAxis) {
894
+ var plotLeft = insidePlotArea ? 0 : this.chart.plotLeft;
895
+ var chart = this.chart;
896
+ return {
897
+ x: plotLeft + (chart.yAxis[0].opposite ? p.z : chart.xAxis[0].width - p.z),
898
+ y: p.y,
899
+ z: p.x - plotLeft
900
+ };
901
+ } else {
902
+ return p;
903
+ }
904
+ };
905
+
906
+ var ZAxis = Highcharts.ZAxis = function () {
907
+ this.isZAxis = true;
908
+ this.init.apply(this, arguments);
909
+ };
910
+ Highcharts.extend(ZAxis.prototype, Highcharts.Axis.prototype);
911
+ Highcharts.extend(ZAxis.prototype, {
912
+ setOptions: function (userOptions) {
913
+ userOptions = Highcharts.merge({
914
+ offset: 0,
915
+ lineWidth: 0
916
+ }, userOptions);
917
+ Highcharts.Axis.prototype.setOptions.call(this, userOptions);
918
+ this.coll = 'zAxis';
919
+ },
920
+ setAxisSize: function () {
921
+ Highcharts.Axis.prototype.setAxisSize.call(this);
922
+ this.width = this.len = this.chart.options.chart.options3d.depth;
923
+ this.right = this.chart.chartWidth - this.width - this.left;
924
+ },
925
+ getSeriesExtremes: function () {
926
+ var axis = this,
927
+ chart = axis.chart;
928
+
929
+ axis.hasVisibleSeries = false;
930
+
931
+ // Reset properties in case we're redrawing (#3353)
932
+ axis.dataMin = axis.dataMax = axis.ignoreMinPadding = axis.ignoreMaxPadding = null;
933
+
934
+ if (axis.buildStacks) {
935
+ axis.buildStacks();
936
+ }
937
+
938
+ // loop through this axis' series
939
+ Highcharts.each(axis.series, function (series) {
940
+
941
+ if (series.visible || !chart.options.chart.ignoreHiddenSeries) {
942
+
943
+ var seriesOptions = series.options,
944
+ zData,
945
+ threshold = seriesOptions.threshold;
946
+
947
+ axis.hasVisibleSeries = true;
948
+
949
+ // Validate threshold in logarithmic axes
950
+ if (axis.isLog && threshold <= 0) {
951
+ threshold = null;
952
+ }
953
+
954
+ zData = series.zData;
955
+ if (zData.length) {
956
+ axis.dataMin = Math.min(pick(axis.dataMin, zData[0]), Math.min.apply(null, zData));
957
+ axis.dataMax = Math.max(pick(axis.dataMax, zData[0]), Math.max.apply(null, zData));
958
+ }
959
+ }
960
+ });
961
+ }
962
+ });
963
+
964
+
965
+ /**
966
+ * Extend the chart getAxes method to also get the color axis
967
+ */
968
+ Highcharts.wrap(Highcharts.Chart.prototype, 'getAxes', function (proceed) {
969
+ var chart = this,
970
+ options = this.options,
971
+ zAxisOptions = options.zAxis = Highcharts.splat(options.zAxis || {});
972
+
973
+ proceed.call(this);
974
+
975
+ if (!chart.is3d()) {
976
+ return;
977
+ }
978
+ this.zAxis = [];
979
+ Highcharts.each(zAxisOptions, function (axisOptions, i) {
980
+ axisOptions.index = i;
981
+ axisOptions.isX = true; //Z-Axis is shown horizontally, so it's kind of a X-Axis
982
+ var zAxis = new ZAxis(chart, axisOptions);
983
+ zAxis.setScale();
984
+ });
985
+ });
815
986
  /***
816
987
  EXTENSION FOR 3D COLUMNS
817
988
  ***/
@@ -987,6 +1158,7 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'drawPoints', draw3DPoi
987
1158
  EXTENSION FOR 3D CYLINDRICAL COLUMNS
988
1159
  Not supported
989
1160
  ***/
1161
+ /*
990
1162
  var defaultOptions = Highcharts.getOptions();
991
1163
  defaultOptions.plotOptions.cylinder = Highcharts.merge(defaultOptions.plotOptions.column);
992
1164
  var CylinderSeries = Highcharts.extendClass(Highcharts.seriesTypes.column, {
@@ -1036,7 +1208,7 @@ Highcharts.wrap(Highcharts.seriesTypes.cylinder.prototype, 'translate', function
1036
1208
  shapeArgs.origin = origin;
1037
1209
  });
1038
1210
  });
1039
- /***
1211
+ *//***
1040
1212
  EXTENSION FOR 3D PIES
1041
1213
  ***/
1042
1214
 
@@ -1077,7 +1249,8 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'translate', function (pro
1077
1249
  shapeArgs.origin = origin;
1078
1250
  shapeArgs.alpha = alpha;
1079
1251
  shapeArgs.beta = beta;
1080
-
1252
+ shapeArgs.center = series.center;
1253
+
1081
1254
  var angle = (shapeArgs.end + shapeArgs.start) / 2;
1082
1255
 
1083
1256
  point.slicedTranslation = {
@@ -1222,6 +1395,7 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'animate', function (proce
1222
1395
  });/***
1223
1396
  EXTENSION FOR 3D SCATTER CHART
1224
1397
  ***/
1398
+
1225
1399
  Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'translate', function (proceed) {
1226
1400
  //function translate3d(proceed) {
1227
1401
  proceed.apply(this, [].slice.call(arguments, 1));
@@ -1232,11 +1406,9 @@ Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'translate', function
1232
1406
 
1233
1407
  var series = this,
1234
1408
  chart = series.chart,
1235
- depth = chart.options.chart.options3d.depth,
1236
- zAxis = chart.options.zAxis || { min : 0, max: depth };
1409
+ zAxis = Highcharts.pick(series.zAxis, chart.options.zAxis[0]);
1237
1410
 
1238
- var rangeModifier = depth / (zAxis.max - zAxis.min),
1239
- raw_points = [],
1411
+ var raw_points = [],
1240
1412
  raw_point,
1241
1413
  projected_points,
1242
1414
  projected_point,
@@ -1244,10 +1416,13 @@ Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'translate', function
1244
1416
 
1245
1417
  for (i = 0; i < series.data.length; i++) {
1246
1418
  raw_point = series.data[i];
1419
+
1420
+ raw_point.isInside = raw_point.isInside ? (raw_point.z >= zAxis.min && raw_point.z <= zAxis.max) : false;
1421
+
1247
1422
  raw_points.push({
1248
1423
  x: raw_point.plotX,
1249
1424
  y: raw_point.plotY,
1250
- z: (raw_point.z - zAxis.min) * rangeModifier
1425
+ z: zAxis.translate(raw_point.z)
1251
1426
  });
1252
1427
  }
1253
1428
 
@@ -1263,16 +1438,23 @@ Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'translate', function
1263
1438
  raw_point.plotX = projected_point.x;
1264
1439
  raw_point.plotY = projected_point.y;
1265
1440
  raw_point.plotZ = projected_point.z;
1441
+
1442
+
1266
1443
  }
1267
- });
1268
1444
 
1269
- Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'init', function (proceed) {
1270
- var result = proceed.apply(this, [].slice.call(arguments, 1));
1445
+ });
1271
1446
 
1272
- if (this.chart.is3d()) {
1273
- // Add a third coordinate
1447
+ Highcharts.wrap(Highcharts.seriesTypes.scatter.prototype, 'init', function (proceed, chart, options) {
1448
+ if (chart.is3d()) {
1449
+ // add a third coordinate
1450
+ this.axisTypes = ['xAxis', 'yAxis', 'zAxis'];
1274
1451
  this.pointArrayMap = ['x', 'y', 'z'];
1452
+ this.parallelArrays = ['x', 'y', 'z'];
1453
+ }
1275
1454
 
1455
+ var result = proceed.apply(this, [chart, options]);
1456
+
1457
+ if (this.chart.is3d()) {
1276
1458
  // Set a new default tooltip formatter
1277
1459
  var default3dScatterTooltip = 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>';
1278
1460
  if (this.userOptions.tooltip) {