Skip to content

Commit 936bdd8

Browse files
committed
a human fix: when y is undefined, default to y: reduce
1 parent aa0ba22 commit 936bdd8

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/marks/area.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {area as shapeArea} from "d3";
22
import {create} from "../context.js";
33
import {maybeCurve} from "../curve.js";
44
import {Mark} from "../mark.js";
5-
import {first, identity, indexOf, maybeZ, second} from "../options.js";
5+
import {first, indexOf, maybeZ, second} from "../options.js";
66
import {
77
applyDirectStyles,
88
applyIndirectStyles,
@@ -77,15 +77,11 @@ export function area(data, options) {
7777
}
7878

7979
export function areaX(data, options) {
80-
const {y = indexOf, ...rest} = maybeDenseIntervalY(
81-
options?.interval != null ? {...options, x: options.x ?? identity} : options
82-
);
80+
const {y = indexOf, ...rest} = maybeDenseIntervalY(options);
8381
return new Area(data, maybeStackX(maybeIdentityX({...rest, y1: y, y2: undefined}, y === indexOf ? "x2" : "x")));
8482
}
8583

8684
export function areaY(data, options) {
87-
const {x = indexOf, ...rest} = maybeDenseIntervalX(
88-
options?.interval != null ? {...options, y: options.y ?? identity} : options
89-
);
85+
const {x = indexOf, ...rest} = maybeDenseIntervalX(options);
9086
return new Area(data, maybeStackY(maybeIdentityY({...rest, x1: x, x2: undefined}, x === indexOf ? "y2" : "y")));
9187
}

src/transforms/bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function maybeDenseInterval(bin, k, options = {}) {
7171
if (options?.interval == null) return options;
7272
const {reduce = reduceFirst} = options;
7373
const outputs = {filter: null};
74-
if (options[k] != null) outputs[k] = reduce;
74+
if (options[k] !== null) outputs[k] = reduce;
7575
if (options[`${k}1`] != null) outputs[`${k}1`] = reduce;
7676
if (options[`${k}2`] != null) outputs[`${k}2`] = reduce;
7777
return bin(outputs, options);

0 commit comments

Comments
 (0)