diff --git a/src/compile/mark/encode/offset.ts b/src/compile/mark/encode/offset.ts index 5888345445d..1153a3e282c 100644 --- a/src/compile/mark/encode/offset.ts +++ b/src/compile/mark/encode/offset.ts @@ -57,7 +57,7 @@ export function positionOffset({ } const markDefOffsetValue = markDef[channel]; - if (markDefOffsetValue) { + if (markDefOffsetValue !== undefined) { return {offsetType: 'visual', offset: markDefOffsetValue}; } diff --git a/src/compile/mark/encode/position-rect.ts b/src/compile/mark/encode/position-rect.ts index 59f4899e9e6..c33ff4f574f 100644 --- a/src/compile/mark/encode/position-rect.ts +++ b/src/compile/mark/encode/position-rect.ts @@ -302,6 +302,7 @@ function rectBinPosition({ const vgChannel2 = getVgPositionChannel(channel2); const {offset} = positionOffset({channel, markDef, encoding, model, bandPosition: 0}); + const {offset: offset2} = positionOffset({channel: channel2, markDef, encoding, model, bandPosition: 0}); const bandPosition = isSignalRef(bandSize) ? {signal: `(1-${bandSize.signal})/2`} @@ -315,7 +316,7 @@ function rectBinPosition({ fieldDef, scaleName, bandPosition, - offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset) + offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset2 ?? offset) }), [vgChannel]: rectBinRef({ fieldDef,