Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[charts] Allow customizing shape in scatter charts #16640

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

bernardobelchior
Copy link
Member

@bernardobelchior bernardobelchior commented Feb 18, 2025

Allow customizing shape in scatter charts by using the marker slot.

This is my first time using slots, so I'm not sure if I'm using them properly and whether the ownerState/additionalProps is well defined.

Still need to write the docs, but at the moment I'm only looking for feedback on the implementation.

@bernardobelchior bernardobelchior added docs Improvements or additions to the documentation enhancement This is not a bug, nor a new feature component: charts This is the name of the generic UI component, not the React module! labels Feb 18, 2025
@mui-bot
Copy link

mui-bot commented Feb 18, 2025

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

Updated pages:

Generated by 🚫 dangerJS against ba795ba

Copy link

codspeed-hq bot commented Feb 18, 2025

CodSpeed Performance Report

Merging #16640 will degrade performances by 20.01%

Comparing bernardobelchior:scatter-chart-shape (ba795ba) with master (15f5a84)

Summary

❌ 1 regressions
✅ 5 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
ScatterChart with big data amount 380.7 ms 476 ms -20.01%

Copy link
Member

@JCQuintas JCQuintas left a comment

Choose a reason for hiding this comment

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

Left some comments, if there are other places you want input, let me know

onClick?: (event: React.MouseEvent<SVGElement, MouseEvent>) => void;
}

export interface ScatterMarkerOwnerState {
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this and merge the props into the ScatterMarkerProps

Copy link
Member Author

@bernardobelchior bernardobelchior Feb 18, 2025

Choose a reason for hiding this comment

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

This is used in Scatter.types.ts and on ScatterMarkerProps, so it's probably better to keep it to avoid duplication.

I'll remove it if we have only one usage.

@bernardobelchior
Copy link
Member Author

The current implementation seems to work, but it's weird that the legend's marker is different from the chart's. I'll think of way to reuse the marker slot.

image

@JCQuintas
Copy link
Member

The current implementation seems to work, but it's weird that the legend's marker is different from the chart's. I'll think of way to reuse the marker slot.

image

A lot of the times, the slots are passed to the top component, which means you should be able to pass it around to the legend component to be used as the marker there. Though a lot of parts will probably need to change 😆

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
component: charts This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants