Vega-Lite API Stack Sorting Struggle
This visualization shows suicide rates aggregated by year and age group, with bars stacked by age. The color legend uses a custom sort order, but the stacking order of the bars fails to match that order, highlighting a mismatch in the Vega-Lite API. The code uses `vl.aggregate` to sum suicides, `vl.markBar`, and encodes color and order with `fieldO('age')` and a custom `sort` array. Data comes from a CSV loaded via `d3.csv`, and the visualization is rendered using the Vega-Lite API with D3 v5.