66* LICENSE file in the root directory of this source tree.
77*/
88
9-
109'use strict' ;
1110
1211var Registry = require ( '../../registry' ) ;
@@ -15,8 +14,9 @@ var Lib = require('../../lib');
1514
1615var layoutAttributes = require ( './layout_attributes' ) ;
1716
18-
1917module . exports = function ( layoutIn , layoutOut , fullData ) {
18+ var i , trace ;
19+
2020 function coerce ( attr , dflt ) {
2121 return Lib . coerce ( layoutIn , layoutOut , layoutAttributes , attr , dflt ) ;
2222 }
@@ -25,9 +25,10 @@ module.exports = function(layoutIn, layoutOut, fullData) {
2525 var shouldBeGapless = false ;
2626 var gappedAnyway = false ;
2727 var usedSubplots = { } ;
28+ var tracesWithGroupAttrs = [ ] ;
2829
29- for ( var i = 0 ; i < fullData . length ; i ++ ) {
30- var trace = fullData [ i ] ;
30+ for ( i = 0 ; i < fullData . length ; i ++ ) {
31+ trace = fullData [ i ] ;
3132 if ( Registry . traceIs ( trace , 'bar' ) && trace . visible ) hasBars = true ;
3233 else continue ;
3334
@@ -44,6 +45,10 @@ module.exports = function(layoutIn, layoutOut, fullData) {
4445 trace [ trace . orientation === 'v' ? 'xaxis' : 'yaxis' ] ) ;
4546 if ( pa . type !== 'category' ) shouldBeGapless = true ;
4647 }
48+
49+ if ( trace . alignmentgroup || trace . offsetgroup ) {
50+ tracesWithGroupAttrs . push ( trace ) ;
51+ }
4752 }
4853
4954 if ( ! hasBars ) return ;
@@ -53,4 +58,12 @@ module.exports = function(layoutIn, layoutOut, fullData) {
5358
5459 coerce ( 'bargap' , ( shouldBeGapless && ! gappedAnyway ) ? 0 : 0.2 ) ;
5560 coerce ( 'bargroupgap' ) ;
61+
62+ if ( mode !== 'group' ) {
63+ for ( i = 0 ; i < tracesWithGroupAttrs . length ; i ++ ) {
64+ trace = tracesWithGroupAttrs [ i ] ;
65+ delete trace . alignmentgroup ;
66+ delete trace . offsetgroup ;
67+ }
68+ }
5669} ;
0 commit comments