mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.01k stars 1.24k forks source link

[charts][docs] Charts legend rounded symbols #12538

Open camerondunford opened 5 months ago

camerondunford commented 5 months ago

The problem in depth

We would like to have rounded legend items as a request from our design team.

There are slots for slotProps.legend.itemMarkWidth & slotProps.legent.itemMarkHeight. Would it be possible to have additional configuration attributes such as slotProps.legend.itemMarkRadius?

e.g. Monosnap METRICS: Design 2024-03-22 10-10-36

Setup basic chart with legend. Unable to style the legend symbols beyond height & width.

https://react-wugx2n.stackblitz.io

Your environment

`npx @mui/envinfo` ``` System: OS: macOS 14.3.1 Binaries: Node: 18.16.0 - ~/.asdf/installs/nodejs/18.16.0/bin/node Yarn: 4.1.1 - ~/.asdf/shims/yarn npm: 9.5.1 - ~/.asdf/plugins/nodejs/shims/npm Browsers: Chrome: 123.0.6312.59 Edge: Not Found Safari: 17.3.1 npmPackages: @emotion/react: ^11.11.4 => 11.11.4 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.39 @mui/core-downloads-tracker: 5.15.13 @mui/icons-material: ^5.15.13 => 5.15.13 @mui/lab: ^5.0.0-alpha.168 => 5.0.0-alpha.168 @mui/material: ^5.15.13 => 5.15.13 @mui/private-theming: 5.15.13 @mui/styled-engine: 5.15.11 @mui/system: 5.15.13 @mui/types: 7.2.13 @mui/utils: 5.14.16 @mui/x-charts: ^7.0.0-beta.7 => 7.0.0-beta.7 @mui/x-data-grid: 6.19.6 @mui/x-data-grid-premium: ^6.19.6 => 6.19.6 @mui/x-data-grid-pro: 6.19.6 @mui/x-date-pickers: 6.19.7 @mui/x-date-pickers-pro: ^6.19.7 => 6.19.7 @mui/x-license-pro: ^6.10.2 => 6.10.2 @types/react: ^18.2.67 => 18.2.67 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.4.2 => 5.4.2 ```

Search keywords: charts, legend, round Order ID: Secure Code Warrior Premium plan

trungutt commented 5 months ago

We have a little workaround for this issue

<PieChart
  sx={{
    [`& .${legendClasses.mark}`]: {
      ry: 10,
    },
  }}

Credit to @nico1510, but an attribute would be much better

flaviendelangle commented 5 months ago

Whatevers DX we end up having, I think that one is common enough to justify a doc example :+1: cc @alexfauquette

camerondunford commented 5 months ago

Nice. Thank you for the workaround!