refactor(demo): Sankey multi-hop + Circle Packing hierarchy (#918, #920) - #963
Conversation
Closes #918 and #920 together — both touch chart-gallery.json's demo queries and only need different SQL to demonstrate what the chart can do. #918 Sankey: was a 2-column "region → status" flow that looked like a stacked bar chart. Now a 4-hop "continent → country → category → status" UNION ALL flow that exercises ECharts' DAG layout properly. Note: continent → *region* (the issue's original proposal) hits "DAG has cycle" because regions are named "South America" / "Oceania" which collide with the continent strings. Switched to country instead — uniquely named, no self-edges. #920 Circle Packing: was a flat 25-row SELECT that degenerated to single-level circles ("defeats the chart's purpose" per the issue). Now a parent-keyed UNION (categories + their products) so the chart renders outer circles per category with inner product circles nested inside. Markdown intros on both pages updated to reflect the new behaviour: - Sankey: "multi-hop flow… any chain just works" - Circle Packing: documents the `name`/`value`/`parent` shape Verified: re-seeded locally, both pages render cleanly (screenshots on the PR). Schema test (demo-showcases) still passes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WalkthroughUpdated chart gallery demo configurations for Sankey and Circle Packing widgets. Sankey now demonstrates a four-level categorical flow across geographic and product dimensions. Circle Packing now displays product-category nesting instead of a flat product list. ChangesDashboard Widget Examples
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/demo/chart-gallery.json`:
- Line 576: The markdown in the "## Sankey diagram" example text currently says
"continent → region → category → status" but the implemented query and widget
title use "continent → country → category → status"; update the example string
(the "content" value under the Sankey diagram entry) to replace "region" with
"country" so the example flow matches the query and widget naming (refer to the
"## Sankey diagram" block and the widget/query that use continent → country →
category → status).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d3ee38ef-e42c-4508-a723-cdf24aaaedae
📒 Files selected for processing (1)
scripts/demo/chart-gallery.json
| "title": "", | ||
| "chartOptions": { | ||
| "content": "## Sankey diagram\n\nFlow visualization between two (or more) categorical dimensions. Query must return `source`, `target`, `value` columns.\n\n**Options shown:** `orient: horizontal`, `showLabels: true`." | ||
| "content": "## Sankey diagram\n\nMulti-hop flow visualization across N categorical dimensions. Query returns `source`, `target`, `value` rows — the chart wires them into a graph automatically, so any chain (continent → region → category → status, etc.) just works.\n\n**Options shown:** `orient: horizontal`, `showLabels: true`." |
There was a problem hiding this comment.
Update the example flow to match the actual query.
The markdown example mentions "continent → region → category → status" but the actual query (line 584) and widget title (line 586) use "continent → country → category → status". Per the PR objectives, country was chosen over region to avoid name collisions. Update the example to match the implementation for consistency.
📝 Suggested fix
- "content": "## Sankey diagram\n\nMulti-hop flow visualization across N categorical dimensions. Query returns `source`, `target`, `value` rows — the chart wires them into a graph automatically, so any chain (continent → region → category → status, etc.) just works.\n\n**Options shown:** `orient: horizontal`, `showLabels: true`."
+ "content": "## Sankey diagram\n\nMulti-hop flow visualization across N categorical dimensions. Query returns `source`, `target`, `value` rows — the chart wires them into a graph automatically, so any chain (continent → country → category → status, etc.) just works.\n\n**Options shown:** `orient: horizontal`, `showLabels: true`."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/demo/chart-gallery.json` at line 576, The markdown in the "## Sankey
diagram" example text currently says "continent → region → category → status"
but the implemented query and widget title use "continent → country → category →
status"; update the example string (the "content" value under the Sankey diagram
entry) to replace "region" with "country" so the example flow matches the query
and widget naming (refer to the "## Sankey diagram" block and the widget/query
that use continent → country → category → status).
Closes #918. Closes #920.
Summary
Two demo-data fixes in `scripts/demo/chart-gallery.json`. Both were demo queries that made the chart look uninteresting — different SQL teaches users what each chart can do.
#918 — Sankey: multi-hop flow
Was a 2-column `region → status` query (visually a stacked bar chart). Now a 4-hop `continent → country → category → status` UNION ALL flow that actually shows off the DAG layout.
#920 — Circle Packing: hierarchical nesting
Was a flat 25-row `SELECT name, value` query — the chart degenerated to single-level circles. Now a parent-keyed UNION (categories with empty `parent` + products under their category name) so the chart renders nested circles per the issue's design intent.
Markdown intros
Both pages' intro markdown was updated:
Verification
🤖 Generated with Claude Code
Summary by CodeRabbit