Hello! I am trying to render a stacked bar chart, and I'd like each of the segments in a bar to be a different color. My simple mind says that'd need an array eg: ``` fill: (red, blue,green,yellow) ``` That does not work for me. ``` #let data = ( ([1], 1,3,5,7,9), ([2], 2,3,4,5,6), ([3], 5,6,7,8,9) ) #canvas({ chart.barchart(mode: "stacked", size: (3, auto), bar-style: (fill: (red, blue, green, yellow)), value-key: (..range(1, 6)), x-tick-step: 6, data ) } ) ``` ``` error: expected color, gradient, tiling, or none, found array ``` I've tried a few other things, but I am clearly clueless. Please advise!
Activity
johannes-wolf commentedon Jan 21, 2026
Hello :). The argument
bar-styletakes a function<int> => <dictionary>which must return a style dictionary: