Skip to content

Commit d9f77f2

Browse files
committed
disallow scale type: "projection"
1 parent d70fd8b commit d9f77f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/scales.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,17 @@ function formatScaleType(type) {
302302
return typeof type === "symbol" ? type.description : type;
303303
}
304304

305+
// A special type symbol when the x and y scales are replaced with a projection.
306+
const typeProjection = {toString: () => "projection"};
307+
305308
function inferScaleType(key, channels, {type, domain, range, scheme, pivot, projection}) {
306309
// The facet scales are always band scales; this cannot be changed.
307310
if (key === "fx" || key === "fy") return "band";
308311

309312
// If a projection is specified, the x- and y-scales are disabled; these
310313
// channels will be projected rather than scaled. (But still check that none
311314
// of the associated channels are incompatible with a projection.)
312-
if ((key === "x" || key === "y") && projection != null) type = "projection";
315+
if ((key === "x" || key === "y") && projection != null) type = typeProjection;
313316

314317
// If a channel dictates a scale type, make sure that it is consistent with
315318
// the user-specified scale type (if any) and all other channels. For example,
@@ -321,7 +324,7 @@ function inferScaleType(key, channels, {type, domain, range, scheme, pivot, proj
321324
}
322325

323326
// If the scale, a channel, or user specified a (consistent) type, return it.
324-
if (type === "projection") return;
327+
if (type === typeProjection) return;
325328
if (type !== undefined) return type;
326329

327330
// If there’s no data (and no type) associated with this scale, don’t create a scale.

0 commit comments

Comments
 (0)