Skip to content

Commit bac32bf

Browse files
sunburst Rotation
Reuse rotation attribute from Pie
1 parent 35474a1 commit bac32bf

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/traces/sunburst/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ module.exports = {
203203
'this option won\'t have any effect and `insidetextfont` would be used.'
204204
].join(' ')
205205
}),
206+
rotation: pieAttrs.rotation,
206207

207208
domain: domainAttrs({name: 'sunburst', trace: true, editType: 'calc'})
208209
};

src/traces/sunburst/defaults.js

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
7373

7474
coerce('insidetextorientation');
7575

76+
coerce('rotation');
77+
7678
handleDomainDefaults(traceOut, layout, coerce);
7779

7880
// do not support transforms for now

src/traces/sunburst/plot.js

+4
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ function plotOne(gd, cd, element, transitionOpts) {
220220
s.style('pointer-events', 'all');
221221
});
222222

223+
var extraAngle = trace.rotation * Math.PI / 180;
224+
pt.x0 = pt.x0 + extraAngle;
225+
pt.x1 = pt.x1 + extraAngle;
226+
223227
pt.rpx0 = y2rpx(pt.y0);
224228
pt.rpx1 = y2rpx(pt.y1);
225229
pt.xmid = (pt.x0 + pt.x1) / 2;

0 commit comments

Comments
 (0)