@@ -115,28 +115,28 @@ export function autoSpec(data, options) {
115
115
case "bar" :
116
116
markImpl =
117
117
colorReduce != null || sizeReduce != null // bin or group on both x and y
118
- ? maybeIsOrdinal ( X ) && maybeIsOrdinal ( Y )
118
+ ? X && isOrdinal ( X ) && Y && isOrdinal ( Y )
119
119
? cell
120
- : maybeIsOrdinal ( X )
120
+ : X && isOrdinal ( X )
121
121
? barY
122
- : maybeIsOrdinal ( Y )
122
+ : Y && isOrdinal ( Y )
123
123
? barX
124
124
: rect
125
125
: xReduce != null // bin or group on y
126
126
? isOrdinal ( Y )
127
- ? isSelectReducer ( xReduce ) && maybeIsOrdinal ( X )
127
+ ? isSelectReducer ( xReduce ) && X && isOrdinal ( X )
128
128
? cell
129
129
: barX
130
130
: rectX
131
131
: yReduce != null // bin or group on x
132
132
? isOrdinal ( X )
133
- ? isSelectReducer ( yReduce ) && maybeIsOrdinal ( Y )
133
+ ? isSelectReducer ( yReduce ) && Y && isOrdinal ( Y )
134
134
? cell
135
135
: barY
136
136
: rectY
137
- : maybeIsNumeric ( X ) && ! maybeIsNumeric ( Y )
137
+ : X && isNumeric ( X ) && ! ( Y && isNumeric ( Y ) )
138
138
? barX // if y is temporal, treat as ordinal
139
- : maybeIsNumeric ( Y ) && ! maybeIsNumeric ( X )
139
+ : Y && isNumeric ( Y ) && ! ( X && isNumeric ( X ) )
140
140
? barY // if x is temporal, treat as ordinal
141
141
: cell ;
142
142
colorMode = "fill" ;
@@ -305,16 +305,6 @@ function isSelectReducer(reduce) {
305
305
return / ^ (?: f i r s t | l a s t | m o d e ) $ / i. test ( reduce ) ;
306
306
}
307
307
308
- // We can’t infer the type of a custom reducer without invoking it, so
309
- // assume most reducers produce quantitative values.
310
- function maybeIsOrdinal ( values ) {
311
- return values != null && isOrdinal ( values ) ;
312
- }
313
-
314
- function maybeIsNumeric ( values ) {
315
- return values != null && isNumeric ( values ) ;
316
- }
317
-
318
308
// https://github.com/observablehq/plot/blob/818562649280e155136f730fc496e0b3d15ae464/src/transforms/group.js#L236
319
309
function isReducer ( reduce ) {
320
310
if ( reduce == null ) return false ;
0 commit comments