Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barchart styling #102

Merged
merged 2 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions gallery/barchart.typ
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
)

#canvas({
draw.set-style(legend: (fill: white))
draw.set-style(legend: (fill: white), barchart: (bar-width: .8, cluster-gap: 0))
chart.barchart(mode: "clustered",
size: (9, auto),
label-key: 0,
value-key: (..range(1, 5)),
bar-width: .8,
x-tick-step: 2.5,
data2,
labels: ([Low], [Medium], [High], [Very high]),
Expand Down
4 changes: 4 additions & 0 deletions src/chart/barchart.typ
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
/// they represent.
///
/// = Styling
/// Can be applied with `cetz.draw.set-style(barchart: (bar-width: 1))`.
///
/// *Root*: `barchart`.
/// #show-parameter-block("bar-width", "float", default: .8, [
/// Width of a single bar (basic) or a cluster of bars (clustered) in the plot.])
/// #show-parameter-block("y-inset", "float", default: 1, [
/// Distance of the plot data to the plot's edges on the y-axis of the plot.])
/// #show-parameter-block("cluster-gap", "float", default: 0, [
/// Spacing between bars insides a cluster.])
/// You can use any `plot` or `axes` related style keys, too.
///
/// The `barchart` function is a wrapper of the `plot` API. Arguments passed
Expand Down
Loading