@@ -56,33 +56,46 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) {
56
56
if ( ! groupName ) groupName = fallbackGroupName ;
57
57
58
58
var axType = getAxisType ( traceOut , binDir ) ;
59
+ var calendar = traceOut [ binDir + 'calendar' ] ;
59
60
var binOpts = allBinOpts [ groupName ] ;
61
+ var needsNewItem = true ;
60
62
61
63
if ( binOpts ) {
62
- if ( axType === binOpts . axType ) {
64
+ if ( axType === binOpts . axType && calendar === binOpts . calendar ) {
65
+ needsNewItem = false ;
63
66
binOpts . traces . push ( traceOut ) ;
64
67
binOpts . dirs . push ( binDir ) ;
65
68
} else {
66
69
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
+ }
77
88
}
78
- } else {
79
- binOpts = allBinOpts [ groupName ] = {
89
+ }
90
+
91
+ if ( needsNewItem ) {
92
+ allBinOpts [ groupName ] = {
80
93
traces : [ traceOut ] ,
81
94
dirs : [ binDir ] ,
82
- axType : axType
95
+ axType : axType ,
96
+ calendar : traceOut [ binDir + 'calendar' ] || ''
83
97
} ;
84
98
}
85
-
86
99
traceOut [ '_' + binDir + 'bingroup' ] = groupName ;
87
100
}
88
101
0 commit comments