diff --git a/src/compile/mark/encode/defined.ts b/src/compile/mark/encode/defined.ts index 7b0f9bfdcd7..a73fcd4f99b 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 355e6971eb7..e1baae809f0 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', () => {