Skip to content

Commit 395e707

Browse files
Barchart styling (#102)
2 parents fb62023 + dd741dc commit 395e707

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

gallery/barchart.typ

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313
)
1414

1515
#canvas({
16-
draw.set-style(legend: (fill: white))
16+
draw.set-style(legend: (fill: white), barchart: (bar-width: .8, cluster-gap: 0))
1717
chart.barchart(mode: "clustered",
1818
size: (9, auto),
1919
label-key: 0,
2020
value-key: (..range(1, 5)),
21-
bar-width: .8,
2221
x-tick-step: 2.5,
2322
data2,
2423
labels: ([Low], [Medium], [High], [Very high]),

src/chart/barchart.typ

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
/// they represent.
1818
///
1919
/// = Styling
20+
/// Can be applied with `cetz.draw.set-style(barchart: (bar-width: 1))`.
21+
///
2022
/// *Root*: `barchart`.
2123
/// #show-parameter-block("bar-width", "float", default: .8, [
2224
/// Width of a single bar (basic) or a cluster of bars (clustered) in the plot.])
2325
/// #show-parameter-block("y-inset", "float", default: 1, [
2426
/// Distance of the plot data to the plot's edges on the y-axis of the plot.])
27+
/// #show-parameter-block("cluster-gap", "float", default: 0, [
28+
/// Spacing between bars insides a cluster.])
2529
/// You can use any `plot` or `axes` related style keys, too.
2630
///
2731
/// The `barchart` function is a wrapper of the `plot` API. Arguments passed

0 commit comments

Comments
 (0)