Skip to content

Commit e249d6c

Browse files
committed
fix maybeBooleanRange
1 parent b72416c commit e249d6c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/scales/ordinal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function ScaleOrdinal(key, channels, {
4444
range = range === undefined ? inferSymbolRange(hint) : Array.from(range, maybeSymbol);
4545
} else if (registry.get(key) === color) {
4646
if (range === undefined && (type === "ordinal" || type === ordinalImplicit)) {
47-
range = maybeBooleanRange(domain, scheme === undefined ? "greys" : scheme);
47+
range = maybeBooleanRange(domain, scheme);
4848
if (range !== undefined) scheme = undefined; // Don’t re-apply scheme.
4949
}
5050
if (scheme === undefined && range === undefined) {

src/scales/schemes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ export function ordinalRange(scheme, length) {
189189
// If the specified domain contains only booleans (ignoring null and undefined),
190190
// returns a corresponding range where false is mapped to the low color and true
191191
// is mapped to the high color of the specified scheme.
192-
export function maybeBooleanRange(domain, scheme) {
192+
export function maybeBooleanRange(domain, scheme = "greys") {
193193
const range = new Set();
194-
const [f, t] = ordinalScheme(scheme)({length: 2});
194+
const [f, t] = ordinalRange(scheme, 2);
195195
for (const value of domain) {
196196
if (value == null) continue;
197197
if (value === true) range.add(t);

0 commit comments

Comments
 (0)