GitHub user manimovassagh added a comment to the discussion: Multidimensional Sankey chart
This is definitely a gap. The current Sankey plugin wraps ECharts' Sankey series type, but only exposes a single source/target pair in the chart controls. ECharts itself fully supports multi-level Sankey diagrams -- the underlying `series.type: 'sankey'` just needs nodes and links arrays with multiple hops. The limitation is in Superset's `transformProps.ts` for the Sankey plugin, which only maps two columns. **Workaround with SQL Lab + Virtual Dataset:** You can fake a multi-level Sankey by unioning your data into a flat source/target/value structure: ```sql -- Level 1 -> Level 2 SELECT category AS source, subcategory AS target, SUM(amount) AS value FROM my_table GROUP BY category, subcategory UNION ALL -- Level 2 -> Level 3 SELECT subcategory AS source, detail AS target, SUM(amount) AS value FROM my_table GROUP BY subcategory, detail ``` Save this as a virtual dataset, then point the Sankey chart at it with `source`, `target`, and `value` columns. As long as the node names are consistent across levels (i.e., `subcategory` values match between the two unions), ECharts will render the full multi-hop flow. **Caveat:** Node names must be globally unique across all levels. If "Marketing" appears as both a Level 1 and Level 3 category, you'll get unexpected links. Prefix them if needed (e.g., `L1: Marketing`, `L3: Marketing`). For a proper fix, the Sankey plugin would need to accept an arbitrary number of dimension columns and generate the links array by chaining adjacent pairs. That would be a solid contribution if anyone's looking for a way into the Superset plugin ecosystem. GitHub link: https://github.com/apache/superset/discussions/38713#discussioncomment-16233514 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
