Skip to content

Conversation

bernardobelchior
Copy link
Member

Related to #18267 (comment).

Allow customizing scatter preview marker size.

Screen.Recording.2025-07-07.at.16.50.18.mov

@@ -36,6 +36,10 @@ const seriesProcessor: SeriesProcessor<'scatter'> = ({ series, seriesOrder }, da
labelMarkType: 'circle' as const,
markerSize: 4,
...seriesData,
preview: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where to document this feature. It's scatter-only, so it doesn't really make sense to document it in the zoom and pan section, but the scatter chart doesn't contain any information about zoom and preview 🤔

Any suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zoom&pan page I guess. Doesn't make sense to add it to scatter page I think

@mui-bot
Copy link

mui-bot commented Jul 7, 2025

Deploy preview: https://deploy-preview-18726--material-ui-x.netlify.app/

Updated pages:

Bundle size report

Total Size Change: ▼-34.9KB(-0.26%) - Total Gzip Change: ▼-6.54KB(-0.16%)
Files: 122 total (0 added, 0 removed, 21 changed)

Show details for 100 more bundles (22 more not shown)

@mui/x-charts-pro/ChartZoomSliderparsed: 🔺+54B(+0.05%) gzip: 🔺+16B(+0.05%)
@mui/x-charts/BarChartparsed: ▼-1.75KB(-0.83%) gzip: ▼-338B(-0.52%)
@mui/x-chartsparsed: ▼-1.75KB(-0.57%) gzip: ▼-339B(-0.37%)
@mui/x-charts-pro/ChartContainerProparsed: ▼-1.75KB(-0.98%) gzip: ▼-330B(-0.59%)
@mui/x-charts-pro/ChartDataProviderProparsed: ▼-1.75KB(-1.02%) gzip: ▼-314B(-0.59%)
@mui/x-charts-pro/FunnelChartparsed: ▼-1.75KB(-0.71%) gzip: ▼-321B(-0.43%)
@mui/x-charts-pro/Heatmapparsed: ▼-1.75KB(-0.76%) gzip: ▼-333B(-0.46%)
@mui/x-charts-pro/PieChartProparsed: ▼-1.75KB(-0.75%) gzip: ▼-328B(-0.45%)
@mui/x-charts-pro/RadarChartProparsed: ▼-1.75KB(-0.85%) gzip: ▼-328B(-0.52%)
@mui/x-charts/ChartContainerparsed: ▼-1.75KB(-1.18%) gzip: ▼-328B(-0.72%)
@mui/x-charts/ChartDataProviderparsed: ▼-1.75KB(-1.24%) gzip: ▼-327B(-0.75%)
@mui/x-charts/Gaugeparsed: ▼-1.75KB(-1.23%) gzip: ▼-308B(-0.70%)
@mui/x-charts/LineChartparsed: ▼-1.75KB(-0.77%) gzip: ▼-324B(-0.47%)
@mui/x-charts/PieChartparsed: ▼-1.75KB(-0.89%) gzip: ▼-334B(-0.55%)
@mui/x-charts/RadarChartparsed: ▼-1.75KB(-0.91%) gzip: ▼-335B(-0.57%)
@mui/x-charts/ScatterChartparsed: ▼-1.75KB(-0.89%) gzip: ▼-342B(-0.57%)
@mui/x-charts/SparkLineChartparsed: ▼-1.75KB(-0.83%) gzip: ▼-320B(-0.49%)
@mui/x-charts-proparsed: ▼-1.74KB(-0.45%) gzip: ▼-341B(-0.29%)
@mui/x-charts-pro/BarChartProparsed: ▼-1.74KB(-0.63%) gzip: ▼-327B(-0.38%)
@mui/x-charts-pro/LineChartProparsed: ▼-1.74KB(-0.62%) gzip: ▼-324B(-0.37%)
@mui/x-charts-pro/ScatterChartProparsed: ▼-1.74KB(-0.65%) gzip: ▼-317B(-0.37%)
@mui/x-charts-pro/ChartsToolbarProparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsAxisparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsAxisHighlightparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsClipPathparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsGridparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsLabelparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsLegendparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsLocalizationProviderparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsOverlayparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsReferenceLineparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsSurfaceparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsTextparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsTooltipparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsXAxisparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/ChartsYAxisparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-charts/Toolbarparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-data-gridparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-data-grid-premiumparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-data-grid-premium/DataGridPremiumparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-data-grid-proparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-data-grid-pro/DataGridProparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-data-grid/DataGridparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickersparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-proparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterDateFnsparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterDateFnsJalaliparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterDayjsparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterLuxonparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterMomentparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterMomentHijriparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/AdapterMomentJalaaliparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DateRangeCalendarparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DateRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DateRangePickerDayparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DateRangePickerDay2parsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DateTimeRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DesktopDateRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DesktopDateTimeRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/DesktopTimeRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/LocalizationProviderparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/MobileDateRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/MobileDateTimeRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/MobileTimeRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/MultiInputDateRangeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/MultiInputDateTimeRangeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/MultiInputTimeRangeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/PickersRangeCalendarHeaderparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/SingleInputDateRangeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/SingleInputDateTimeRangeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/SingleInputTimeRangeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/StaticDateRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers-pro/TimeRangePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterDateFnsparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterDateFnsBaseparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterDateFnsJalaliparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterDayjsparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterLuxonparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterMomentparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterMomentHijriparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/AdapterMomentJalaaliparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DateCalendarparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DateFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DatePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DateTimeFieldparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DateTimePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DayCalendarSkeletonparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DesktopDatePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DesktopDateTimePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DesktopTimePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/DigitalClockparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/LocalizationProviderparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/MobileDatePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/MobileDateTimePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/MobileTimePickerparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/MonthCalendarparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/MultiSectionDigitalClockparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/PickerDay2parsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/PickersActionBarparsed: 0B(0.00%) gzip: 0B(0.00%)
@mui/x-date-pickers/PickersCalendarHeaderparsed: 0B(0.00%) gzip: 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against b5ccb50

@bernardobelchior bernardobelchior added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: charts Changes related to the charts. labels Jul 7, 2025
Copy link

codspeed-hq bot commented Jul 7, 2025

CodSpeed Performance Report

Merging #18726 will degrade performances by 11.74%

Comparing bernardobelchior:scatter-custom-preview-marker-size (b5ccb50) with master (ed7604e)

Summary

❌ 1 (👁 1) regressions
✅ 9 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
👁 ScatterChartPro with big data amount 393.6 ms 446 ms -11.74%

@bernardobelchior bernardobelchior force-pushed the scatter-custom-preview-marker-size branch from 8ff3f2f to b5ccb50 Compare July 8, 2025 07:54
@bernardobelchior bernardobelchior marked this pull request as ready for review July 8, 2025 08:40
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned by how this preview configuration object will grow if we add customization params in it. But I don't have beter solution

@@ -105,7 +103,7 @@ function ScatterPreviewItems(props: ScatterPreviewItemsProps) {
x={dataPoint.x}
y={dataPoint.y}
seriesId={series.id}
size={DEFAULT_MARKER_SIZE}
size={series.preview.markerSize}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
size={series.preview.markerSize}
size={series.preview.markerSize ?? 1}

Comment on lines +39 to +42
preview: {
markerSize: 1,
...seriesData?.preview,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just using the default when needed

Suggested change
preview: {
markerSize: 1,
...seriesData?.preview,
},

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have a single place where we define the defaults rather than having the defaults spread across the consumers of these fields.

I think it's easier if the components consuming the state don't need to know the default values.

What's your concern with doing this in the series processor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just that we create a new preview object for little reasons

Adding default values to a configuration at the root of the processing pipeline is useful if it's used at multiple places.

But rendering options like markerSize are only used in one place with no side effects.
It should only appear if the user creates their own preview rendering. And in that case, I doubt they care about our default values

But clearly not a big deal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So your concern is mostly performance?

I agree that it's unnecessary, but it's also likely negligible since this only runs once per series, and it's unlikely there will be many series.

Nevertheless, I'll check if the series processor has any impact in large charts.

@bernardobelchior bernardobelchior merged commit d9a463e into mui:master Jul 9, 2025
29 checks passed
@bernardobelchior bernardobelchior deleted the scatter-custom-preview-marker-size branch July 9, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: charts Changes related to the charts. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants