Skip to content

Commit

Permalink
fix: invalid labelBaseline problem (#7147)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions Bot <vega-actions-bot@users.noreply.github.com>
  • Loading branch information
kanitw and GitHub Actions Bot committed Jan 4, 2021
1 parent 734e0b8 commit 59aace7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion examples/compiled/bar_negative_horizontal_label.vg.json
Expand Up @@ -173,7 +173,6 @@
"labelPadding": 4,
"ticks": false,
"labelAlign": "right",
"labelBaseline": null,
"zindex": 0
}
]
Expand Down
8 changes: 7 additions & 1 deletion src/compile/axis/assemble.ts
Expand Up @@ -5,7 +5,7 @@ import {POSITION_SCALE_CHANNELS} from '../../channel';
import {defaultTitle, FieldDefBase} from '../../channeldef';
import {Config} from '../../config';
import {isText} from '../../title';
import {getFirstDefined, isEmpty, replaceAll} from '../../util';
import {contains, getFirstDefined, isEmpty, replaceAll} from '../../util';
import {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';
import {exprFromValueOrSignalRef} from '../common';
import {Model} from '../model';
Expand Down Expand Up @@ -101,6 +101,12 @@ export function assembleAxis(
delete axis[prop];
} // else do nothing since the property already supports signal
}

// Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema
// Note that we need to use null so the default labelAlign is preserved.
if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) {
delete axis[prop];
}
}

if (kind === 'grid') {
Expand Down

0 comments on commit 59aace7

Please sign in to comment.