diff --git a/site/_data/examples.json b/site/_data/examples.json index 94159777c3c..a1fab1f0064 100644 --- a/site/_data/examples.json +++ b/site/_data/examples.json @@ -84,6 +84,10 @@ "name": "bar_month_temporal_initial", "title": "Bar Chart showing Initials of Month Names" }, + { + "name": "bar_month_temporal_band_center", + "title": "Bar Chart with bars center-aligned with time unit ticks" + }, { "name": "bar_negative", "title": "Bar Chart with Negative Values and a Zero-Baseline" diff --git a/site/_layouts/docs.html b/site/_layouts/docs.html index c46a28c6e04..5dc0b668485 100644 --- a/site/_layouts/docs.html +++ b/site/_layouts/docs.html @@ -98,8 +98,8 @@ url: aggregate - text: Axis url: axis - - text: Band - url: band + - text: Band Position + url: bandposition - text: Bin url: bin - text: Condition diff --git a/site/docs/encoding/band.md b/site/docs/encoding/band.md deleted file mode 100644 index e5d15520cd5..00000000000 --- a/site/docs/encoding/band.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -layout: docs -title: Band -permalink: /docs/band.html ---- - -Band properties can be used to adjust mark bandwidth or position for band scales, bin intervals, or time unit intervals. - -{% include table.html props="band" source="DatumDef" %} - -## Examples - -### Line Position - -By default, points in line marks are placed at the beginning of a time interval (e.g., "month"): - -
- -Setting `band` to `0.5` moves the points to the middle of the time interval. - - diff --git a/site/docs/encoding/bandPosition.md b/site/docs/encoding/bandPosition.md new file mode 100644 index 00000000000..943ea756e1b --- /dev/null +++ b/site/docs/encoding/bandPosition.md @@ -0,0 +1,31 @@ +--- +layout: docs +title: Band Position +permalink: /docs/bandPosition.html +--- + +Band properties can be used to adjust mark bandwidth or position for band scales, bin intervals, or time unit intervals. + +{% include table.html props="bandPosition" source="DatumDef" %} + +## Examples + +### Line Position + +By default, points in line marks are placed at the beginning of a time interval (e.g., "month"): + + + +Setting `bandPosition` to `0.5` moves the points to the middle of the time interval. + + + +### Bar Position + +By default, bar marks are placed from the beginning of a time interval (e.g., "month") to the end of the interval: + + + +Setting `bandPosition` to `0` moves the bar to center-align with ticks. + + diff --git a/site/docs/transform/timeunit.md b/site/docs/transform/timeunit.md index 7f6ef48e6b4..1ac2471918b 100644 --- a/site/docs/transform/timeunit.md +++ b/site/docs/transform/timeunit.md @@ -68,6 +68,12 @@ Using `timeUnit` with rect-based marks (including `bar`, `rect`, and `image`) wi You can also add `"binned"` prefix if your data has already been binned and want Vega-Lite to apply the right formatting, including the right bands for the interval, to your charts. +By default, bar marks are placed from the beginning of a time interval (e.g., "month") to the end of the interval. + +Setting [`bandPosition`](bandPosition.html) to `0` moves the bar to center-align with ticks. + + + ### Time Unit's Band