Skip to content

[Draft] Just test on Argos the impact of experimentalFeatures.useNewDefaultTickSpacing#22732

Draft
alexfauquette wants to merge 12 commits into
mui:masterfrom
alexfauquette:test-experimentalFeatures.useNewDefaultTickSpacing
Draft

[Draft] Just test on Argos the impact of experimentalFeatures.useNewDefaultTickSpacing#22732
alexfauquette wants to merge 12 commits into
mui:masterfrom
alexfauquette:test-experimentalFeatures.useNewDefaultTickSpacing

Conversation

@alexfauquette

Copy link
Copy Markdown
Member

No description provided.

JCQuintas and others added 12 commits May 28, 2026 13:42
Add an opt-in experimental feature that automatically reduces the number
of ticks/tick labels on cartesian axes based on the chart's rendered
drawing area, so labels don't pile up on narrow charts.

When enabled, ordinal axes (`band` / `point` scales) receive a default
`tickSpacing` of 50px derived from the drawing area. Continuous axes are
left untouched (their default `tickNumber` is already size-aware via
`getDefaultTickNumber`). The feature never overrides explicit
`tickNumber`, `tickSpacing`, or `tickInterval` values set by the
consumer.

Also refactor `selectorChartExperimentalFeaturesState` to accept the
feature key as an argument and return that feature's value, instead of
returning the whole experimental-features object.
Limit the experimental feature to charts whose `SeriesType` includes
`bar` or `rangeBar` (BarChart, BarChartPro, BarChartPremium,
SparkLineChart with bar series, composition via ChartsContainer, etc.).

- Move the `responsiveTickAdjustment` declaration out of the
  always-on `CommonExperimentalFeatures` block and into a new
  `BarExperimentalFeatures` interface gated by a `HasBarLikeSeries`
  conditional that fires for `'bar'` or `'rangeBar'` series types.
- Add a runtime guard in `selectorChartXAxis` / `selectorChartYAxis`:
  even when the flag is enabled, the feature only applies if at least
  one bar or rangeBar series is present in `formattedSeries`.
- Regenerate proptypes and API docs so `responsiveTickAdjustment` only
  appears on bar-capable charts.
`rangeBar` is added to `ChartsSeriesConfig` via module augmentation in
`@mui/x-charts-premium`. The base `@mui/x-charts` typecheck doesn't
see the key, so the previous `formattedSeries.rangeBar` access broke
CI with TS2339. Use indexed access through an untyped record helper
that stays compatible with both packages.
Rewrite the warning callout to explain that the feature is opt-in to
avoid changing the look of existing charts, not because its behavior
might still change. Note that it's expected to become the default in a
future major.

Also mention that the feature is restricted to bar-like charts and
update the inline code sample to match the new fruits-and-vegetables
demo dataset.
Drop inline comments that restate the code (effective-tick-spacing
`??` chain, the bar-like guard in the selectors) and tighten the
JSDoc on the experimental flag down to what isn't already obvious from
the code or from the docs section. Keep the "why" comments
(`selectorResponsiveTickAdjustment` wrapper rationale,
`hasBarLikeSeries` module-augmentation note).
- `useChartCartesianAxis.test.tsx`: the two tests that assert 20
  tick labels render rely on `getVisibleLabels` not measuring real
  label widths. In the browser, label overlap filtering kicks in and
  fewer labels survive. Gate those two cases on `!isJSDOM` so they
  only run under jsdom. The middle assertion (feature on → fewer
  labels than the band count) holds in both environments and stays
  unrestricted.
- `docs/scripts/formattedTSDemos.js`: the demo returns a control
  panel + chart that exceeds the 16-line default cap of
  `babel-plugin-jsx-preview`, so the auto-generated `.preview`
  file was being deleted on every transpile run and the
  `pnpm docs:typescript:formatted changes committed?` check failed.
  Add a `previewOverride` entry bumping `maxLines` to 40 for this
  demo so the preview is regenerated and stays consistent with the
  committed file.
…d rename prop

Rename the experimental `responsiveTickAdjustment` flag to
`useNewResponsiveTickAdjustment` and make it available on every chart that
can have band/point scales instead of only bar-like charts.

The type now exposes the flag for any cartesian series, and the rendering
selector no longer gates the behavior behind a bar-series check, so ordinal
axes on line, scatter, heatmap, funnel, and spark-line charts thin ticks too.
Rename the experimental `useNewResponsiveTickAdjustment` flag to
`useNewDefaultTickSpacing` across types, selectors, proptypes, API docs,
tests, and the docs demo.
…ick-adjustment

# Conflicts:
#	packages/x-charts/src/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.ts
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 🔺+223B(+0.06%) 🔺+112B(+0.10%)
@mui/x-charts-pro 🔺+223B(+0.04%) 🔺+92B(+0.06%)
@mui/x-charts-premium 🔺+223B(+0.04%) 🔺+94B(+0.05%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,574.55 ms -354.76 ms(-18.4%) | Renders: 63 (▼-4) | Paint: 2,303.25 ms -488.49 ms(-17.5%)

Test Duration Renders
ScatterChartPremium with big data amount and zoomed in (webgl renderer) 97.32 ms 🔺+25.19 ms(+34.9%) 5 (+0)
ScatterChartPremium with big data amount (webgl renderer) 99.51 ms 🔺+20.34 ms(+25.7%) 5 (+0)
LineChart with date axis and big data amount 15.62 ms 🔺+3.19 ms(+25.7%) 2 (+0)
ScatterChartPro with big data amount (batch renderer) 10.11 ms 🔺+2.35 ms(+30.3%) 2 (+0)
RangeBarChart with big data amount 37.31 ms ▼-41.46 ms(-52.6%) 2 (▼-1)

…and 6 more (+15 within noise) — details


Check out the code infra dashboard for more information about this PR.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jun 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: out-of-date The pull request has merge conflicts and can't be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants