@@ -9,7 +9,7 @@ import {cell} from "./cell.js";
9
9
import { dot } from "./dot.js" ;
10
10
import { frame } from "./frame.js" ;
11
11
import { line , lineX , lineY } from "./line.js" ;
12
- import { rectX , rectY } from "./rect.js" ;
12
+ import { rect , rectX , rectY } from "./rect.js" ;
13
13
import { ruleX , ruleY } from "./rule.js" ;
14
14
15
15
export function autoSpec ( data , options ) {
@@ -91,10 +91,10 @@ export function autoSpec(data, options) {
91
91
break ;
92
92
case "line" :
93
93
markImpl =
94
- ( X && Y ) || xReduce || yReduce // same logic as area (see below), but default to line
95
- ? yZero || yReduce || ( X && isMonotonic ( X ) )
94
+ ( X && Y ) || xReduce != null || yReduce != null // same logic as area (see below), but default to line
95
+ ? yZero || yReduce != null || ( X && isMonotonic ( X ) )
96
96
? lineY
97
- : xZero || xReduce || ( Y && isMonotonic ( Y ) )
97
+ : xZero || xReduce != null || ( Y && isMonotonic ( Y ) )
98
98
? lineX
99
99
: line
100
100
: X // 1d line by index
@@ -104,7 +104,7 @@ export function autoSpec(data, options) {
104
104
if ( isHighCardinality ( C ) ) Z = null ; // TODO only if z not set by user
105
105
break ;
106
106
case "area" :
107
- markImpl = ! ( yZero || yReduce ) && ( xZero || xReduce || ( Y && isMonotonic ( Y ) ) ) ? areaX : areaY ; // favor areaY if unsure
107
+ markImpl = ! ( yZero || yReduce != null ) && ( xZero || xReduce != null || ( Y && isMonotonic ( Y ) ) ) ? areaX : areaY ; // favor areaY if unsure
108
108
colorMode = "fill" ;
109
109
if ( isHighCardinality ( C ) ) Z = null ; // TODO only if z not set by user
110
110
break ;
@@ -127,7 +127,11 @@ export function autoSpec(data, options) {
127
127
? barY
128
128
: isOrdinalReduced ( yReduce , Y )
129
129
? barX
130
- : rectY ;
130
+ : xReduce != null
131
+ ? rectX
132
+ : yReduce != null
133
+ ? rectY
134
+ : rect ;
131
135
colorMode = "fill" ;
132
136
break ;
133
137
default :
@@ -350,6 +354,7 @@ const impls = {
350
354
ruleY,
351
355
barX,
352
356
barY,
357
+ rect,
353
358
rectX,
354
359
rectY,
355
360
cell,
0 commit comments