@@ -311,34 +311,43 @@ function setOffsetAndWidth(gd, pa, sieve, opts) {
311311 // if there aren't any overlapping positions,
312312 // let them have full width even if mode is group
313313 var overlap = ( positions . length !== distinctPositions . length ) ;
314- var barGroupWidth = minDiff * ( 1 - opts . gap ) ;
315314
316- var groupId = getAxisGroup ( fullLayout , pa . _id ) + calcTraces [ 0 ] [ 0 ] . trace . orientation ;
317- var alignmentGroups = fullLayout . _alignmentOpts [ groupId ] || { } ;
315+ var barGroupWidth = minDiff * ( 1 - opts . gap ) ;
316+ var barWidthPlusGap ;
317+ var barWidth ;
318+ var offsetFromCenter ;
319+ var alignmentGroups ;
320+ if ( pa . _id === 'angularaxis' ) {
321+ barWidthPlusGap = barGroupWidth ;
322+ barWidth = barWidthPlusGap * ( 1 - ( opts . groupgap || 0 ) ) ;
323+ offsetFromCenter = - barWidth / 2 ;
324+ } else { // collect groups and calculate values in loop below
325+ var groupId = getAxisGroup ( fullLayout , pa . _id ) + calcTraces [ 0 ] [ 0 ] . trace . orientation ;
326+ alignmentGroups = fullLayout . _alignmentOpts [ groupId ] || { } ;
327+ }
318328
319329 for ( var i = 0 ; i < nTraces ; i ++ ) {
320330 var calcTrace = calcTraces [ i ] ;
321331 var trace = calcTrace [ 0 ] . trace ;
332+ if ( pa . _id !== 'angularaxis' ) {
333+ var alignmentGroupOpts = alignmentGroups [ trace . alignmentgroup ] || { } ;
334+ var nOffsetGroups = Object . keys ( alignmentGroupOpts . offsetGroups || { } ) . length ;
322335
323- var alignmentGroupOpts = alignmentGroups [ trace . alignmentgroup ] || { } ;
324- var nOffsetGroups = Object . keys ( alignmentGroupOpts . offsetGroups || { } ) . length ;
325-
326- var barWidthPlusGap ;
327- if ( nOffsetGroups ) {
328- barWidthPlusGap = barGroupWidth / nOffsetGroups ;
329- } else {
330- barWidthPlusGap = overlap ? barGroupWidth / nTraces : barGroupWidth ;
331- }
336+ if ( nOffsetGroups ) {
337+ barWidthPlusGap = barGroupWidth / nOffsetGroups ;
338+ } else {
339+ barWidthPlusGap = overlap ? barGroupWidth / nTraces : barGroupWidth ;
340+ }
332341
333- var barWidth = barWidthPlusGap * ( 1 - ( opts . groupgap || 0 ) ) ;
342+ barWidth = barWidthPlusGap * ( 1 - ( opts . groupgap || 0 ) ) ;
334343
335- var offsetFromCenter ;
336- if ( nOffsetGroups ) {
337- offsetFromCenter = ( ( 2 * trace . _offsetIndex + 1 - nOffsetGroups ) * barWidthPlusGap - barWidth ) / 2 ;
338- } else {
339- offsetFromCenter = overlap ?
340- ( ( 2 * i + 1 - nTraces ) * barWidthPlusGap - barWidth ) / 2 :
341- - barWidth / 2 ;
344+ if ( nOffsetGroups ) {
345+ offsetFromCenter = ( ( 2 * trace . _offsetIndex + 1 - nOffsetGroups ) * barWidthPlusGap - barWidth ) / 2 ;
346+ } else {
347+ offsetFromCenter = overlap ?
348+ ( ( 2 * i + 1 - nTraces ) * barWidthPlusGap - barWidth ) / 2 :
349+ - barWidth / 2 ;
350+ }
342351 }
343352
344353 var t = calcTrace [ 0 ] . t ;
@@ -358,7 +367,11 @@ function setOffsetAndWidth(gd, pa, sieve, opts) {
358367 setBarCenterAndWidth ( pa , sieve ) ;
359368
360369 // update position axes
361- updatePositionAxis ( pa , sieve , overlap ) ;
370+ if ( pa . _id !== 'angularaxis' ) {
371+ updatePositionAxis ( pa , sieve ) ;
372+ } else {
373+ updatePositionAxis ( pa , sieve , overlap ) ;
374+ }
362375}
363376
364377function applyAttributes ( sieve ) {
@@ -579,7 +592,8 @@ function stackBars(sa, sieve, opts) {
579592
580593 isFunnel = ( fullTrace . type === 'funnel' ) ;
581594
582- var offset = calcTrace [ 0 ] . t . poffset ;
595+ var offset = fullTrace . type === 'barpolar' ? 0 : calcTrace [ 0 ] . t . poffset ;
596+
583597 var pts = [ ] ;
584598
585599 for ( j = 0 ; j < calcTrace . length ; j ++ ) {
0 commit comments