diff --git a/gallery/barchart.typ b/gallery/barchart.typ index a6ed989..062096f 100644 --- a/gallery/barchart.typ +++ b/gallery/barchart.typ @@ -14,13 +14,11 @@ #canvas({ draw.set-style(legend: (fill: white)) - chart.barchart(mode: "clustered", - size: (9, auto), - label-key: 0, - value-key: (..range(1, 4)), - bar-width: .8, - x-tick-step: 2.5, - data2, - labels: ([Low], [Medium], [High], [Very high]), - legend: "legend.inner-north-east",) -}) + chart.bar.clustered(size: (9, 8), + label-key: 0, + y-keys: (..range(1, 5)), + bar-width: .8, + data2, + labels: ([Low], [Medium], [High], [Very high]), + legend: "inner-north-east") +}) \ No newline at end of file diff --git a/gallery/line.typ b/gallery/line.typ index f559a80..145a4f8 100644 --- a/gallery/line.typ +++ b/gallery/line.typ @@ -19,21 +19,21 @@ // Set-up a thin axis style set-style(axes: (stroke: .5pt, tick: (stroke: .5pt)), - legend: (stroke: none, orientation: ttb, item: (spacing: .3), scale: 80%)) + legend: (stroke: none, fill: none, orientation: ttb, item: (spacing: .3), scale: 80%)) plot.plot(size: (12, 8), x-tick-step: calc.pi/2, - x-format: plot.formats.multiple-of, + x-format: axes.format.multiple-of, y-tick-step: 2, y-min: -2.5, y-max: 2.5, legend: "inner-north", { let domain = (-1.1 * calc.pi, +1.1 * calc.pi) for ((title, f)) in fn { - plot.add-fill-between(f, f1, domain: domain, + plot.add.fill-between(f, f1, domain: domain, style: (stroke: none), label: title) } - plot.add(f1, domain: domain, label: $ sin x $, + plot.add.xy(f1, domain: domain, label: $ sin x $, style: (stroke: black)) }) }) diff --git a/src/charts/bar/clustered.typ b/src/charts/bar/clustered.typ index a923af6..9d5995f 100644 --- a/src/charts/bar/clustered.typ +++ b/src/charts/bar/clustered.typ @@ -68,9 +68,10 @@ series-data.push( ( label: if label-key != none {labels.at(series-index)}, - data: for (observation-index, observation) in data.enumerate() { + data: for (observation-index, observation) in data.enumerate() { let x = observation-index - cluster-width/2 + series-index * (bar-width + bar-spacing) + bar-width/2 let y = observation.at(y-key, default: 0) + (( x: x, y: y, @@ -96,4 +97,4 @@ axes: axes, ..plot-args, ) -} \ No newline at end of file +}