[charts] Unify tooltip item position getter and selector into a single selector API#23041
Merged
alexfauquette merged 19 commits intoJul 6, 2026
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…elector Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…selector Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… selector Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
All series types now compute their item tooltip position through a `selectorTooltipItemPosition` selector, so the parallel `tooltipItemPositionGetter` shape and the generic dispatcher that read it are no longer needed. Remove the getter type, its config field and the core `selectorChartsTooltipItemPosition` dispatcher, and fall back to pointer-following when a series type provides no selector. Closes mui#23033 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
JCQuintas
reviewed
Jul 2, 2026
Comment on lines
+15
to
+18
| export type TooltipItemPositionSelector = ( | ||
| state: ChartState< | ||
| [UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartTooltipSignature] | ||
| >, |
Member
There was a problem hiding this comment.
Should we make this generic like the old getter signature? To accept SeriesType extends ChartSeriesType
Suggested change
| export type TooltipItemPositionSelector = ( | |
| state: ChartState< | |
| [UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartTooltipSignature] | |
| >, | |
| export type TooltipItemPositionSelector<SeriesType extends ChartSeriesType> = ( | |
| state: ChartState< | |
| [UseChartCartesianAxisSignature<SeriesType>, UseChartInteractionSignature, UseChartTooltipSignature<SeriesType>] | |
| >, |
Contributor
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Deploy previewhttps://deploy-preview-23041--material-ui-x.netlify.app/Bundle size
PerformanceTotal duration: 2,165.21 ms +86.06 ms(+4.1%) | Renders: 63 (+0)
…and 2 more (+19 within noise) — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
JCQuintas
approved these changes
Jul 2, 2026
JCQuintas
reviewed
Jul 2, 2026
Comment on lines
+38
to
+39
| const xAxisId = itemSeries.xAxisId ?? xAxes.axisIds[0]; | ||
| const yAxisId = itemSeries.yAxisId ?? yAxes.axisIds[0]; |
Member
There was a problem hiding this comment.
Shouldn't we still check if y/x axes exist? In case user provides wrong id?
JCQuintas
approved these changes
Jul 3, 2026
alexfauquette
enabled auto-merge (squash)
July 6, 2026 08:08
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.
Follow-up from #23011. Closes #23033.
Problem
The series config carried two shapes for positioning an item tooltip:
tooltipItemPositionGetter— a getter that received a resolved{ series, axesConfig, drawingArea, seriesLayout, identifier, placement }bundle, dispatched centrally by the coreselectorChartsTooltipItemPositionselector.selectorTooltipItemPosition— a plain selector reading the chart state directly (introduced for the map series sod3-geostays out of the core bundle).Maintaining both is redundant, as noted in #23011 (comment).
Change
Every series type now positions its item tooltip through a single
selectorTooltipItemPositionselector. Each selector reads only the state it needs (the relevant axes, the series layout, the geo projection, …) instead of receiving the one-size-fits-all bundle, so:ChartSeriesTypeConfig;ChartsTooltipContainerpicks the selector uniformly and falls back to pointer-following when a series type provides none;selectorChartsTooltipItemPositiondispatcher, theTooltipItemPositionGettertype and itsTooltipPositionGetterAxesConfighelper are removed.The position math is unchanged — only the way each series reads its inputs.
Commits
One commit per series type so the conversion is easy to review, then a final commit that drops the getter API:
@mui/x-charts)@mui/x-charts-pro)@mui/x-charts-premium)tooltipItemPositionGettertype, config field and core dispatcherThe map series already used the selector API and is unchanged.
Testing
typescriptpasses for@mui/x-charts,@mui/x-charts-pro,@mui/x-charts-premium.ChartsTooltipunit tests pass (jsdom + browser).🤖 Generated with Claude Code