Repository navigation
feat(extensions): let an extension draw a chart from form data - #46130
Open
amaannawab923 wants to merge 1 commit into
Open
amaannawab923 wants to merge 1 commit into
amaannawab923 wants to merge 1 commit into
Conversation
An extension that wants to show a chart has had no way to ask for one. The
pieces are all host internals -- the Redux store, `chartAction`'s
`requestChartDataResolved`, `SuperChart` and the plugin registry -- and an
extension cannot reach any of them: `@superset-ui/core` is not shared, and a
bundled copy of it is never configured. So the only options were to
reimplement querying and drawing, or to not draw charts.
`charts.AssetChart` takes the form data and does both. The host runs the
query and hands the result to the plugin the form data names, so what the
extension shows is what that chart would be, and the internals stay
internal:
<charts.AssetChart formData={formData} height={320} />
`formData` is the same object Explore holds, so an extension that already
reads a chart through the API has what it needs. The component owns its
loading state, surfaces the query's own error message, says so plainly when
the form data names no `viz_type`, and contains a plugin that throws while
drawing to the chart's own area.
Deliberately narrow. It queries as an unsaved chart: it does not save, does
not cache against a saved chart, does not apply a surrounding page's
filters, and does not return the rows. A chart to look at, not a data API --
an extension that wants the numbers already has `/api/v1/chart/data`.
amaannawab923
requested review from
geido,
michael-s-molina,
msyavuz,
rusackas,
sadpandajoe and
villebro
as code owners
November 10, 2026 06:23
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
An extension that wants to show a chart currently has no way to ask for one. Every piece it would need is a host internal — the Redux store,
chartAction'srequestChartDataResolved,SuperChartand the plugin registry — and an extension cannot reach any of them:@superset-ui/coreis not shared with extensions, and a bundled copy of it is never configured. The choice today is to reimplement querying and drawing, or to not draw charts.This adds
charts.AssetChart, which takes a chart's form data and does both. The host runs the query and hands the result to the plugin the form data names, so what the extension shows is what that chart would be, and the internals stay internal:formDatais the same object Explore holds for a chart, so an extension already reading a chart through/api/v1/chart/has what it needs. The component owns its loading state, surfaces the query's own error message when the query fails, says so plainly when the form data names noviz_type, and contains a plugin that throws while drawing to the chart's own area.Deliberately narrow. It queries as an unsaved chart: it does not save, does not cache against a saved chart, does not apply a surrounding page's filters, and does not return the rows. It is a chart to look at, not a data API — an extension that wants the numbers already has
/api/v1/chart/data.Ten files, +653 lines, no deletions. New namespace plus its three wiring points (
superset-core's export list andpackage.jsonsubpath,src/core's re-export, and thewindow.supersetbinding inNamespaces.ts/ExtensionsStartup.tsx), and a### Chartssection in the contribution-types docs.Part of making extensions able to carry a feature that shows data. Independent of #45522 — the only overlap is additive lines in the same export lists, so whichever lands second rebases trivially.
TESTING INSTRUCTIONS
superset-frontend/src/core/charts/AssetChart.test.tsxcovers the loading state, a successful draw, the query-failure message, the missing-viz_typemessage, the error boundary around a throwing plugin, and that a stableformDatadoes not re-query.Verified locally:
lib/chartsbuilds so the./chartssubpath resolves,tsc --noEmitis clean, 49 tests pass across 6 suites, eslint clean.ADDITIONAL INFORMATION