[Draft] Just test on Argos the impact of experimentalFeatures.useNewDefaultTickSpacing#22732
Draft
alexfauquette wants to merge 12 commits into
Draft
Conversation
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
Deploy previewBundle size
PerformanceTotal duration: 1,574.55 ms -354.76 ms(-18.4%) | Renders: 63 (▼-4) | Paint: 2,303.25 ms -488.49 ms(-17.5%)
…and 6 more (+15 within noise) — details Check out the code infra dashboard for more information about this PR. |
Contributor
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
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.
No description provided.