@@ -302,14 +302,17 @@ function formatScaleType(type) {
302
302
return typeof type === "symbol" ? type . description : type ;
303
303
}
304
304
305
+ // A special type symbol when the x and y scales are replaced with a projection.
306
+ const typeProjection = { toString : ( ) => "projection" } ;
307
+
305
308
function inferScaleType ( key , channels , { type, domain, range, scheme, pivot, projection} ) {
306
309
// The facet scales are always band scales; this cannot be changed.
307
310
if ( key === "fx" || key === "fy" ) return "band" ;
308
311
309
312
// If a projection is specified, the x- and y-scales are disabled; these
310
313
// channels will be projected rather than scaled. (But still check that none
311
314
// 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 ;
313
316
314
317
// If a channel dictates a scale type, make sure that it is consistent with
315
318
// 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
321
324
}
322
325
323
326
// If the scale, a channel, or user specified a (consistent) type, return it.
324
- if ( type === "projection" ) return ;
327
+ if ( type === typeProjection ) return ;
325
328
if ( type !== undefined ) return type ;
326
329
327
330
// If there’s no data (and no type) associated with this scale, don’t create a scale.
0 commit comments