From 1f1d184a1cf3e71d8006cc20756570aee694f07e Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Wed, 9 Feb 2022 10:56:15 -0500 Subject: [PATCH] fix: set binSuffix for defined channel (#7973) Co-authored-by: Paul Rosenzweig Co-authored-by: GitHub Actions Bot --- src/compile/mark/encode/defined.ts | 2 +- test/compile/mark/area.test.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compile/mark/encode/defined.ts b/src/compile/mark/encode/defined.ts index 7b0f9bfdcd..a73fcd4f99 100644 --- a/src/compile/mark/encode/defined.ts +++ b/src/compile/mark/encode/defined.ts @@ -30,7 +30,7 @@ function allFieldsInvalidPredicate( const scaleComponent = model.getScaleComponent(channel); if (scaleComponent) { const scaleType = scaleComponent.get('type'); - const field = model.vgField(channel, {expr: 'datum'}); + const field = model.vgField(channel, {expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined}); // While discrete domain scales can handle invalid values, continuous scales can't. if (field && hasContinuousDomain(scaleType)) { diff --git a/test/compile/mark/area.test.ts b/test/compile/mark/area.test.ts index 355e6971eb..e1baae809f 100644 --- a/test/compile/mark/area.test.ts +++ b/test/compile/mark/area.test.ts @@ -53,6 +53,10 @@ describe('Mark: Area', () => { it('should use bin_mid for x', () => { expect(props.x).toEqual({field: 'bin_maxbins_10_IMDB_Rating_mid', scale: 'x'}); }); + + it('should use bin_mid for the defined check', () => { + expect(props.defined['signal']).toContain('bin_maxbins_10_IMDB_Rating_mid'); + }); }); describe('vertical area, with zero=false', () => {