@@ -56,33 +56,46 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) {
5656 if ( ! groupName ) groupName = fallbackGroupName ;
5757
5858 var axType = getAxisType ( traceOut , binDir ) ;
59+ var calendar = traceOut [ binDir + 'calendar' ] ;
5960 var binOpts = allBinOpts [ groupName ] ;
61+ var needsNewItem = true ;
6062
6163 if ( binOpts ) {
62- if ( axType === binOpts . axType ) {
64+ if ( axType === binOpts . axType && calendar === binOpts . calendar ) {
65+ needsNewItem = false ;
6366 binOpts . traces . push ( traceOut ) ;
6467 binOpts . dirs . push ( binDir ) ;
6568 } else {
6669 groupName = fallbackGroupName ;
67- allBinOpts [ groupName ] = {
68- traces : [ traceOut ] ,
69- dirs : [ binDir ] ,
70- axType : axType
71- } ;
72- Lib . warn ( [
73- 'Attempted to group the bins of trace' , traceOut . index ,
74- 'set on a' , 'type:' + axType , 'axis' ,
75- 'with bins on' , 'type:' + binOpts . axType , 'axis.'
76- ] . join ( ' ' ) ) ;
70+
71+ if ( axType !== binOpts . axType ) {
72+ Lib . warn ( [
73+ 'Attempted to group the bins of trace' , traceOut . index ,
74+ 'set on a' , 'type:' + axType , 'axis' ,
75+ 'with bins on' , 'type:' + binOpts . axType , 'axis.'
76+ ] . join ( ' ' ) ) ;
77+ }
78+ if ( calendar !== binOpts . calendar ) {
79+ // prohibit bingroup for traces using different calendar,
80+ // there's probably a way to make this work, but skip for now
81+ Lib . warn ( [
82+ 'Attempted to group the bins of trace' , traceOut . index ,
83+ 'set with a' , calendar , 'calendar' ,
84+ 'with bins' ,
85+ ( binOpts . calendar ? 'on a ' + binOpts . calendar + ' calendar' : 'w/o a set calendar' )
86+ ] . join ( ' ' ) ) ;
87+ }
7788 }
78- } else {
79- binOpts = allBinOpts [ groupName ] = {
89+ }
90+
91+ if ( needsNewItem ) {
92+ allBinOpts [ groupName ] = {
8093 traces : [ traceOut ] ,
8194 dirs : [ binDir ] ,
82- axType : axType
95+ axType : axType ,
96+ calendar : traceOut [ binDir + 'calendar' ] || ''
8397 } ;
8498 }
85-
8699 traceOut [ '_' + binDir + 'bingroup' ] = groupName ;
87100 }
88101
0 commit comments