Skip to content

Commit

Permalink
Fixed #7371, sunburst chart failed in styled mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
TorsteinHonsi committed Nov 7, 2017
1 parent 001a2a0 commit 9f311d8
Show file tree
Hide file tree
Showing 7 changed files with 1,473 additions and 3 deletions.
3 changes: 3 additions & 0 deletions js/mixins/draw-point.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ var draw = function draw(params) {
}
});
}
if (graphic) {
graphic.addClass(point.getClassName(), true);
}
};

export default draw;
10 changes: 9 additions & 1 deletion js/mixins/tree-series.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ var getColor = function getColor(node, options) {
point,
level,
colorByPoint,
colorIndexByPoint,
color,
colorIndex;
function variation(color) {
Expand All @@ -102,9 +103,14 @@ var getColor = function getColor(node, options) {
!!series.options.colorByPoint
)
);

if (getColorByPoint) {
colorByPoint = colors[(point.index % colors.length)];
colorIndexByPoint = point.index %
(colors ? colors.length : series.chart.options.chart.colorCount);
colorByPoint = colors && colors[colorIndexByPoint];
}

/*= if (build.classic) { =*/
// Select either point color, level color or inherited color.
color = pick(
point && point.options.color,
Expand All @@ -113,9 +119,11 @@ var getColor = function getColor(node, options) {
parentColor && variation(parentColor),
series.color
);
/*= } =*/
colorIndex = pick(
point && point.options.colorIndex,
level && level.colorIndex,
colorIndexByPoint,
parentColorIndex,
options.colorIndex
);
Expand Down
11 changes: 9 additions & 2 deletions js/modules/sunburst.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ var sunburstSeries = {
level = levelMap[node.levelDynamic],
shapeExisting = point.shapeExisting || {},
shape = node.shapeArgs || {},
attrStyle = series.pointAttribs(point, point.selected && 'select'),
animationInfo,
onComplete,
visible = !!(node.visible && node.shapeArgs);
Expand Down Expand Up @@ -482,7 +481,13 @@ var sunburstSeries = {
}
point.draw({
animate: animationInfo.to,
attr: extend(animationInfo.from, attrStyle),
attr: extend(
animationInfo.from,
series.pointAttribs && series.pointAttribs(
point,
point.selected && 'select'
)
),
onComplete: onComplete,
group: group,
renderer: renderer,
Expand All @@ -506,7 +511,9 @@ var sunburstSeries = {
Series.prototype.drawDataLabels.call(series);
}
},
/*= if (build.classic) { =*/
pointAttribs: seriesTypes.column.prototype.pointAttribs,
/*= } =*/

/*
* Set the shape arguments on the nodes. Recursive from root down.
Expand Down
11 changes: 11 additions & 0 deletions samples/highcharts/css/sunburst/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import 'https://code.highcharts.com/css/highcharts.css';

#container {
min-width: 310px;
max-width: 800px;
margin: 0 auto
}
.highcharts-sunburst-series .highcharts-point {
stroke: white;
stroke-width: 1px;
}
6 changes: 6 additions & 0 deletions samples/highcharts/css/sunburst/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: Sunburst Styled Mode
authors:
- Torstein Hønsi
js_wrap: b
...
4 changes: 4 additions & 0 deletions samples/highcharts/css/sunburst/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<script src="https://code.highcharts.com/js/highcharts.js"></script>
<script src="https://code.highcharts.com/js/modules/sunburst.js"></script>

<div id="container"></div>
Loading

0 comments on commit 9f311d8

Please sign in to comment.