diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 25ef97d37d..fb7e76704d 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -856,14 +856,14 @@ ], "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -3118,7 +3118,7 @@ "$ref": "#/definitions/ExprRef" } ], - "description": "- For vertical bars, top-left and top-right corner radius. - For horizontal bars, top-right and bottom-right corner radius." + "description": "- For vertical bars, top-left and top-right corner radius.\n\n- For horizontal bars, top-right and bottom-right corner radius." }, "cornerRadiusTopLeft": { "anyOf": [ @@ -3176,9 +3176,16 @@ ] }, "discreteBandSize": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/RelativeBandSize" + } + ], "description": "The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.", - "minimum": 0, - "type": "number" + "minimum": 0 }, "dx": { "anyOf": [ @@ -3668,14 +3675,14 @@ ], "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -5707,8 +5714,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -5800,8 +5807,8 @@ { "additionalProperties": false, "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -5874,8 +5881,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -5967,8 +5974,8 @@ { "additionalProperties": false, "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -6039,8 +6046,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -6710,8 +6717,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -6799,8 +6806,8 @@ { "additionalProperties": false, "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -6869,8 +6876,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -6958,8 +6965,8 @@ { "additionalProperties": false, "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -7026,8 +7033,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -7789,8 +7796,8 @@ "DatumDef": { "additionalProperties": false, "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -8567,8 +8574,8 @@ ], "description": "The alignment to apply to grid rows and columns. The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\nAlternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n\n__Default value:__ `\"all\"`." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -8689,8 +8696,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9470,8 +9477,8 @@ "additionalProperties": false, "description": "A FieldDef with Condition { condition: {value: ...}, field: ..., ... }", "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9518,8 +9525,8 @@ "additionalProperties": false, "description": "A FieldDef with Condition { condition: {value: ...}, field: ..., ... }", "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9566,8 +9573,8 @@ "additionalProperties": false, "description": "A FieldDef with Condition { condition: {value: ...}, field: ..., ... }", "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9614,8 +9621,8 @@ "additionalProperties": false, "description": "A FieldDef with Condition { condition: {value: ...}, field: ..., ... }", "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9666,8 +9673,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9767,8 +9774,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9868,8 +9875,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -9969,8 +9976,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -10066,8 +10073,8 @@ "additionalProperties": false, "description": "A FieldDef with Condition { condition: {value: ...}, field: ..., ... }", "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -10133,8 +10140,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -10227,8 +10234,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -12062,8 +12069,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -14756,14 +14763,14 @@ ], "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -15854,14 +15861,14 @@ ], "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -16138,7 +16145,7 @@ "$ref": "#/definitions/ExprRef" } ], - "description": "- For vertical bars, top-left and top-right corner radius. - For horizontal bars, top-right and bottom-right corner radius." + "description": "- For vertical bars, top-left and top-right corner radius.\n\n- For horizontal bars, top-right and bottom-right corner radius." }, "cornerRadiusTopLeft": { "anyOf": [ @@ -16196,9 +16203,16 @@ ] }, "discreteBandSize": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/RelativeBandSize" + } + ], "description": "The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.", - "minimum": 0, - "type": "number" + "minimum": 0 }, "dx": { "anyOf": [ @@ -16315,13 +16329,16 @@ "height": { "anyOf": [ { - "description": "Height of the marks.", "type": "number" }, { "$ref": "#/definitions/ExprRef" + }, + { + "$ref": "#/definitions/RelativeBandSize" } - ] + ], + "description": "Height of the marks. One of:\n\n- A number representing a fixed pixel height.\n\n- A relative band size definition. For example, `{band: 0.5}` represents half of the band" }, "href": { "anyOf": [ @@ -16755,14 +16772,14 @@ "minimum": 0, "type": "number" }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -16804,13 +16821,16 @@ "width": { "anyOf": [ { - "description": "Width of the marks.", "type": "number" }, { "$ref": "#/definitions/ExprRef" + }, + { + "$ref": "#/definitions/RelativeBandSize" } - ] + ], + "description": "Width of the marks. One of:\n\n- A number representing a fixed pixel width.\n\n- A relative band size definition. For example, `{band: 0.5}` represents half of the band." }, "x": { "anyOf": [ @@ -17229,8 +17249,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -18085,14 +18105,14 @@ ], "description": "Offset for theta." }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -18502,8 +18522,8 @@ ], "description": "An object defining properties of axis's gridlines, ticks and labels. If `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -18571,8 +18591,8 @@ "PositionDatumDefBase": { "additionalProperties": false, "properties": { - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -18657,8 +18677,8 @@ ], "description": "An object defining properties of axis's gridlines, ticks and labels. If `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -18761,8 +18781,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -19664,9 +19684,16 @@ ] }, "discreteBandSize": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/definitions/RelativeBandSize" + } + ], "description": "The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.", - "minimum": 0, - "type": "number" + "minimum": 0 }, "dx": { "anyOf": [ @@ -20156,14 +20183,14 @@ ], "description": "The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise." }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -20335,6 +20362,19 @@ ], "type": "object" }, + "RelativeBandSize": { + "additionalProperties": false, + "properties": { + "band": { + "description": "The relative band size. For example `0.5` means half of the band scale's band width.", + "type": "number" + } + }, + "required": [ + "band" + ], + "type": "object" + }, "RepeatMapping": { "additionalProperties": false, "properties": { @@ -20454,8 +20494,8 @@ "$ref": "#/definitions/LayoutAlign", "description": "The alignment to apply to row/column facet's subplot. The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n\n- For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n\n__Default value:__ `\"all\"`." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -21249,8 +21289,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -21818,8 +21858,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -21977,8 +22017,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22142,8 +22182,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22285,8 +22325,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22450,8 +22490,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22609,8 +22649,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22738,8 +22778,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22802,8 +22842,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22879,8 +22919,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -22965,8 +23005,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23042,8 +23082,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23128,8 +23168,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23304,8 +23344,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23442,8 +23482,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23528,8 +23568,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23690,8 +23730,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -23849,8 +23889,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24014,8 +24054,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24176,8 +24216,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24335,8 +24375,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24494,8 +24534,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24646,8 +24686,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24784,8 +24824,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -24890,8 +24930,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25030,8 +25070,8 @@ ], "description": "An object defining properties of axis's gridlines, ticks and labels. If `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25179,8 +25219,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25265,8 +25305,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25315,8 +25355,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25376,8 +25416,8 @@ ], "description": "An object defining properties of axis's gridlines, ticks and labels. If `null`, the axis for the encoding channel will be removed.\n\n__Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n\n__See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25525,8 +25565,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25611,8 +25651,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -25661,8 +25701,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -26017,8 +26057,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" @@ -26950,14 +26990,14 @@ "minimum": 0, "type": "number" }, - "timeUnitBand": { - "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", - "type": "number" - }, "timeUnitBandPosition": { "description": "Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. If set to `0.5`, the marks will be positioned in the middle of the time unit band step.", "type": "number" }, + "timeUnitBandSize": { + "description": "Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. If set to `0.5`, bandwidth of the marks will be half of the time unit band step.", + "type": "number" + }, "tooltip": { "anyOf": [ { @@ -29104,8 +29144,8 @@ "$ref": "#/definitions/Aggregate", "description": "Aggregation function for the field (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n\n__Default value:__ `undefined` (None)\n\n__See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation." }, - "band": { - "description": "For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval.\n\nFor other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band.", + "bandPosition": { + "description": "Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.", "maximum": 1, "minimum": 0, "type": "number" diff --git a/examples/compiled/scatter_image.vg.json b/examples/compiled/scatter_image.vg.json index c61dce660e..4bfe28fce6 100644 --- a/examples/compiled/scatter_image.vg.json +++ b/examples/compiled/scatter_image.vg.json @@ -33,13 +33,13 @@ "from": {"data": "data_0"}, "encode": { "update": { - "width": {"value": 50}, - "height": {"value": 50}, "description": { "signal": "\"x: \" + (format(datum[\"x\"], \"\")) + \"; y: \" + (format(datum[\"y\"], \"\")) + \"; img: \" + (isValid(datum[\"img\"]) ? datum[\"img\"] : \"\"+datum[\"img\"])" }, "xc": {"scale": "x", "field": "x"}, + "width": {"value": 50}, "yc": {"scale": "y", "field": "y"}, + "height": {"value": 50}, "url": { "signal": "isValid(datum[\"img\"]) ? datum[\"img\"] : \"\"+datum[\"img\"]" } diff --git a/examples/specs/bar_axis_space_saving.vl.json b/examples/specs/bar_axis_space_saving.vl.json index 69d165608b..607f1e2557 100644 --- a/examples/specs/bar_axis_space_saving.vl.json +++ b/examples/specs/bar_axis_space_saving.vl.json @@ -3,12 +3,11 @@ "description": "Bar Chart with a spacing-saving y-axis", "data": {"url": "data/cars.json"}, "height": {"step": 50}, - "mark": {"type": "bar", "yOffset": 5, "cornerRadiusEnd": 2}, + "mark": {"type": "bar", "yOffset": 5, "cornerRadiusEnd": 2, "height": {"band": 0.5}}, "encoding": { "y": { "field": "Origin", "scale": {"padding": 0}, - "band": 0.5, "axis": { "bandPosition": 0, "grid": true, diff --git a/examples/specs/bar_month_band.vl.json b/examples/specs/bar_month_band.vl.json index 26e5e2a011..9dfc4fc434 100644 --- a/examples/specs/bar_month_band.vl.json +++ b/examples/specs/bar_month_band.vl.json @@ -1,12 +1,11 @@ { "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": {"url": "data/seattle-weather.csv"}, - "mark": "bar", + "mark": {"type": "bar", "width": {"band": 0.7}}, "encoding": { "x": { "timeUnit": "month", - "field": "date", - "band": 0.7 + "field": "date" }, "y": { "aggregate": "mean", diff --git a/examples/specs/bar_month_band_config.vl.json b/examples/specs/bar_month_band_config.vl.json index 49016964ec..6cab7a236c 100644 --- a/examples/specs/bar_month_band_config.vl.json +++ b/examples/specs/bar_month_band_config.vl.json @@ -14,7 +14,7 @@ }, "config": { "mark": { - "timeUnitBand": 0.7 + "timeUnitBandSize": 0.7 } } } diff --git a/examples/specs/circle_wilkinson_dotplot_stacked.vl.json b/examples/specs/circle_wilkinson_dotplot_stacked.vl.json index 4d3d0b5474..773fe06743 100644 --- a/examples/specs/circle_wilkinson_dotplot_stacked.vl.json +++ b/examples/specs/circle_wilkinson_dotplot_stacked.vl.json @@ -16,7 +16,7 @@ "mark": "circle", "encoding": { "x": {"field": "data", "type": "ordinal"}, - "y": {"aggregate": "count", "stack": true, "band": 0.5}, + "y": {"aggregate": "count", "stack": true, "bandPosition": 0.5}, "detail": {"field": "id"} } } diff --git a/examples/specs/line_month_center_band.vl.json b/examples/specs/line_month_center_band.vl.json index 4eff003dd6..d0a5894eec 100644 --- a/examples/specs/line_month_center_band.vl.json +++ b/examples/specs/line_month_center_band.vl.json @@ -7,7 +7,7 @@ "interpolate": "monotone" }, "encoding": { - "x": {"timeUnit": "month", "field": "date", "band": 0.5}, + "x": {"timeUnit": "month", "field": "date", "bandPosition": 0.5}, "y": {"aggregate": "mean", "field": "temp_max"} } } diff --git a/site/docs/mark/bar.md b/site/docs/mark/bar.md index 3b21812be1..ecd56d8ab0 100644 --- a/site/docs/mark/bar.md +++ b/site/docs/mark/bar.md @@ -47,7 +47,7 @@ Bar marks are useful in many visualizations, including bar charts, [stacked bar A bar mark definition can contain any [standard mark properties](mark.html#mark-def) and the following special properties: -{% include table.html props="orient,align,baseline,binSpacing,cornerRadius,cornerRadiusEnd,cornerRadiusTopLeft,cornerRadiusTopRight,cornerRadiusBottomRight,cornerRadiusBottomLeft" source="MarkDef" %} +{% include table.html props="width,height,orient,align,baseline,binSpacing,cornerRadius,cornerRadiusEnd,cornerRadiusTopLeft,cornerRadiusTopRight,cornerRadiusBottomRight,cornerRadiusBottomLeft" source="MarkDef" %} ## Examples @@ -63,10 +63,22 @@ If we map a different discrete field to the `y` channel, we can produce a horizo +### Bar Chart with a Temporal Axis + While the `bar` mark typically uses the x and y channels to encode a pair of discrete and continuous fields, it can also be used with continuous fields on both channels. For example, given a bar chart with a temporal field on x, we can see that the x-scale is a continuous scale. By default, the size of bars on continuous scales will be set based on the [`continuousBandSize` config](#config). +{.#bar-width} + +### Relative Bar Width + +To adjust the bar to be smaller than the time unit step, you can adjust the bar's width to be a proportion of band. For example, the following chart sets the width to be 70% of the x band width. + + + +### Bar Chart with a Discrete Temporal Axis + If you want to use a discrete scale instead, you can cast the field to have an `"ordinal"` type. This casting strategy can be useful for time units with low cardinality such as `"month"`. diff --git a/site/docs/mark/rect.md b/site/docs/mark/rect.md index 8eb16320ff..6c5c09044e 100644 --- a/site/docs/mark/rect.md +++ b/site/docs/mark/rect.md @@ -47,7 +47,7 @@ The `rect` mark represents an arbitrary rectangle. A rect mark definition can contain any [standard mark properties](mark.html#mark-def) and the following special properties: -{% include table.html props="align,baseline,cornerRadius" source="MarkConfig" %} +{% include table.html props="width,height,align,baseline,cornerRadius" source="MarkConfig" %} ## Examples diff --git a/src/channeldef.ts b/src/channeldef.ts index 0b65ddd097..2defd1e4c3 100644 --- a/src/channeldef.ts +++ b/src/channeldef.ts @@ -1,4 +1,4 @@ -import {Gradient, SignalRef, Text} from 'vega'; +import {Gradient, ScaleType, SignalRef, Text} from 'vega'; import {isArray, isBoolean, isNumber, isString} from 'vega-util'; import {Aggregate, isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp} from './aggregate'; import {Axis} from './axis'; @@ -14,6 +14,7 @@ import { FACET, FILL, FILLOPACITY, + getSizeChannel, HREF, isScaleChannel, isSecondaryRangeChannel, @@ -25,6 +26,8 @@ import { LONGITUDE2, OPACITY, ORDER, + PolarPositionScaleChannel, + PositionScaleChannel, RADIUS, RADIUS2, ROW, @@ -44,7 +47,7 @@ import { Y, Y2 } from './channel'; -import {getMarkConfig} from './compile/common'; +import {getMarkConfig, getMarkPropOrConfig} from './compile/common'; import {isCustomFormatType} from './compile/format'; import {CompositeAggregate} from './compositemark'; import {Config} from './config'; @@ -56,12 +59,12 @@ import {ImputeParams} from './impute'; import {Legend} from './legend'; import * as log from './log'; import {LogicalComposition} from './logical'; -import {isRectBasedMark, Mark, MarkDef} from './mark'; -import {Predicate, ParameterPredicate} from './predicate'; -import {isContinuousToDiscrete, Scale, SCALE_CATEGORY_INDEX} from './scale'; +import {isRectBasedMark, Mark, MarkDef, RelativeBandSize} from './mark'; +import {ParameterPredicate, Predicate} from './predicate'; +import {hasDiscreteDomain, isContinuousToDiscrete, Scale, SCALE_CATEGORY_INDEX} from './scale'; import {isSortByChannel, Sort, SortOrder} from './sort'; import {isFacetFieldDef} from './spec/facet'; -import {StackOffset, StackProperties} from './stack'; +import {StackOffset} from './stack'; import { getTimeUnitParts, isLocalSingleTimeUnit, @@ -469,14 +472,12 @@ export interface PositionBaseMixins { export interface BandMixins { /** - * For rect-based marks (`rect`, `bar`, and `image`), mark size relative to bandwidth of [band scales](https://vega.github.io/vega-lite/docs/scale.html#band), bins or time units. If set to `1`, the mark size is set to the bandwidth, the bin interval, or the time unit interval. If set to `0.5`, the mark size is half of the bandwidth or the time unit interval. - * - * For other marks, relative position on a band of a stacked, binned, time unit or band scale. If set to `0`, the marks will be positioned at the beginning of the band. If set to `0.5`, the marks will be positioned in the middle of the band. + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. * * @minimum 0 * @maximum 1 */ - band?: number; + bandPosition?: number; } export type PositionFieldDef = PositionFieldDefBase & PositionMixins; @@ -508,55 +509,92 @@ export interface PositionMixins { export type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef; -export function getBand({ - channel, +export function getBandPosition({ fieldDef, fieldDef2, markDef: mark, - stack, - config, - isMidPoint + config }: { - isMidPoint?: boolean; - channel: Channel; fieldDef: FieldDef | DatumDef; fieldDef2?: SecondaryChannelDef; - stack: StackProperties; markDef: MarkDef; config: Config; }): number { - if (isFieldOrDatumDef(fieldDef) && fieldDef.band !== undefined) { - return fieldDef.band; + if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) { + return fieldDef.bandPosition; + } + if (isFieldDef(fieldDef)) { + const {timeUnit, bin} = fieldDef; + if (timeUnit && !fieldDef2) { + return isRectBasedMark(mark.type) ? 0 : getMarkConfig('timeUnitBandPosition', mark, config); + } else if (isBinning(bin)) { + return 0.5; + } + } + + return undefined; +} + +export function getBandSize({ + channel, + fieldDef, + fieldDef2, + markDef: mark, + config, + scaleType, + useVlSizeChannel +}: { + channel: PositionScaleChannel | PolarPositionScaleChannel; + fieldDef: ChannelDef; + fieldDef2?: SecondaryChannelDef; + markDef: MarkDef; + config: Config; + scaleType: ScaleType; + useVlSizeChannel?: boolean; +}): number | RelativeBandSize | SignalRef { + const sizeChannel = getSizeChannel(channel); + const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, { + vgChannel: sizeChannel + }); + + if (size !== undefined) { + return size; } + if (isFieldDef(fieldDef)) { const {timeUnit, bin} = fieldDef; if (timeUnit && !fieldDef2) { - if (isMidPoint) { - return getMarkConfig('timeUnitBandPosition', mark, config); + return {band: getMarkConfig('timeUnitBandSize', mark, config)}; + } else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) { + return {band: 1}; + } + } + + if (isRectBasedMark(mark.type)) { + if (scaleType) { + if (hasDiscreteDomain(scaleType)) { + return config[mark.type]?.discreteBandSize || {band: 1}; } else { - return isRectBasedMark(mark.type) ? getMarkConfig('timeUnitBand', mark, config) : 0; + return config[mark.type]?.continuousBandSize; } - } else if (isBinning(bin)) { - return isRectBasedMark(mark.type) && !isMidPoint ? 1 : 0.5; } + return config[mark.type]?.discreteBandSize; } - if (stack?.fieldChannel === channel && isMidPoint) { - return 0.5; - } + return undefined; } -export function hasBand( - channel: Channel, +export function hasBandEnd( fieldDef: FieldDef, fieldDef2: SecondaryChannelDef, - stack: StackProperties, markDef: MarkDef, config: Config ): boolean { if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) { - return !!getBand({channel, fieldDef, fieldDef2, stack, markDef, config}); + // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit + // doesn't have to use bandEnd if there is no bandPosition. + return getBandPosition({fieldDef, fieldDef2, markDef, config}) !== undefined; } return false; } diff --git a/src/compile/data/aggregate.ts b/src/compile/data/aggregate.ts index 518432cc66..dfd759eca6 100644 --- a/src/compile/data/aggregate.ts +++ b/src/compile/data/aggregate.ts @@ -7,7 +7,7 @@ import { isGeoPositionChannel, isScaleChannel } from '../../channel'; -import {binRequiresRange, FieldDef, hasBand, isTypedFieldDef, vgField} from '../../channeldef'; +import {binRequiresRange, FieldDef, hasBandEnd, isTypedFieldDef, vgField} from '../../channeldef'; import * as log from '../../log'; import {AggregateTransform} from '../../transform'; import {Dict, duplicate, hash, keys, replacePathInField, setEqual} from '../../util'; @@ -23,7 +23,7 @@ function addDimension(dims: Set, channel: Channel, fieldDef: FieldDef { + const formula = model.reduceFieldDef((timeUnitComponent: TimeUnitComponent, fieldDef) => { const {field, timeUnit} = fieldDef; - const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; - - const band = - isUnitModel(model) && hasBand(channel, fieldDef, channelDef2, model.stack, model.markDef, model.config); - if (timeUnit) { const as = vgField(fieldDef, {forAs: true}); timeUnitComponent[ @@ -41,8 +32,7 @@ export class TimeUnitNode extends DataFlowNode { ] = { as, field, - timeUnit, - ...(band ? {band: true} : {}) + timeUnit }; } return timeUnitComponent; @@ -77,10 +67,10 @@ export class TimeUnitNode extends DataFlowNode { public merge(other: TimeUnitNode) { this.formula = {...this.formula}; - // if the same hash happen twice, merge "band" + // if the same hash happen twice, merge for (const key in other.formula) { - if (!this.formula[key] || other.formula[key].band) { - // copy if it's not a duplicate or if we need to copy band over + if (!this.formula[key]) { + // copy if it's not a duplicate this.formula[key] = other.formula[key]; } } diff --git a/src/compile/mark/encode/base.ts b/src/compile/mark/encode/base.ts index 75b04b1aad..b739d101e7 100644 --- a/src/compile/mark/encode/base.ts +++ b/src/compile/mark/encode/base.ts @@ -25,7 +25,7 @@ export {tooltip} from './tooltip'; export type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>; -const ALWAYS_IGNORE = new Set(['aria']); +const ALWAYS_IGNORE = new Set(['aria', 'width', 'height']); export function baseEncodeEntry(model: UnitModel, ignore: Ignore) { const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {}; diff --git a/src/compile/mark/encode/position-point.ts b/src/compile/mark/encode/position-point.ts index 066374a76c..c43f88c0d3 100644 --- a/src/compile/mark/encode/position-point.ts +++ b/src/compile/mark/encode/position-point.ts @@ -7,7 +7,7 @@ import { PolarPositionChannel, PositionChannel } from '../../../channel'; -import {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef'; +import {isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef'; import {ScaleType} from '../../../scale'; import {contains} from '../../../util'; import {VgValueRef} from '../../../vega.schema'; @@ -25,12 +25,10 @@ export function pointPosition( model: UnitModel, { defaultPos, - vgChannel, - isMidPoint + vgChannel }: { defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; vgChannel?: 'x' | 'y' | 'xc' | 'yc'; - isMidPoint?: boolean; } ) { const {encoding, markDef, config, stack} = model; @@ -61,7 +59,6 @@ export function pointPosition( channel2Def, markDef, config, - isMidPoint, scaleName, scale, stack, @@ -81,28 +78,27 @@ export function pointPosition( export function positionRef( params: ref.MidPointParams & { channel: 'x' | 'y' | 'radius' | 'theta'; - isMidPoint?: boolean; } ): VgValueRef | VgValueRef[] { - const {channel, channelDef, isMidPoint, scaleName, stack, offset, markDef, config} = params; + const {channel, channelDef, scaleName, stack, offset, markDef} = params; // This isn't a part of midPoint because we use midPoint for non-position too if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { if (isFieldDef(channelDef)) { - const band = getBand({ - channel, - fieldDef: channelDef, - isMidPoint, - markDef, - stack, - config - }); - if (band !== undefined) { + let bandPosition = channelDef.bandPosition; + + if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) { + // theta and radius of text mark should use bandPosition = 0.5 by default + // so that labels for arc marks are centered automatically + bandPosition = 0.5; + } + + if (bandPosition !== undefined) { return ref.interpolatedSignalRef({ scaleName, fieldOrDatumDef: channelDef as TypedFieldDef, // positionRef always have type startSuffix: 'start', - band, + bandPosition, offset }); } diff --git a/src/compile/mark/encode/position-range.ts b/src/compile/mark/encode/position-range.ts index 7aff238f5b..3e56093aa3 100644 --- a/src/compile/mark/encode/position-range.ts +++ b/src/compile/mark/encode/position-range.ts @@ -1,7 +1,8 @@ import {SignalRef} from 'vega'; import {getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel} from '../../../channel'; import {isFieldOrDatumDef} from '../../../channeldef'; -import {MarkConfig} from '../../../mark'; +import * as log from '../../../log'; +import {isRelativeBandSize, Mark, MarkConfig, MarkDef} from '../../../mark'; import {VgEncodeEntry, VgValueRef} from '../../../vega.schema'; import {getMarkStyleConfig} from '../../common'; import {UnitModel} from '../../unit'; @@ -166,7 +167,10 @@ export function position2Ref({ }); } -function position2orSize(channel: 'x2' | 'y2' | 'radius2' | 'theta2', markDef: MarkConfig) { +function position2orSize( + channel: 'x2' | 'y2' | 'radius2' | 'theta2', + markDef: MarkConfig | MarkDef +) { const sizeChannel = getSizeChannel(channel); const vgChannel = getVgPositionChannel(channel); if (markDef[vgChannel] !== undefined) { @@ -174,7 +178,12 @@ function position2orSize(channel: 'x2' | 'y2' | 'radius2' | 'theta2', markDef: M } else if (markDef[channel] !== undefined) { return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel])}; } else if (markDef[sizeChannel]) { - return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[sizeChannel])}; + const dimensionSize = markDef[sizeChannel]; + if (isRelativeBandSize(dimensionSize)) { + log.warn(log.message.relativeBandSizeNotSupported(sizeChannel)); + } else { + return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, dimensionSize)}; + } } return undefined; } diff --git a/src/compile/mark/encode/position-rect.ts b/src/compile/mark/encode/position-rect.ts index b9ae021d22..e6c1556636 100644 --- a/src/compile/mark/encode/position-rect.ts +++ b/src/compile/mark/encode/position-rect.ts @@ -10,15 +10,14 @@ import { PolarPositionChannel, PositionChannel } from '../../../channel'; -import {getBand, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef'; -import {Config, DEFAULT_STEP, getViewConfigDiscreteStep} from '../../../config'; +import {getBandSize, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef'; +import {Config, getViewConfigDiscreteStep} from '../../../config'; import {Encoding} from '../../../encoding'; import * as log from '../../../log'; -import {Mark, MarkDef} from '../../../mark'; -import {hasDiscreteDomain, ScaleType} from '../../../scale'; -import {getFirstDefined} from '../../../util'; +import {BandSize, isRelativeBandSize, Mark, MarkDef, RelativeBandSize} from '../../../mark'; +import {hasDiscreteDomain} from '../../../scale'; import {isSignalRef, isVgRangeStep, VgEncodeEntry, VgValueRef} from '../../../vega.schema'; -import {getMarkPropOrConfig, signalOrStringValue} from '../../common'; +import {getMarkPropOrConfig, signalOrStringValue, signalOrValueRef} from '../../common'; import {ScaleComponent} from '../../scale/component'; import {UnitModel} from '../../unit'; import {nonPosition} from './nonposition'; @@ -33,7 +32,7 @@ export function rectPosition( channel: 'x' | 'y' | 'theta' | 'radius', mark: 'bar' | 'rect' | 'image' | 'arc' ): VgEncodeEntry { - const {config, encoding, markDef, stack} = model; + const {config, encoding, markDef} = model; const channel2 = getSecondaryRangeChannel(channel); const sizeChannel = getSizeChannel(channel); @@ -54,10 +53,10 @@ export function rectPosition( if ( isFieldDef(channelDef) && (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) && - !hasSizeDef && + !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) && !hasDiscreteDomain(scaleType) ) { - const band = getBand({channel, fieldDef: channelDef, stack, markDef, config}); + const bandSize = getBandSize({channel, fieldDef: channelDef, markDef, config, scaleType}); const axis = model.component.axes[channel]?.[0]; const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5 @@ -67,7 +66,7 @@ export function rectPosition( channel, markDef, scaleName, - band, + bandSize, axisTranslate, spacing: isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) : undefined, reverse: scale.get('reverse'), @@ -80,44 +79,42 @@ export function rectPosition( } } function defaultSizeRef( - mark: 'bar' | 'rect' | 'image' | 'arc', sizeChannel: 'width' | 'height', scaleName: string, scale: ScaleComponent, config: Config, - band: number | true + bandSize: BandSize ): VgValueRef { - if (scale) { - const scaleType = scale.get('type'); - if (scaleType === 'point' || scaleType === 'band') { - if (config[mark].discreteBandSize !== undefined) { - return {value: config[mark].discreteBandSize}; - } - if (scaleType === ScaleType.POINT) { - const scaleRange = scale.get('range'); - if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { - return {value: scaleRange.step - 2}; - } - return {value: DEFAULT_STEP - 2}; - } else { - // BAND - return {scale: scaleName, band}; + if (isRelativeBandSize(bandSize)) { + if (scale) { + const scaleType = scale.get('type'); + if (scaleType === 'band') { + return {scale: scaleName, band: bandSize.band}; + } else if (bandSize.band !== 1) { + log.warn(log.message.cannotUseRelativeBandSizeWithNonBandScale(scaleType)); + bandSize = undefined; } } else { - // continuous scale - return {value: config[mark].continuousBandSize}; + return { + mult: bandSize.band, + field: {group: sizeChannel} + }; } + } else if (isSignalRef(bandSize)) { + return bandSize; + } else if (bandSize) { + return {value: bandSize}; } - // No Scale - - const step = getViewConfigDiscreteStep(config.view, sizeChannel); - const value = getFirstDefined( - // No scale is like discrete bar (with one item) - config[mark].discreteBandSize, - step - 2 - ); - return value !== undefined ? {value} : undefined; + // no valid band size + if (scale) { + const scaleRange = scale.get('range'); + if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { + return {value: scaleRange.step - 2}; + } + } + const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel); + return {value: defaultStep - 2}; } /** @@ -140,23 +137,23 @@ function positionAndSize( // use "size" channel for bars, if there is orient and the channel matches the right orientation const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x'); - const sizeFromMarkOrConfig = getMarkPropOrConfig(useVlSizeChannel ? 'size' : vgSizeChannel, markDef, config, { - vgChannel: vgSizeChannel - }); - // Use size encoding / mark property / config if it exists let sizeMixins; - if (encoding.size || sizeFromMarkOrConfig !== undefined) { + if (encoding.size || markDef.size) { if (useVlSizeChannel) { - sizeMixins = nonPosition('size', model, {vgChannel: vgSizeChannel, defaultValue: sizeFromMarkOrConfig}); + sizeMixins = nonPosition('size', model, { + vgChannel: vgSizeChannel, + defaultRef: signalOrValueRef(markDef.size) + }); } else { log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type)); } } // Otherwise, apply default value - const band = (isFieldOrDatumDef(fieldDef) ? getBand({channel, fieldDef, markDef, stack, config}) : undefined) ?? 1; - sizeMixins = sizeMixins || {[vgSizeChannel]: defaultSizeRef(mark, vgSizeChannel, scaleName, scale, config, band)}; + const bandSize = getBandSize({channel, fieldDef, markDef, config, scaleType: scale?.get('type'), useVlSizeChannel}); + + sizeMixins = sizeMixins || {[vgSizeChannel]: defaultSizeRef(vgSizeChannel, scaleName, scale, config, bandSize)}; /* Band scales with size value and all point scales, use xc/yc + band=0.5 @@ -167,9 +164,10 @@ function positionAndSize( If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 */ - const center = scale?.get('type') !== 'band' || !('band' in sizeMixins[vgSizeChannel]); + const defaultBandAlign = scale?.get('type') !== 'band' || !('band' in sizeMixins[vgSizeChannel]) ? 'middle' : 'top'; - const vgChannel = vgAlignedPositionChannel(channel, markDef, config, center ? 'middle' : 'top'); + const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign); + const center = vgChannel === 'xc' || vgChannel === 'yc'; const offset = getOffset(channel, markDef); const posRef = ref.midPointRefWithPositionInvalidTest({ @@ -182,7 +180,13 @@ function positionAndSize( stack, offset, defaultRef: pointPositionDefaultRef({model, defaultPos: 'mid', channel, scaleName, scale}), - band: center ? 0.5 : (1 - band) / 2 + bandPosition: center + ? 0.5 + : isSignalRef(bandSize) + ? {signal: `(1-${bandSize})/2`} + : isRelativeBandSize(bandSize) + ? (1 - bandSize.band) / 2 + : 0 }); if (vgSizeChannel) { @@ -242,7 +246,7 @@ export function rectBinPosition({ fieldDef, fieldDef2, channel, - band, + bandSize, scaleName, markDef, spacing = 0, @@ -253,7 +257,7 @@ export function rectBinPosition({ fieldDef: TypedFieldDef; fieldDef2?: Encoding['x2' | 'y2']; channel: 'x' | 'y' | 'theta' | 'radius'; - band: number; + bandSize: number | RelativeBandSize | SignalRef | undefined; scaleName: string; markDef: MarkDef; spacing?: number; @@ -268,6 +272,12 @@ export function rectBinPosition({ const offset = getOffset(channel, markDef); + const bandPosition = isSignalRef(bandSize) + ? {signal: `(1-${bandSize.signal})/2`} + : isRelativeBandSize(bandSize) + ? (1 - bandSize.band) / 2 + : 0.5; + if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { return { [vgChannel2]: rectBinRef({ @@ -275,7 +285,7 @@ export function rectBinPosition({ fieldDef, scaleName, markDef, - band: (1 - band) / 2, + bandPosition, offset: getBinSpacing(channel2, spacing, reverse, axisTranslate, offset), config }), @@ -284,7 +294,7 @@ export function rectBinPosition({ fieldDef, scaleName, markDef, - band: 1 - (1 - band) / 2, + bandPosition: isSignalRef(bandPosition) ? {signal: `1-${bandPosition.signal}`} : 1 - bandPosition, offset: getBinSpacing(channel, spacing, reverse, axisTranslate, offset), config }) @@ -329,7 +339,7 @@ export function rectBinRef({ fieldDef, scaleName, markDef, - band, + bandPosition, offset, config }: { @@ -337,14 +347,14 @@ export function rectBinRef({ fieldDef: TypedFieldDef; scaleName: string; markDef: MarkDef; - band: number; + bandPosition: number | SignalRef; offset?: number | SignalRef; config?: Config; }) { const r = ref.interpolatedSignalRef({ scaleName, fieldOrDatumDef: fieldDef, - band, + bandPosition, offset }); diff --git a/src/compile/mark/encode/valueref.ts b/src/compile/mark/encode/valueref.ts index 645838328a..43551d8663 100644 --- a/src/compile/mark/encode/valueref.ts +++ b/src/compile/mark/encode/valueref.ts @@ -14,7 +14,7 @@ import { FieldDefBase, FieldName, FieldRefOption, - getBand, + getBandPosition, isDatumDef, isFieldDef, isFieldOrDatumDef, @@ -125,7 +125,7 @@ export function valueRefForFieldOrDatumDef( fieldDef: FieldDefBase | DatumDef, scaleName: string, opt: FieldRefOption, - encode: {offset?: number | VgValueRef; band?: number | boolean} + encode: {offset?: number | VgValueRef; band?: number | boolean | SignalRef} ): VgValueRef { const ref: VgValueRef = {}; @@ -169,16 +169,16 @@ export function interpolatedSignalRef({ fieldOrDatumDef2, offset, startSuffix, - band = 0.5 + bandPosition = 0.5 }: { scaleName: string; fieldOrDatumDef: TypedFieldDef; fieldOrDatumDef2?: SecondaryFieldDef; startSuffix?: string; offset: number | SignalRef; - band: number; + bandPosition: number | SignalRef; }): VgValueRef { - const expr = 0 < band && band < 1 ? 'datum' : undefined; + const expr = 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined; const start = vgField(fieldOrDatumDef, {expr, suffix: startSuffix}); const end = fieldOrDatumDef2 !== undefined @@ -187,12 +187,14 @@ export function interpolatedSignalRef({ const ref: VgValueRef = {}; - if (band === 0 || band === 1) { + if (bandPosition === 0 || bandPosition === 1) { ref.scale = scaleName; - const val = band === 0 ? start : end; + const val = bandPosition === 0 ? start : end; ref.field = val; } else { - const datum = `${band} * ${start} + ${1 - band} * ${end}`; + const datum = isSignalRef(bandPosition) + ? `${bandPosition.signal} * ${start} + (1-${bandPosition.signal}) * ${end}` + : `${bandPosition} * ${start} + ${1 - bandPosition} * ${end}`; ref.signal = `scale("${scaleName}", ${datum})`; } @@ -216,10 +218,7 @@ export interface MidPointParams { offset?: number | SignalRef; defaultRef: VgValueRef | (() => VgValueRef); - /** - * Allow overriding band instead of reading to field def since band is applied to size (width/height) instead of the position for x/y-position with band scales. - */ - band?: number; + bandPosition?: number | SignalRef; } /** @@ -236,7 +235,7 @@ export function midPoint({ stack, offset, defaultRef, - band + bandPosition }: MidPointParams): VgValueRef { // TODO: datum support if (channelDef) { @@ -244,28 +243,26 @@ export function midPoint({ if (isFieldOrDatumDef(channelDef)) { if (isTypedFieldDef(channelDef)) { - band ??= getBand({ - channel, + bandPosition ??= getBandPosition({ fieldDef: channelDef, fieldDef2: channel2Def, markDef, - stack, - config, - isMidPoint: true + config }); const {bin, timeUnit, type} = channelDef; - if (isBinning(bin) || (band && timeUnit && type === TEMPORAL)) { + if (isBinning(bin) || (bandPosition && timeUnit && type === TEMPORAL)) { // Use middle only for x an y to place marks in the center between start and end of the bin range. // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. if (stack && stack.impute) { // For stack, we computed bin_mid so we can impute. return valueRefForFieldOrDatumDef(channelDef, scaleName, {binSuffix: 'mid'}, {offset}); } - if (band) { + + if (bandPosition) { // if band = 0, no need to call interpolation // For non-stack, we can just calculate bin mid on the fly using signal. - return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, band, offset}); + return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, bandPosition, offset}); } return valueRefForFieldOrDatumDef( channelDef, @@ -281,7 +278,7 @@ export function midPoint({ scaleName, fieldOrDatumDef: channelDef, fieldOrDatumDef2: channel2Def, - band, + bandPosition, offset }); } else { @@ -299,7 +296,7 @@ export function midPoint({ { offset, // For band, to get mid point, need to offset by half of the band - band: scaleType === 'band' ? band ?? channelDef.band ?? 0.5 : undefined + band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined } ); } else if (isValueDef(channelDef)) { diff --git a/src/compile/mark/text.ts b/src/compile/mark/text.ts index 40a6a17e26..cf1b2265ce 100644 --- a/src/compile/mark/text.ts +++ b/src/compile/mark/text.ts @@ -31,8 +31,8 @@ export const text: MarkCompiler = { ...encode.nonPosition('angle', model), ...encode.valueIfDefined('align', align(model.markDef, encoding, config)), ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)), - ...encode.pointPosition('radius', model, {defaultPos: null, isMidPoint: true}), - ...encode.pointPosition('theta', model, {defaultPos: null, isMidPoint: true}) + ...encode.pointPosition('radius', model, {defaultPos: null}), + ...encode.pointPosition('theta', model, {defaultPos: null}) }; } }; diff --git a/src/compile/scale/domain.ts b/src/compile/scale/domain.ts index 92de06b7da..2f3de1f2d7 100644 --- a/src/compile/scale/domain.ts +++ b/src/compile/scale/domain.ts @@ -13,7 +13,7 @@ import {getSecondaryRangeChannel, isScaleChannel, ScaleChannel} from '../../chan import { binRequiresRange, getFieldOrDatumDef, - hasBand, + hasBandEnd, isDatumDef, isFieldDef, ScaleDatumDef, @@ -348,11 +348,9 @@ function parseSingleChannelDomain( } else if ( fieldDef.timeUnit && util.contains(['time', 'utc'], scaleType) && - hasBand( - channel, + hasBandEnd( fieldDef, isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined, - model.stack, model.markDef, model.config ) diff --git a/src/compile/scale/parse.ts b/src/compile/scale/parse.ts index eff0a7f820..f67f47103e 100644 --- a/src/compile/scale/parse.ts +++ b/src/compile/scale/parse.ts @@ -43,7 +43,7 @@ export function parseScaleCore(model: Model) { * Parse scales for all channels of a model. */ function parseUnitScaleCore(model: UnitModel): ScaleComponentIndex { - const {encoding, mark} = model; + const {encoding, mark, markDef} = model; return SCALE_CHANNELS.reduce((scaleComponents: ScaleComponentIndex, channel: ScaleChannel) => { const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as TypedFieldDef | ScaleDatumDef; // must be typed def to have scale @@ -57,7 +57,7 @@ function parseUnitScaleCore(model: UnitModel): ScaleComponentIndex { if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { specifiedScale ??= {}; - const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, mark); + const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef); scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), { value: sType, explicit: specifiedScale.type === sType diff --git a/src/compile/scale/type.ts b/src/compile/scale/type.ts index ba9a90ac15..53465689ba 100644 --- a/src/compile/scale/type.ts +++ b/src/compile/scale/type.ts @@ -1,8 +1,8 @@ import {isBinning} from '../../bin'; -import {Channel, isColorChannel, isScaleChannel, rangeType} from '../../channel'; +import {Channel, getSizeChannel, isColorChannel, isScaleChannel, rangeType} from '../../channel'; import {DatumDef, isFieldDef, isPositionFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef'; import * as log from '../../log'; -import {Mark} from '../../mark'; +import {isRelativeBandSize, MarkDef} from '../../mark'; import {channelSupportScaleType, Scale, ScaleType, scaleTypeSupportDataType} from '../../scale'; import {normalizeTimeUnit} from '../../timeunit'; import * as util from '../../util'; @@ -19,7 +19,7 @@ export function scaleType( specifiedScale: Scale, channel: Channel, fieldDef: TypedFieldDef | DatumDef, - mark: Mark + mark: MarkDef ): ScaleType { const defaultScaleType = defaultType(channel, fieldDef, mark); const {type} = specifiedScale; @@ -51,10 +51,10 @@ export function scaleType( * Determine appropriate default scale type. */ // NOTE: Voyager uses this method. -function defaultType(channel: Channel, fieldDef: TypedFieldDef | ScaleDatumDef, mark: Mark): ScaleType { +function defaultType(channel: Channel, fieldDef: TypedFieldDef | ScaleDatumDef, mark: MarkDef): ScaleType { switch (fieldDef.type) { case 'nominal': - case 'ordinal': + case 'ordinal': { if (isColorChannel(channel) || rangeType(channel) === 'discrete') { if (channel === 'shape' && fieldDef.type === 'ordinal') { log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal')); @@ -63,20 +63,26 @@ function defaultType(channel: Channel, fieldDef: TypedFieldDef | ScaleDa } if (channel in POSITION_SCALE_CHANNEL_INDEX) { - if (util.contains(['rect', 'bar', 'image', 'rule'], mark)) { + if (util.contains(['rect', 'bar', 'image', 'rule'], mark.type)) { // The rect/bar mark should fit into a band. // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 return 'band'; } - } else if (mark === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { + } else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { return 'band'; } - if (fieldDef.band !== undefined || (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand)) { + const dimensionSize = mark[getSizeChannel(channel)]; + if (isRelativeBandSize(dimensionSize)) { + return 'band'; + } + + if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) { return 'band'; } // Otherwise, use ordinal point scale so we can easily get center positions of the marks. return 'point'; + } case 'temporal': if (isColorChannel(channel)) { diff --git a/src/log/message.ts b/src/log/message.ts index 5f377aad7b..eebbd7a40b 100644 --- a/src/log/message.ts +++ b/src/log/message.ts @@ -171,6 +171,10 @@ export function droppingColor(type: 'encoding' | 'property', opt: {fill?: boolea }.`; } +export function relativeBandSizeNotSupported(sizeChannel: 'width' | 'height') { + return `Position range does not support relative band size for ${sizeChannel}.`; +} + export function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel) { return `Dropping ${stringify( fieldDef @@ -233,6 +237,10 @@ export function cannotUseScalePropertyWithNonColor(prop: string) { return `Cannot use the scale property "${prop}" with non-color channel.`; } +export function cannotUseRelativeBandSizeWithNonBandScale(scaleType: ScaleType) { + return `Cannot use the relative band size with ${scaleType} scale.`; +} + export function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef) { return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`; } diff --git a/src/mark.ts b/src/mark.ts index 063d3c1658..75a88a272b 100644 --- a/src/mark.ts +++ b/src/mark.ts @@ -109,7 +109,7 @@ export interface VLOnlyMarkConfig extends ColorM * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. * If set to `0.5`, bandwidth of the marks will be half of the time unit band step. */ - timeUnitBand?: number; + timeUnitBandSize?: number; /** * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. @@ -329,7 +329,7 @@ const VL_ONLY_MARK_CONFIG_INDEX: Flag> = { order: 1, radius2: 1, theta2: 1, - timeUnitBand: 1, + timeUnitBandSize: 1, timeUnitBandPosition: 1 }; @@ -348,7 +348,7 @@ export const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: { export const defaultMarkConfig: MarkConfig = { color: '#4c78a8', invalid: 'filter', - timeUnitBand: 1 + timeUnitBandSize: 1 }; // TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed @@ -443,7 +443,20 @@ export interface RectConfig extends RectBinSpaci * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars. * @minimum 0 */ - discreteBandSize?: number; + discreteBandSize?: number | RelativeBandSize; +} + +export type BandSize = number | RelativeBandSize | SignalRef; + +export interface RelativeBandSize { + /** + * The relative band size. For example `0.5` means half of the band scale's band width. + */ + band: number; +} + +export function isRelativeBandSize(o: number | RelativeBandSize | ExprRef | SignalRef): o is RelativeBandSize { + return o && o['band'] != undefined; } export const BAR_CORNER_RADIUS_INDEX: Partial< @@ -459,6 +472,7 @@ export const BAR_CORNER_RADIUS_INDEX: Partial< export interface BarCornerRadiusMixins { /** * - For vertical bars, top-left and top-right corner radius. + * * - For horizontal bars, top-right and bottom-right corner radius. */ cornerRadiusEnd?: number | ES; @@ -581,7 +595,12 @@ export interface MarkDefMixins { radius2Offset?: number | ES; } -// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef +export interface RelativeBandSize { + /** + * The relative band size. For example `0.5` means half of the band scale's band width. + */ + band: number; +} // Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef export interface MarkDef< @@ -594,7 +613,7 @@ export interface MarkDef< BarConfig & // always extends RectConfig LineConfig & TickConfig, - 'startAngle' | 'endAngle' + 'startAngle' | 'endAngle' | 'width' | 'height' >, MarkDefMixins { // Omit startAngle/endAngle since we use theta/theta2 from Vega-Lite schema to avoid confusion @@ -608,6 +627,26 @@ export interface MarkDef< * @hidden */ endAngle?: number | ES; + + // Replace width / height to include relative band size + + /** + * Width of the marks. One of: + * + * - A number representing a fixed pixel width. + * + * - A relative band size definition. For example, `{band: 0.5}` represents half of the band. + */ + width?: number | ES | RelativeBandSize; + + /** + * Height of the marks. One of: + * + * - A number representing a fixed pixel height. + * + * - A relative band size definition. For example, `{band: 0.5}` represents half of the band + */ + height?: number | ES | RelativeBandSize; } const DEFAULT_RECT_BAND_SIZE = 5; diff --git a/test/compile/data/timeunit.test.ts b/test/compile/data/timeunit.test.ts index b0c0e87b24..05cb1ab17f 100644 --- a/test/compile/data/timeunit.test.ts +++ b/test/compile/data/timeunit.test.ts @@ -105,7 +105,7 @@ describe('compile/data/timeunit', () => { }); const timeUnitNode = TimeUnitNode.makeFromEncoding(null, model); expect(timeUnitNode.hash()).toBe( - 'TimeUnit {"{\\"as\\":\\"month_a\\",\\"field\\":\\"a\\",\\"timeUnit\\":{\\"unit\\":\\"month\\"}}":{"as":"month_a","band":true,"field":"a","timeUnit":{"unit":"month"}}}' + 'TimeUnit {"{\\"as\\":\\"month_a\\",\\"field\\":\\"a\\",\\"timeUnit\\":{\\"unit\\":\\"month\\"}}":{"as":"month_a","field":"a","timeUnit":{"unit":"month"}}}' ); }); @@ -119,7 +119,7 @@ describe('compile/data/timeunit', () => { }); const timeUnitNode = TimeUnitNode.makeFromEncoding(null, model); expect(timeUnitNode.hash()).toBe( - 'TimeUnit {"{\\"as\\":\\"utcmonth_step_10_a\\",\\"field\\":\\"a\\",\\"timeUnit\\":{\\"step\\":10,\\"unit\\":\\"month\\",\\"utc\\":true}}":{"as":"utcmonth_step_10_a","band":true,"field":"a","timeUnit":{"step":10,"unit":"month","utc":true}}}' + 'TimeUnit {"{\\"as\\":\\"utcmonth_step_10_a\\",\\"field\\":\\"a\\",\\"timeUnit\\":{\\"step\\":10,\\"unit\\":\\"month\\",\\"utc\\":true}}":{"as":"utcmonth_step_10_a","field":"a","timeUnit":{"step":10,"unit":"month","utc":true}}}' ); }); }); diff --git a/test/compile/mark/bar.test.ts b/test/compile/mark/bar.test.ts index bcff13b034..667819147c 100644 --- a/test/compile/mark/bar.test.ts +++ b/test/compile/mark/bar.test.ts @@ -153,12 +153,12 @@ describe('Mark: Bar', () => { }); }); - describe('simple horizontal with band', () => { + describe('simple horizontal with height band', () => { const model = parseUnitModelWithScaleAndLayoutSize({ data: {url: 'data/cars.json'}, - mark: 'bar', + mark: {type: 'bar', height: {band: 0.6}}, encoding: { - y: {field: 'Origin', type: 'nominal', band: 0.6}, + y: {field: 'Origin', type: 'nominal'}, x: {aggregate: 'mean', field: 'Acceleration', type: 'quantitative'} } }); @@ -266,7 +266,7 @@ describe('Mark: Bar', () => { }); const props = bar.encodeEntry(model); - it('should draw bar from zero to field value and with band value for x/width', () => { + it('should draw bar from zero to field value and with band value for yc/height', () => { expect(props.yc).toEqual({scale: 'y', field: 'Origin', band: 0.5}); expect(props.height).toEqual({scale: 'size', field: 'mean_Horsepower'}); expect(props.x).toEqual({scale: 'x', field: 'mean_Acceleration'}); @@ -739,20 +739,22 @@ describe('Mark: Bar', () => { describe('1D vertical', () => { const model = parseUnitModelWithScaleAndLayoutSize({ - mark: 'bar', - encoding: {y: {type: 'quantitative', field: 'US_Gross', aggregate: 'sum'}}, - data: {url: 'data/movies.json'} + data: {url: 'data/cars.json'}, + mark: {type: 'bar', width: {band: 0.5}}, + encoding: { + y: {type: 'quantitative', field: 'Acceleration', aggregate: 'mean'} + } }); const props = bar.encodeEntry(model); - it('should have y end on axis, have no-height and have x-offset', () => { - expect(props.y).toEqual({scale: 'y', field: 'sum_US_Gross'}); + expect(props.y).toEqual({scale: 'y', field: 'mean_Acceleration'}); expect(props.y2).toEqual({scale: 'y', value: 0}); expect(props.height).toBeUndefined(); expect(props.xc).toEqual({ mult: 0.5, signal: 'width' }); + expect(props.width).toEqual({mult: 0.5, field: {group: 'width'}}); }); }); diff --git a/test/compile/mark/encode/position-rect.test.ts b/test/compile/mark/encode/position-rect.test.ts index 5f5e817deb..3cb8b002cc 100644 --- a/test/compile/mark/encode/position-rect.test.ts +++ b/test/compile/mark/encode/position-rect.test.ts @@ -11,7 +11,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'x', - band: 1, + bandSize: 1, scaleName: undefined, reverse: {signal: 'r'}, axisTranslate: 0.5, // Vega default @@ -32,7 +32,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'x', - band: 1, + bandSize: 1, scaleName: 'x', reverse: false, axisTranslate: 0.5, // Vega default @@ -51,7 +51,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'y', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: 0.5, // Vega default reverse: {signal: 'r'}, @@ -72,7 +72,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'x', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: 0.5, // Vega default reverse: {signal: 'r'}, @@ -93,7 +93,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'y', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: 0.5, // Vega default reverse: {signal: 'r'}, @@ -116,7 +116,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'x', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: 0.5, // Vega default reverse: false, @@ -135,7 +135,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'y', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: 0.5, // Vega default reverse: false, @@ -152,7 +152,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'x', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: {signal: 't'}, // Vega default reverse: false, @@ -173,7 +173,7 @@ describe('compile/mark/encode/position-rect', () => { const props = rectBinPosition({ fieldDef, channel: 'x', - band: 1, + bandSize: 1, scaleName: undefined, axisTranslate: {signal: 't'}, // Vega default reverse: {signal: 'r'}, diff --git a/test/compile/mark/point.test.ts b/test/compile/mark/point.test.ts index 50df852c7c..89773631b5 100644 --- a/test/compile/mark/point.test.ts +++ b/test/compile/mark/point.test.ts @@ -83,7 +83,7 @@ describe('Mark: Point', () => { const model = parseUnitModelWithScaleAndLayoutSize({ mark: 'point', encoding: { - x: {field: 'a', type: 'quantitative', band: 0.5, stack: 'zero'}, + x: {field: 'a', type: 'quantitative', bandPosition: 0.5, stack: 'zero'}, color: {field: 'b', type: 'ordinal'} }, data: {url: 'data/barley.json'} @@ -100,7 +100,7 @@ describe('Mark: Point', () => { const model = parseUnitModelWithScaleAndLayoutSize({ mark: 'point', encoding: { - x: {bin: true, field: 'a', type: 'quantitative', band: 0.6} + x: {bin: true, field: 'a', type: 'quantitative', bandPosition: 0.6} }, data: {url: 'data/barley.json'} }); @@ -112,6 +112,23 @@ describe('Mark: Point', () => { {signal: 'scale("x", 0.6 * datum["bin_maxbins_10_a"] + 0.4 * datum["bin_maxbins_10_a_end"])'} ]); }); + it('interpolates x timeUnit with timeUnitBand = 0.5', () => { + // This is a simplified example for stacked point. + // In reality this will be used as stacked's overlayed marker + const model = parseUnitModelWithScaleAndLayoutSize({ + data: {url: 'data/barley.json'}, + mark: 'point', + encoding: { + x: {timeUnit: 'year', field: 'a'} + }, + config: { + point: {timeUnitBandPosition: 0.5} + } + }); + + const props = point.encodeEntry(model); + expect(props.x).toEqual({signal: 'scale("x", 0.5 * datum["year_a"] + 0.5 * datum["year_a_end"])'}); + }); it('interpolates nominal x on a band scale with band = 0.6', () => { // This is a simplified example for stacked point. @@ -119,7 +136,7 @@ describe('Mark: Point', () => { const model = parseUnitModelWithScaleAndLayoutSize({ mark: 'point', encoding: { - x: {field: 'a', type: 'nominal', band: 0.6, scale: {type: 'band'}} + x: {field: 'a', type: 'nominal', bandPosition: 0.6, scale: {type: 'band'}} }, data: {url: 'data/barley.json'} }); diff --git a/test/compile/mark/rect.test.ts b/test/compile/mark/rect.test.ts index edc77b7ae3..3fded75762 100644 --- a/test/compile/mark/rect.test.ts +++ b/test/compile/mark/rect.test.ts @@ -118,6 +118,26 @@ describe('Mark: Rect', () => { }); }); + describe('simple vertical with signal-based band size', () => { + const model = parseUnitModelWithScaleAndLayoutSize({ + data: {url: 'data/cars.json'}, + mark: {type: 'rect', width: {expr: 'a'}}, + encoding: { + x: {field: 'Origin', type: 'nominal'}, + y: {type: 'quantitative', field: 'Acceleration', aggregate: 'mean'} + } + }); + const props = rect.encodeEntry(model); + + it('should draw bar, with y from zero to field value and x band', () => { + expect(props.xc).toEqual({scale: 'x', field: 'Origin', band: 0.5}); + expect(props.width).toEqual({signal: 'a'}); + expect(props.y).toEqual({scale: 'y', field: 'mean_Acceleration'}); + expect(props.y2).toEqual({scale: 'y', value: 0}); + expect(props.height).toBeUndefined(); + }); + }); + describe('simple vertical 1D', () => { const model = parseUnitModelWithScaleAndLayoutSize({ data: {url: 'data/cars.json'}, diff --git a/test/compile/mark/text.test.ts b/test/compile/mark/text.test.ts index 3164f631ba..338b103183 100644 --- a/test/compile/mark/text.test.ts +++ b/test/compile/mark/text.test.ts @@ -25,6 +25,22 @@ describe('Mark: Text', () => { }); }); + it('should use stack_mid on theta for stacked theta', () => { + // This is a simplified example for stacked text. + // In reality this will be used as stacked's overlayed marker + const model = parseUnitModelWithScaleAndLayoutSize({ + mark: 'text', + encoding: { + theta: {field: 'value', type: 'quantitative', stack: true}, + color: {field: 'b', type: 'ordinal'} + }, + data: {url: 'data/barley.json'} + }); + + const props = text.encodeEntry(model); + expect(props.theta).toEqual({signal: 'scale("theta", 0.5 * datum["value_start"] + 0.5 * datum["value_end"])'}); + }); + describe('with stacked y', () => { // This is a simplified example for stacked text. // In reality this will be used as stacked's overlayed marker diff --git a/test/compile/scale/type.test.ts b/test/compile/scale/type.test.ts index ab1bfe4c6f..9ba38a916b 100644 --- a/test/compile/scale/type.test.ts +++ b/test/compile/scale/type.test.ts @@ -1,8 +1,9 @@ -import {rangeType, SCALE_CHANNELS, X, Y} from '../../../src/channel'; -import {scaleType} from '../../../src/compile/scale/type'; +import {Channel, RADIUS, rangeType, SCALE_CHANNELS, THETA, X, Y} from '../../../src/channel'; +import {DatumDef, TypedFieldDef} from '../../../src/channeldef'; +import {scaleType as _scaleType} from '../../../src/compile/scale/type'; import * as log from '../../../src/log'; -import {BAR, PRIMITIVE_MARKS, RECT, RULE} from '../../../src/mark'; -import {ScaleType} from '../../../src/scale'; +import {ARC, BAR, Mark, PRIMITIVE_MARKS, RECT, RULE} from '../../../src/mark'; +import {Scale, ScaleType} from '../../../src/scale'; import { isUTCTimeUnit, LOCAL_MULTI_TIMEUNIT_INDEX, @@ -24,6 +25,15 @@ const TIMEUNIT_INDEX: Flag = { const TIMEUNITS = keys(TIMEUNIT_INDEX); +function scaleType( + specifiedScale: Scale, + channel: Channel, + fieldDef: TypedFieldDef | DatumDef, + mark: Mark +): ScaleType { + return _scaleType(specifiedScale, channel, fieldDef, {type: mark}); +} + describe('compile/scale', () => { describe('type()', () => { it('should return null for channel without scale', () => { @@ -107,6 +117,16 @@ describe('compile/scale', () => { }); }); + it('should return band scale for ordinal theta, radius when mark is arc', () => { + [ORDINAL, NOMINAL].forEach(t => { + [RADIUS, THETA].forEach(channel => { + [ARC].forEach(mark => { + expect(scaleType({}, channel, {type: t}, mark)).toEqual(ScaleType.BAND); + }); + }); + }); + }); + it('should return point scale for X,Y when mark is point', () => { [ORDINAL, NOMINAL].forEach(t => { [X, Y].forEach(channel => {