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][PieChart] prop.slots and prop.slotProps not passed to <ChartsTooltip /> #12926

Closed
tonytino opened this issue Apr 26, 2024 · 2 comments · Fixed by #12939
Closed

[charts][PieChart] prop.slots and prop.slotProps not passed to <ChartsTooltip /> #12926

tonytino opened this issue Apr 26, 2024 · 2 comments · Fixed by #12939
Labels
bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module!

Comments

@tonytino
Copy link

tonytino commented Apr 26, 2024

Steps to reproduce

Link to live non-working example (PieChart): https://codesandbox.io/p/sandbox/sleepy-greider-xyc9w2?file=%2Fsrc%2FDemo.tsx%3A46%2C36
Link to live working example (BarChart): https://codesandbox.io/p/sandbox/affectionate-thompson-whdvs2?file=%2Fsrc%2FDemo.tsx%3A9%2C12

Steps:

  1. Implement a basic usage of <PieChart />
  2. Attempt to make a custom tooltip for it using props slots={{ itemContent: CustomComponent}} and tooltip={{ trigger: 'item' }}
  3. Continue to see default tooltip

Current behavior

Default tooltip renders

Expected behavior

Custom tooltip renders

Context

Leverage a custom tooltip for a basic <PieChart /> implementation (i.e. not composition-based).


The PieChart documentation suggests that it should be possible to override the default tooltip by passing a custom component to slots.itemContent. However, as of v7.3.1, this is still not having any impact on the rendering of the tooltip.

image

This appears to be due to the necessary props not being passed along to enable this behavior within PieChart.tsx specifically.

PieChart Implementation

<ChartsTooltip {...tooltip} />

BarChart and LineChart Implementation

<ChartsTooltip {...tooltip} slots={slots} slotProps={slotProps} />

<ChartsTooltip {...tooltip} slots={slots} slotProps={slotProps} />

ScatterChart Implementation

The ScatterChart also appears to have this issue.

<ChartsTooltip trigger="item" {...tooltip} />

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.3
  Binaries:
    Node: 18.20.0 - ~/.nvm/versions/node/v18.20.0/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v18.20.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 124.0.6367.93
    Edge: Not Found
    Safari: 17.3
  npmPackages:
    @emotion/react: 11.11.4 => 11.11.4
    @emotion/styled: 11.11.0 => 11.11.0
    @mui/base:  5.0.0-beta.34
    @mui/core-downloads-tracker:  5.15.14
    @mui/icons-material: 5.15.7 => 5.15.7
    @mui/material: 5.15.7 => 5.15.7
    @mui/private-theming:  5.15.14
    @mui/styled-engine:  5.15.14
    @mui/system:  5.15.14
    @mui/types:  7.2.14
    @mui/utils: 5.15.7 => 5.15.7
    @mui/x-charts: 7.3.1 => 7.3.1
    @mui/x-data-grid: 6.19.10 => 6.19.10
    @mui/x-date-pickers: 6.19.9 => 6.19.9
    @types/react: 18.2.39 => 18.2.39
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0
    typescript: 5.3.3 => 5.3.3

Search keywords: tooltip, slots, slotProps, piechart

@tonytino tonytino added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 26, 2024
@michelengelen
Copy link
Member

@JCQuintas can you please handle this one?

@michelengelen michelengelen added bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module! labels Apr 29, 2024
@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 30, 2024
Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@tonytino: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants