Skip to content

Commit

Permalink
fix: set binSuffix for defined channel (vega#7973)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Rosenzweig <paul.a.rosenzweig@gmail.com>
Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
  • Loading branch information
3 people authored and BradyJ27 committed Oct 19, 2023
1 parent 1d48060 commit 9a45757
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compile/mark/encode/defined.ts
Expand Up @@ -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)) {
Expand Down
4 changes: 4 additions & 0 deletions test/compile/mark/area.test.ts
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 9a45757

Please sign in to comment.