highcharts-rails 4.0.1 → 4.0.3

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.0.1 (2014-04-24)
2
+ * @license Highcharts JS v4.0.3 (2014-07-03)
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.0.1 (2014-04-24)
5
+ * @license Highcharts JS v4.0.3 (2014-07-03)
6
6
  *
7
7
  * (c) 2009-2013 Torstein Hønsi
8
8
  *
@@ -40,8 +40,9 @@ function perspective(points, angle2, angle1, origin) {
40
40
  xe = origin.x;
41
41
  ye = origin.y;
42
42
  ze = (origin.z === 0 ? 0.0001 : origin.z) * (origin.vd || 25);
43
-
43
+
44
44
  // some kind of minimum?
45
+ ze = Math.max(500, ze);
45
46
 
46
47
  var s1 = sin(angle1),
47
48
  c1 = cos(angle1),
@@ -291,15 +292,15 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
291
292
  paths = this.arc3dPath(shapeArgs),
292
293
  renderer = result.renderer;
293
294
 
294
- var zIndex = paths.zAll * 100;
295
+ var zIndex = paths.zTop * 100;
295
296
 
296
297
  result.shapeArgs = shapeArgs; // Store for later use
297
298
 
298
- result.side1 = renderer.path(paths.side2).attr({zIndex: paths.zSide2}).add(result);
299
- result.side2 = renderer.path(paths.side1).attr({zIndex: paths.zSide1}).add(result);
300
- result.inn = renderer.path(paths.inn).attr({zIndex: paths.zInn}).add(result);
301
- result.out = renderer.path(paths.out).attr({zIndex: paths.zOut}).add(result);
302
299
  result.top = renderer.path(paths.top).attr({zIndex: paths.zTop}).add(result);
300
+ result.side1 = renderer.path(paths.side2).attr({zIndex: paths.zSide2});
301
+ result.side2 = renderer.path(paths.side1).attr({zIndex: paths.zSide1});
302
+ result.inn = renderer.path(paths.inn).attr({zIndex: paths.zInn});
303
+ result.out = renderer.path(paths.out).attr({zIndex: paths.zOut});
303
304
 
304
305
  result.fillSetter = function (color) {
305
306
  this.color = color;
@@ -314,37 +315,85 @@ Highcharts.SVGRenderer.prototype.arc3d = function (shapeArgs) {
314
315
  this.top.attr({fill: c0});
315
316
  return this;
316
317
  };
317
-
318
- result.animate = function (args, duration, complete) {
319
- Highcharts.SVGElement.prototype.animate.call(this, args, duration, complete);
320
-
321
- if (args.x && args.y) {
322
-
323
- // Recreate
324
- var result = this,
325
- renderer = this.renderer,
326
- shapeArgs = Highcharts.splat(args)[0];
327
-
328
- shapeArgs.alpha *= deg2rad;
329
- shapeArgs.beta *= deg2rad;
330
-
331
- var paths = renderer.arc3dPath(shapeArgs);
332
-
333
- result.shapeArgs = shapeArgs; // Store for later use
318
+
319
+ result.translateXSetter = function (value) {
320
+ this.out.attr({translateX: value});
321
+ this.inn.attr({translateX: value});
322
+ this.side1.attr({translateX: value});
323
+ this.side2.attr({translateX: value});
324
+ this.top.attr({translateX: value});
325
+ };
326
+
327
+ result.translateYSetter = function (value) {
328
+ this.out.attr({translateY: value});
329
+ this.inn.attr({translateY: value});
330
+ this.side1.attr({translateY: value});
331
+ this.side2.attr({translateY: value});
332
+ this.top.attr({translateY: value});
333
+ };
334
334
 
335
- result.inn.attr({d: paths.inn, zIndex: paths.zInn});
336
- result.out.attr({d: paths.out, zIndex: paths.zOut});
337
- result.side1.attr({d: paths.side1, zIndex: paths.zSide2});
338
- result.side2.attr({d: paths.side2, zIndex: paths.zSide1});
339
- result.top.attr({d: paths.top, zIndex: paths.zTop});
335
+ result.animate = function (args, duration, complete) {
336
+ if (args.end || args.start) {
337
+ this._shapeArgs = this.shapeArgs;
338
+
339
+ Highcharts.SVGElement.prototype.animate.call(this, {
340
+ _args: args
341
+ }, {
342
+ duration: duration,
343
+ step: function () {
344
+ var args = arguments,
345
+ fx = args[1],
346
+ result = fx.elem,
347
+ start = result._shapeArgs,
348
+ end = fx.end,
349
+ pos = fx.pos,
350
+ sA = Highcharts.merge(start, {
351
+ start: start.start + ((end.start - start.start) * pos),
352
+ end: start.end + ((end.end - start.end) * pos)
353
+ });
354
+
355
+ var paths = result.renderer.arc3dPath(sA);
356
+
357
+ result.shapeArgs = sA;
358
+
359
+ result.top.attr({d: paths.top, zIndex: paths.zTop});
360
+ result.inn.attr({d: paths.inn, zIndex: paths.zInn});
361
+ result.out.attr({d: paths.out, zIndex: paths.zOut});
362
+ result.side1.attr({d: paths.side1, zIndex: paths.zSide1});
363
+ result.side2.attr({d: paths.side2, zIndex: paths.zSide2});
340
364
 
341
- result.attr({fill: result.color});
342
- result.attr({zIndex: paths.zAll * 100});
365
+ }
366
+ }, complete);
367
+ } else {
368
+ Highcharts.SVGElement.prototype.animate.call(this, args, duration, complete);
343
369
  }
344
-
345
370
  return this;
346
371
  };
347
372
 
373
+ result.destroy = function () {
374
+ this.top.destroy();
375
+ this.out.destroy();
376
+ this.inn.destroy();
377
+ this.side1.destroy();
378
+ this.side2.destroy();
379
+
380
+ Highcharts.SVGElement.prototype.destroy.call(this);
381
+ };
382
+ result.hide = function () {
383
+ this.top.hide();
384
+ this.out.hide();
385
+ this.inn.hide();
386
+ this.side1.hide();
387
+ this.side2.hide();
388
+ };
389
+ result.show = function () {
390
+ this.top.show();
391
+ this.out.show();
392
+ this.inn.show();
393
+ this.side1.show();
394
+ this.side2.show();
395
+ };
396
+
348
397
  result.zIndex = zIndex;
349
398
  result.attr({zIndex: zIndex});
350
399
  return result;
@@ -383,9 +432,6 @@ Highcharts.SVGRenderer.prototype.arc3dPath = function (shapeArgs) {
383
432
  top = top.concat(curveTo(cx, cy, irx, iry, end, start, 0, 0));
384
433
  top = top.concat(['Z']);
385
434
 
386
- var midAngle = ((shapeArgs.start + shapeArgs.end) / 2);
387
- var zIndex = ((sin(beta) * cos(midAngle)) + (sin(-alpha) * sin(-midAngle)));
388
-
389
435
  // OUTSIDE
390
436
  var b = (beta > 0 ? PI / 2 : 0),
391
437
  a = (alpha > 0 ? 0 : PI / 2);
@@ -426,26 +472,21 @@ Highcharts.SVGRenderer.prototype.arc3dPath = function (shapeArgs) {
426
472
  'Z'
427
473
  ];
428
474
 
429
- var mr = ir + ((r - ir) / 2);
430
-
431
- var zTop = Math.abs(zIndex * 2 * mr),
432
- zOut = zIndex * r,
433
- zInn = zIndex * ir,
434
- zSide1 = ((sin(beta) * cos(start)) + (sin(-alpha) * sin(-start))) * mr,
435
- zSide2 = ((sin(beta) * cos(end)) + (sin(-alpha) * sin(-end))) * mr;
475
+ var a1 = sin((start + end) / 2),
476
+ a2 = sin(start),
477
+ a3 = sin(end);
436
478
 
437
479
  return {
438
480
  top: top,
439
- zTop: zTop * 100,
481
+ zTop: r,
440
482
  out: out,
441
- zOut: zOut * 100,
483
+ zOut: Math.max(a1, a2, a3) * r,
442
484
  inn: inn,
443
- zInn: zInn * 100,
485
+ zInn: Math.max(a1, a2, a3) * r,
444
486
  side1: side1,
445
- zSide1: zSide1 * 100,
487
+ zSide1: a2 * (r * 0.99),
446
488
  side2: side2,
447
- zSide2: zSide2 * 100,
448
- zAll: zIndex
489
+ zSide2: a3 * (r * 0.99)
449
490
  };
450
491
  };
451
492
  /***
@@ -464,28 +505,20 @@ Highcharts.wrap(Highcharts.Chart.prototype, 'isInsidePlot', function (proceed) {
464
505
  }
465
506
  });
466
507
 
467
- Highcharts.wrap(Highcharts.Chart.prototype, 'init', function (proceed) {
468
- var args = arguments;
469
- args[1] = Highcharts.merge({
470
- chart: {
471
- options3d: {
472
- enabled: false,
473
- alpha: 0,
474
- beta: 0,
475
- depth: 100,
476
- viewDistance: 25,
477
-
478
- frame: {
479
- bottom: { size: 1, color: 'rgba(255,255,255,0)' },
480
- side: { size: 1, color: 'rgba(255,255,255,0)' },
481
- back: { size: 1, color: 'rgba(255,255,255,0)' }
482
- }
483
- }
484
- }
485
- }, args[1]);
486
-
487
- proceed.apply(this, [].slice.call(args, 1));
488
- });
508
+ var defaultChartOptions = Highcharts.getOptions();
509
+ defaultChartOptions.chart.options3d = {
510
+ enabled: false,
511
+ alpha: 0,
512
+ beta: 0,
513
+ depth: 100,
514
+ viewDistance: 25,
515
+ frame: {
516
+ bottom: { size: 1, color: 'rgba(255,255,255,0)' },
517
+ side: { size: 1, color: 'rgba(255,255,255,0)' },
518
+ back: { size: 1, color: 'rgba(255,255,255,0)' }
519
+ }
520
+ };
521
+ defaultChartOptions.plotOptions.pie.borderColor = undefined;
489
522
 
490
523
  Highcharts.wrap(Highcharts.Chart.prototype, 'setChartSize', function (proceed) {
491
524
  proceed.apply(this, [].slice.call(arguments, 1));
@@ -514,12 +547,9 @@ Highcharts.wrap(Highcharts.Chart.prototype, 'redraw', function (proceed) {
514
547
  proceed.apply(this, [].slice.call(arguments, 1));
515
548
  });
516
549
 
517
- Highcharts.Chart.prototype.retrieveStacks = function () {
550
+ Highcharts.Chart.prototype.retrieveStacks = function (grouping, stacking) {
551
+
518
552
  var stacks = {},
519
- type = this.options.chart.type,
520
- typeOptions = this.options.plotOptions[type],
521
- stacking = typeOptions.stacking,
522
- grouping = typeOptions.grouping,
523
553
  i = 1;
524
554
 
525
555
  if (grouping || !stacking) { return this.series; }
@@ -679,6 +709,35 @@ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function (proceed)
679
709
  return path;
680
710
  });
681
711
 
712
+ Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotBandPath', function (proceed) {
713
+ // Do not do this if the chart is not 3D
714
+ if (!this.chart.is3d()) {
715
+ return proceed.apply(this, [].slice.call(arguments, 1));
716
+ } else {
717
+ var args = arguments,
718
+ from = args[1],
719
+ to = args[2];
720
+
721
+ var toPath = this.getPlotLinePath(to),
722
+ path = this.getPlotLinePath(from);
723
+
724
+ if (path && toPath) {
725
+ path.push(
726
+ toPath[7], // These two do not exist in the regular getPlotLine
727
+ toPath[8], // ---- # 3005
728
+ toPath[4],
729
+ toPath[5],
730
+ toPath[1],
731
+ toPath[2]
732
+ );
733
+ } else { // outside the axis area
734
+ path = null;
735
+ }
736
+
737
+ return path;
738
+ }
739
+ });
740
+
682
741
  /***
683
742
  EXTENSION TO THE TICKS
684
743
  ***/
@@ -768,14 +827,13 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'translate', function (
768
827
  return;
769
828
  }
770
829
 
771
- var type = this.chart.options.chart.type,
772
- series = this,
830
+ var series = this,
773
831
  chart = series.chart,
774
832
  options = chart.options,
775
- typeOptions = options.plotOptions[type],
833
+ seriesOptions = series.options,
776
834
  options3d = options.chart.options3d,
777
835
 
778
- depth = typeOptions.depth || 25,
836
+ depth = seriesOptions.depth || 25,
779
837
  origin = {
780
838
  x: chart.plotWidth / 2,
781
839
  y: chart.plotHeight / 2,
@@ -785,12 +843,12 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'translate', function (
785
843
  alpha = options3d.alpha,
786
844
  beta = options3d.beta * (chart.yAxis[0].opposite ? -1 : 1);
787
845
 
788
- var stack = typeOptions.stacking ? (this.options.stack || 0) : series._i;
789
- var z = stack * (depth + (typeOptions.groupZPadding || 1));
846
+ var stack = seriesOptions.stacking ? (seriesOptions.stack || 0) : series._i;
847
+ var z = stack * (depth + (seriesOptions.groupZPadding || 1));
790
848
 
791
- if (typeOptions.grouping !== false) { z = 0; }
849
+ if (seriesOptions.grouping !== false) { z = 0; }
792
850
 
793
- z += (typeOptions.groupZPadding || 1);
851
+ z += (seriesOptions.groupZPadding || 1);
794
852
 
795
853
  Highcharts.each(series.data, function (point) {
796
854
  var shapeArgs = point.shapeArgs,
@@ -823,7 +881,8 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'animate', function (pr
823
881
  if (Highcharts.svg) { // VML is too slow anyway
824
882
  if (init) {
825
883
  Highcharts.each(series.data, function (point) {
826
- point.height = point.shapeArgs.height;
884
+ point.height = point.shapeArgs.height;
885
+ point.shapey = point.shapeArgs.y; //#2968
827
886
  point.shapeArgs.height = 1;
828
887
  if (!reversed) {
829
888
  if (point.stackY) {
@@ -837,15 +896,16 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'animate', function (pr
837
896
  } else { // run the animation
838
897
  Highcharts.each(series.data, function (point) {
839
898
  point.shapeArgs.height = point.height;
840
- if (!reversed) {
841
- point.shapeArgs.y = point.plotY - (point.negative ? point.height : 0);
842
- }
899
+ point.shapeArgs.y = point.shapey; //#2968
843
900
  // null value do not have a graphic
844
901
  if (point.graphic) {
845
902
  point.graphic.animate(point.shapeArgs, series.options.animation);
846
903
  }
847
904
  });
848
905
 
906
+ // redraw datalabels to the correct position
907
+ this.drawDataLabels();
908
+
849
909
  // delete this function to allow it only once
850
910
  series.animate = null;
851
911
  }
@@ -853,29 +913,28 @@ Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'animate', function (pr
853
913
  }
854
914
  });
855
915
 
856
-
857
916
  Highcharts.wrap(Highcharts.seriesTypes.column.prototype, 'init', function (proceed) {
858
917
  proceed.apply(this, [].slice.call(arguments, 1));
859
918
 
860
919
  if (this.chart.is3d()) {
861
- var grouping = this.chart.options.plotOptions.column.grouping,
862
- stacking = this.chart.options.plotOptions.column.stacking,
863
- z = this.options.zIndex;
864
- if (!z) {
865
- if (!(grouping !== undefined && !grouping) && stacking) {
866
- var stacks = this.chart.retrieveStacks(),
867
- stack = this.options.stack || 0,
868
- i; // position within the stack
869
- for (i = 0; i < stacks[stack].series.length; i++) {
870
- if (stacks[stack].series[i] === this) {
871
- break;
872
- }
920
+ var seriesOptions = this.options,
921
+ grouping = seriesOptions.grouping,
922
+ stacking = seriesOptions.stacking,
923
+ z = 0;
924
+
925
+ if (!(grouping !== undefined && !grouping) && stacking) {
926
+ var stacks = this.chart.retrieveStacks(grouping, stacking),
927
+ stack = seriesOptions.stack || 0,
928
+ i; // position within the stack
929
+ for (i = 0; i < stacks[stack].series.length; i++) {
930
+ if (stacks[stack].series[i] === this) {
931
+ break;
873
932
  }
874
- z = (stacks.totalStacks * 10) - (10 * (stacks.totalStacks - stacks[stack].position)) - i;
875
-
876
- this.options.zIndex = z;
877
933
  }
934
+ z = (stacks.totalStacks * 10) - (10 * (stacks.totalStacks - stacks[stack].position)) - i;
878
935
  }
936
+
937
+ seriesOptions.zIndex = z;
879
938
  }
880
939
  });
881
940
  function draw3DPoints(proceed) {
@@ -885,25 +944,56 @@ function draw3DPoints(proceed) {
885
944
  if (grouping !== undefined && !grouping && this.group.zIndex !== undefined) {
886
945
  this.group.attr({zIndex : (this.group.zIndex * 10)});
887
946
  }
888
- if (this.userOptions.borderColor === undefined) {
889
- this.options.borderColor = this.color;
890
- }
891
947
 
892
- // Set the border color to the fill color to provide a smooth edge
948
+ var options = this.options,
949
+ states = this.options.states;
950
+
951
+ this.borderWidth = options.borderWidth = options.edgeWidth || 1;
952
+
893
953
  Highcharts.each(this.data, function (point) {
894
- var c = point.options.borderColor || point.color || point.series.userOptions.borderColor;
895
- point.options.borderColor = c;
896
- point.borderColor = c;
897
- point.pointAttr[''].stroke = c;
898
- // same bordercolor on hover and select
899
- point.pointAttr.hover.stroke = c;
900
- point.pointAttr.select.stroke = c;
901
- });
954
+ var pointAttr = point.pointAttr;
955
+
956
+ // Set the border color to the fill color to provide a smooth edge
957
+ this.borderColor = Highcharts.pick(options.edgeColor, pointAttr[''].fill);
958
+
959
+ pointAttr[''].stroke = this.borderColor;
960
+ pointAttr.hover.stroke = Highcharts.pick(states.hover.edgeColor, this.borderColor);
961
+ pointAttr.select.stroke = Highcharts.pick(states.select.edgeColor, this.borderColor);
962
+ });
902
963
  }
903
964
 
904
965
  proceed.apply(this, [].slice.call(arguments, 1));
905
966
  }
906
967
 
968
+ Highcharts.wrap(Highcharts.Series.prototype, 'alignDataLabel', function (proceed) {
969
+
970
+ // Only do this for 3D columns and columnranges
971
+ if (this.chart.is3d() && (this.type === 'column' || this.type === 'columnrange')) {
972
+ var series = this,
973
+ chart = series.chart,
974
+ options = chart.options,
975
+ options3d = options.chart.options3d,
976
+ origin = {
977
+ x: chart.plotWidth / 2,
978
+ y: chart.plotHeight / 2,
979
+ z: options3d.depth,
980
+ vd: options3d.viewDistance
981
+ },
982
+ alpha = options3d.alpha,
983
+ beta = options3d.beta * (chart.yAxis[0].opposite ? -1 : 1);
984
+
985
+ var args = arguments,
986
+ alignTo = args[4];
987
+
988
+ var pos = ({x: alignTo.x, y: alignTo.y, z: 0});
989
+ pos = perspective([pos], alpha, beta, origin)[0];
990
+ alignTo.x = pos.x;
991
+ alignTo.y = pos.y;
992
+ }
993
+
994
+ proceed.apply(this, [].slice.call(arguments, 1));
995
+ });
996
+
907
997
  if (Highcharts.seriesTypes.columnrange) {
908
998
  Highcharts.wrap(Highcharts.seriesTypes.columnrange.prototype, 'drawPoints', draw3DPoints);
909
999
  }
@@ -978,8 +1068,8 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'translate', function (pro
978
1068
  var series = this,
979
1069
  chart = series.chart,
980
1070
  options = chart.options,
981
- pieOptions = options.plotOptions.pie,
982
- depth = pieOptions.depth || 0,
1071
+ seriesOptions = series.options,
1072
+ depth = seriesOptions.depth || 0,
983
1073
  options3d = options.chart.options3d,
984
1074
  origin = {
985
1075
  x: chart.plotWidth / 2,
@@ -989,27 +1079,31 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'translate', function (pro
989
1079
  alpha = options3d.alpha,
990
1080
  beta = options3d.beta;
991
1081
 
992
- var z = pieOptions.stacking ? (this.options.stack || 0) * depth : series._i * depth;
1082
+ var z = seriesOptions.stacking ? (seriesOptions.stack || 0) * depth : series._i * depth;
993
1083
  z += depth / 2;
994
1084
 
995
- if (pieOptions.grouping !== false) { z = 0; }
1085
+ if (seriesOptions.grouping !== false) { z = 0; }
996
1086
 
997
1087
  Highcharts.each(series.data, function (point) {
998
1088
  point.shapeType = 'arc3d';
999
1089
  var shapeArgs = point.shapeArgs;
1000
1090
 
1001
- shapeArgs.z = z;
1002
- shapeArgs.depth = depth * 0.75;
1003
- shapeArgs.origin = origin;
1004
- shapeArgs.alpha = alpha;
1005
- shapeArgs.beta = beta;
1006
-
1007
- var angle = (shapeArgs.end + shapeArgs.start) / 2;
1091
+ if (point.y) { // will be false if null or 0 #3006
1092
+ shapeArgs.z = z;
1093
+ shapeArgs.depth = depth * 0.75;
1094
+ shapeArgs.origin = origin;
1095
+ shapeArgs.alpha = alpha;
1096
+ shapeArgs.beta = beta;
1097
+
1098
+ var angle = (shapeArgs.end + shapeArgs.start) / 2;
1008
1099
 
1009
- point.slicedTranslation = {
1010
- translateX : round(cos(angle) * series.options.slicedOffset * cos(alpha * deg2rad)),
1011
- translateY : round(sin(angle) * series.options.slicedOffset * cos(alpha * deg2rad))
1012
- };
1100
+ point.slicedTranslation = {
1101
+ translateX : round(cos(angle) * series.options.slicedOffset * cos(alpha * deg2rad)),
1102
+ translateY : round(sin(angle) * series.options.slicedOffset * cos(alpha * deg2rad))
1103
+ };
1104
+ } else {
1105
+ shapeArgs = null;
1106
+ }
1013
1107
  });
1014
1108
  });
1015
1109
 
@@ -1020,50 +1114,59 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype.pointClass.prototype, 'halo
1020
1114
  Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'drawPoints', function (proceed) {
1021
1115
  // Do not do this if the chart is not 3D
1022
1116
  if (this.chart.is3d()) {
1117
+ var options = this.options,
1118
+ states = this.options.states;
1119
+
1023
1120
  // Set the border color to the fill color to provide a smooth edge
1121
+ this.borderWidth = options.borderWidth = options.edgeWidth || 1;
1122
+
1123
+ states.hover.borderColor = Highcharts.pick(states.hover.edgeColor, this.borderColor);
1124
+ states.hover.borderWidth = Highcharts.pick(states.hover.edgeWidth, this.borderWidth);
1125
+ states.select.borderColor = Highcharts.pick(states.select.edgeColor, this.borderColor);
1126
+ states.select.borderWidth = Highcharts.pick(states.select.edgeWidth, this.borderWidth);
1127
+
1024
1128
  Highcharts.each(this.data, function (point) {
1025
- var c = point.options.borderColor || point.color || point.series.userOptions.borderColor || point.series.color;
1026
- point.options.borderColor = c;
1027
- point.borderColor = c;
1028
- point.pointAttr[''].stroke = c;
1029
- // same bordercolor on hover and select
1030
- point.pointAttr.hover.stroke = c;
1031
- point.pointAttr.select.stroke = c;
1129
+ var pointAttr = point.pointAttr;
1130
+ pointAttr[''].stroke = point.series.borderColor || point.color;
1131
+ pointAttr['']['stroke-width'] = point.series.borderWidth;
1132
+ pointAttr.hover.stroke = states.hover.borderColor;
1133
+ pointAttr.hover['stroke-width'] = states.hover.borderWidth;
1134
+ pointAttr.select.stroke = states.select.borderColor;
1135
+ pointAttr.select['stroke-width'] = states.select.borderWidth;
1032
1136
  });
1033
1137
  }
1034
1138
 
1035
1139
  proceed.apply(this, [].slice.call(arguments, 1));
1140
+
1141
+ if (this.chart.is3d()) {
1142
+ var seriesGroup = this.group;
1143
+ Highcharts.each(this.points, function (point) {
1144
+ point.graphic.out.add(seriesGroup);
1145
+ point.graphic.inn.add(seriesGroup);
1146
+ point.graphic.side1.add(seriesGroup);
1147
+ point.graphic.side2.add(seriesGroup);
1148
+ });
1149
+ }
1036
1150
  });
1037
1151
 
1038
1152
  Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'drawDataLabels', function (proceed) {
1039
- proceed.apply(this, [].slice.call(arguments, 1));
1040
- // Do not do this if the chart is not 3D
1041
- if (!this.chart.is3d()) {
1042
- return;
1043
- }
1153
+ if (this.chart.is3d()) {
1154
+ var series = this;
1155
+ Highcharts.each(series.data, function (point) {
1156
+ var shapeArgs = point.shapeArgs,
1157
+ r = shapeArgs.r,
1158
+ d = shapeArgs.depth,
1159
+ a1 = shapeArgs.alpha * deg2rad,
1160
+ a2 = (shapeArgs.start + shapeArgs.end) / 2,
1161
+ labelPos = point.labelPos;
1162
+
1163
+ labelPos[1] += (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0);
1164
+ labelPos[3] += (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0);
1165
+ labelPos[5] += (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0);
1166
+ });
1167
+ }
1044
1168
 
1045
- var series = this;
1046
- Highcharts.each(series.data, function (point) {
1047
- var shapeArgs = point.shapeArgs;
1048
- var r = shapeArgs.r,
1049
- d = shapeArgs.depth,
1050
- a1 = shapeArgs.alpha * deg2rad,
1051
- b1 = shapeArgs.beta * deg2rad,
1052
- a2 = (shapeArgs.start + shapeArgs.end) / 2;
1053
-
1054
- if (point.connector) {
1055
- point.connector.translate(
1056
- (-r * (1 - cos(b1)) * cos(a2)) + (cos(a2) > 0 ? sin(b1) * d : 0),
1057
- (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0)
1058
- );
1059
- }
1060
- if (point.dataLabel) {
1061
- point.dataLabel.attr({
1062
- x: point.dataLabel.connX + (-r * (1 - cos(b1)) * cos(a2)) + (cos(a2) > 0 ? cos(b1) * d : 0) - (point.dataLabel.width / 2),
1063
- y: point.dataLabel.connY + (-r * (1 - cos(a1)) * sin(a2)) + (sin(a2) > 0 ? sin(a1) * d : 0) - (point.dataLabel.height / 2)
1064
- });
1065
- }
1066
- });
1169
+ proceed.apply(this, [].slice.call(arguments, 1));
1067
1170
  });
1068
1171
 
1069
1172
  Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'addPoint', function (proceed) {
@@ -1095,8 +1198,8 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'animate', function (proce
1095
1198
  if (init) {
1096
1199
 
1097
1200
  // Scale down the group and place it in the center
1098
- this.oldtranslateX = group.translateX;
1099
- this.oldtranslateY = group.translateY;
1201
+ group.oldtranslateX = group.translateX;
1202
+ group.oldtranslateY = group.translateY;
1100
1203
  attribs = {
1101
1204
  translateX: center[0],
1102
1205
  translateY: center[1],
@@ -1113,12 +1216,13 @@ Highcharts.wrap(Highcharts.seriesTypes.pie.prototype, 'animate', function (proce
1113
1216
  // Run the animation
1114
1217
  } else {
1115
1218
  attribs = {
1116
- translateX: this.oldtranslateX,
1117
- translateY: this.oldtranslateY,
1219
+ translateX: group.oldtranslateX,
1220
+ translateY: group.oldtranslateY,
1118
1221
  scaleX: 1,
1119
1222
  scaleY: 1
1120
1223
  };
1121
1224
  group.animate(attribs, animation);
1225
+
1122
1226
  if (markerGroup) {
1123
1227
  markerGroup.animate(attribs, animation);
1124
1228
  }