Closed namednil closed 1 month ago
First one:
#slide(
repeat: data2.len(),
self => [
#cetz-canvas({
cetz.draw.set-style(legend: (fill: white))
cetz.chart.columnchart(
mode: "clustered",
size: (20, 9),
label-key: 0,
value-key: (..range(1, 5),),
bar-width: .8,
y-tick-step: 5,
data2.slice(0, self.subslide) + (([], 0, 0, 0, 0),) * (data2.len() - self.subslide),
labels: ([Low], [Medium], [High], [Very high]),
legend: "legend.inner-north-east",
)
})
],
)
Second one:
#slide(self => [
#let (only, uncover) = utils.methods(self)
#cetz-canvas({
import cetz.plot
import cetz.draw: *
plot.plot(
size: (10, 10),
name: "plot",
x-tick-step: none,
y-tick-step: none,
{
only("1-", plot.add(((0, 0), (1, 1), (2, .5), (4, 3))))
only("2-", plot.add(((0, 2), (1, 1), (2, 1.5), (4, 1.5))))
plot.add-anchor("pt", (1, 1))
},
)
(pause,) * 2
line("plot.pt", ((), "|-", (0, 1.5)), mark: (start: ">"), name: "line")
content("line.end", [Here], anchor: "north", padding: .1)
})
])
Thank you so much for the quick response! It works like a charm, and repeating slides for this makes a lot of sense!
Just for reference, the second one can also be handled more similarly to the first one:
#slide(
repeat:3,
self => [
#let (only, uncover) = utils.methods(self)
#cetz-canvas({
import cetz.plot
import cetz.draw: *
plot.plot(
size: (10, 10),
name: "plot",
x-tick-step: none,
y-tick-step: none,
{
only("1-", plot.add(((0, 0), (1, 1), (2, .5), (4, 3))))
only("2-", plot.add(((0, 2), (1, 1), (2, 1.5), (4, 1.5))))
plot.add-anchor("pt", (1, 1))
},
)
only("3-", {
line("plot.pt", ((), "|-", (0, 1.5)), mark: (start: ">"), name: "line")
content("line.end", [Here], anchor: "north", padding: .1) })
})
])
Touying is amazing - thank you for creating it!
How would you uncover parts of a chart in multiple steps, e.g. first only show the bars for 15-24, then add the bars for 25-29 etc.
And could you do the same to uncover the lines of a plot, e.g. show the first line, show the second line, then show the arrow