From 09a407a55165654df6bf10575b24734647d152af Mon Sep 17 00:00:00 2001 From: Yclept Nemo Date: Sun, 31 Jan 2021 05:10:23 -0500 Subject: [PATCH] fix: allow axis settings when ("bin":"binned"). (#7192) Before, any axis blocks would be dropped from the resulting Vega, including any axis settings. After, mirror the behavior of ("bin":true) - axis settings cause the axis block to be included. This because I wanted grid lines to accompany my pre-binned data. Co-authored-by: Yclept Nemo --- src/compile/axis/properties.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/compile/axis/properties.ts b/src/compile/axis/properties.ts index 0fb9d30862..9245689d6b 100644 --- a/src/compile/axis/properties.ts +++ b/src/compile/axis/properties.ts @@ -56,13 +56,8 @@ export const axisRules: { return guideFormatType(formatType, fieldOrDatumDef, scaleType); }, - grid: ({fieldOrDatumDef, axis, scaleType}) => { - if (isFieldDef(fieldOrDatumDef) && isBinned(fieldOrDatumDef.bin)) { - return false; - } else { - return axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef); - } - }, + grid: ({fieldOrDatumDef, axis, scaleType}) => + axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef), gridScale: ({model, channel}) => gridScale(model, channel), @@ -125,7 +120,7 @@ export const axisRules: { */ export function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef) { - return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin); + return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin); } export function gridScale(model: UnitModel, channel: PositionScaleChannel) {