Replies: 1 comment
-
|
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 Workaround with SQL Lab + Virtual Dataset: You can fake a multi-level Sankey by unioning your data into a flat source/target/value structure: -- 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, detailSave this as a virtual dataset, then point the Sankey chart at it with 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., 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. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there!
Sankey charts in Superset only support one source and one target, so it is not possible to create a Sankey chart like the one in the following example (random Google Images search):
I saw an old issue regarding this same request, but it was closed in 2023: #3059
It would be nice to have this capability, because many people use Sankey charts in their current dashboarding solutions (such as Splunk, for instance), so it is difficult to migrate to Superset when this is the case.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions