Skip to content

Commit

Permalink
Fix: check only run config.numberFormat on quantitative types (vega…
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh authored and BradyJ27 committed Oct 19, 2023
1 parent 8fef285 commit 7b8278d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/compile/legend/encode.ts
Expand Up @@ -160,7 +160,13 @@ export function labels(specifiedlabelsSpec: any, {fieldOrDatumDef, model, channe
formatType,
config
});
} else if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) {
} else if (
fieldOrDatumDef.type === 'quantitative' &&
format === undefined &&
formatType === undefined &&
config.customFormatTypes &&
config.numberFormatType
) {
text = formatCustomType({
fieldOrDatumDef,
field: 'datum.value',
Expand Down
2 changes: 1 addition & 1 deletion test/compile/legend/encode.test.ts
Expand Up @@ -170,7 +170,7 @@ describe('compile/legend', () => {
it('returns correct expression for custom format Type from config.numberFormatType', () => {
const fieldDef: Encoding<string>['color'] = {
field: 'a',
type: 'temporal'
type: 'quantitative'
};

const model = parseUnitModelWithScale({
Expand Down

0 comments on commit 7b8278d

Please sign in to comment.