diff --git a/src/compile/mark/encode/position-rect.ts b/src/compile/mark/encode/position-rect.ts index b2229b1433b..9f88743be9a 100644 --- a/src/compile/mark/encode/position-rect.ts +++ b/src/compile/mark/encode/position-rect.ts @@ -153,7 +153,11 @@ function positionAndSize( // Use size encoding / mark property / config if it exists let sizeMixins; - if (encoding.size || markDef.size) { + + // TODO(@kanitw): this sizeMixins logic here is a bit convoluted. + // It's sometimes set in the defaultSizeRef below and sometimes up here. + // We should refactor this logic to be simpler. + if (encoding.size || (markDef.size && !isRelativeBandSize(markDef.size))) { if (useVlSizeChannel) { sizeMixins = nonPosition('size', model, { vgChannel: vgSizeChannel, diff --git a/src/mark.ts b/src/mark.ts index 77bcd40dc5e..fa2dd8374b4 100644 --- a/src/mark.ts +++ b/src/mark.ts @@ -128,7 +128,7 @@ export interface VLOnlyMarkConfig extends ColorM export interface MarkConfig extends VLOnlyMarkConfig, - MapExcludeValueRefAndReplaceSignalWith, ES> { + MapExcludeValueRefAndReplaceSignalWith, ES> { // ========== Overriding Vega ========== /** @@ -147,7 +147,7 @@ export interface MarkConfig /** * Default size for marks. * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value. - * - For `bar`, this represents the band size of the bar, in pixels. + * - For `bar`, this represents the band size of the bar, in pixels, or relative band size (e.g., `{"band": 0.5}` is half of the band). * - For `text`, this represents the font size, in pixels. * * __Default value:__ @@ -158,7 +158,7 @@ export interface MarkConfig * * @minimum 0 */ - size?: number | ES; // size works beyond symbol marks in VL + size?: number | ES | RelativeBandSize; // Unlike in VG where size is only for symbol marks (point in VL), size works beyond symbol marks in VL /** * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`.