Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[charts] Charts Legend does not have ability to customize by individual legend item #15563

Open
MMShep97 opened this issue Nov 22, 2024 · 2 comments
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@MMShep97
Copy link

MMShep97 commented Nov 22, 2024

The problem in depth

original issue with information: #15560

Hi there! Not sure if this is just a docs update for someone who couldn't figure out the advanced case, or actually a feature request. Thanks in advance!

Legend does not have the ability to customize individual legend items -- specific aim is to make the legend a dotted line just like the line on the graph. I know you can customize every item the same, like in these docs, but not individual pieces. See the image below for the expected/wanted functionality:

image

https://codesandbox.io/p/sandbox/flamboyant-pine-9249sn

Not a bug, just a reproduction of my current code!

Your environment

`npx @mui/envinfo`
  System:
    OS: macOS 15.1
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    pnpm: 9.11.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.86
    Edge: 131.0.2903.63
    Safari: 18.1
  npmPackages:
    typescript: 5.6.3 => 5.6.3 

Search keywords: legend itemMark mark series dotted strokeDasharray charts chart
Order ID: 0332927583

@MMShep97 MMShep97 added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Nov 22, 2024
@github-actions github-actions bot added the component: charts This is the name of the generic UI component, not the React module! label Nov 22, 2024
@michelengelen michelengelen changed the title [question][charts] Charts Legend does not have ability to customize by individual legend item [charts] Charts Legend does not have ability to customize by individual legend item Nov 25, 2024
@michelengelen michelengelen added enhancement This is not a bug, nor a new feature support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 25, 2024
@michelengelen
Copy link
Member

Hey @MMShep97 and thanks for opening an issue here.
I will add this to the board as an enhancement to an existing feature.
It makes sense to have opt-in individual customization IMHO. 👍🏼

@alexfauquette
Copy link
Member

You can target items for a specific series with .MuiChartsLegend-series-five-year-average .MuiChartsLegend-mark

Each legend element has a class MuiChartsLegend-series-[seriesId] on the same idea that the one you used to add dash style to the line chart.

But that will not solve your issue because the items are <rect/> and not line or path so dash-array will not apply.

In this issue, I see two aspects we plan to solve in V8:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
None yet
Development

No branches or pull requests

3 participants