@@ -18,6 +18,7 @@ var uniformText = require('../bar/uniform_text');
1818var recordMinTextSize = uniformText . recordMinTextSize ;
1919var clearMinTextSize = uniformText . clearMinTextSize ;
2020var piePlot = require ( '../pie/plot' ) ;
21+ var getRotationAngle = require ( '../pie/helpers' ) . getRotationAngle ;
2122var computeTransform = piePlot . computeTransform ;
2223var transformInsideText = piePlot . transformInsideText ;
2324var styleOne = require ( './style' ) . styleOne ;
@@ -150,11 +151,11 @@ function plotOne(gd, cd, element, transitionOpts) {
150151 // filter out slices that won't show up on graph
151152 sliceData = sliceData . filter ( function ( pt ) { return pt . y1 <= cutoff ; } ) ;
152153
153- if ( trace . rotation && trace . rotation !== 'auto' ) {
154- var extraAngle = trace . rotation * Math . PI / 180 ;
154+ var baseX = getRotationAngle ( trace . rotation ) ;
155+ if ( baseX ) {
155156 sliceData . forEach ( function ( pt ) {
156- pt . x0 += extraAngle ;
157- pt . x1 += extraAngle ;
157+ pt . x0 += baseX ;
158+ pt . x1 += baseX ;
158159 } ) ;
159160 }
160161
@@ -310,7 +311,7 @@ function plotOne(gd, cd, element, transitionOpts) {
310311 var next ;
311312
312313 if ( entryPrev ) {
313- var a = pt . x1 > entryPrev . x1 ? 2 * Math . PI : 0 ;
314+ var a = ( pt . x1 > entryPrev . x1 ? 2 * Math . PI : 0 ) + baseX ;
314315 // if pt to remove:
315316 // - if 'below' where the root-node used to be: shrink it radially inward
316317 // - otherwise, collapse it clockwise or counterclockwise which ever is shortest to theta=0
@@ -360,7 +361,7 @@ function plotOne(gd, cd, element, transitionOpts) {
360361 // if new branch, twist it in clockwise or
361362 // counterclockwise which ever is shorter to
362363 // its final angle
363- var a = pt . x1 > nextX1ofPrevEntry ? 2 * Math . PI : 0 ;
364+ var a = ( pt . x1 > nextX1ofPrevEntry ? 2 * Math . PI : 0 ) + baseX ;
364365 prev = { x0 : a , x1 : a } ;
365366 } else {
366367 // if new leaf (when maxdepth is set),
@@ -375,7 +376,7 @@ function plotOne(gd, cd, element, transitionOpts) {
375376 }
376377 } else {
377378 // start sector of new traces from theta=0
378- prev = { x0 : 0 , x1 : 0 } ;
379+ prev = { x0 : baseX , x1 : baseX } ;
379380 }
380381 }
381382
@@ -418,11 +419,11 @@ function plotOne(gd, cd, element, transitionOpts) {
418419 }
419420 } else {
420421 // if new root-node
421- prev . x0 = prev . x1 = 0 ;
422+ prev . x0 = prev . x1 = baseX ;
422423 }
423424 } else {
424425 // on new traces
425- prev . x0 = prev . x1 = 0 ;
426+ prev . x0 = prev . x1 = baseX ;
426427 }
427428 }
428429
0 commit comments