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] ChartsLegendPropsBase type is broken #14561

Closed
VFritsch opened this issue Sep 10, 2024 · 3 comments · Fixed by #14657
Closed

[charts] ChartsLegendPropsBase type is broken #14561

VFritsch opened this issue Sep 10, 2024 · 3 comments · Fixed by #14657
Labels
component: charts This is the name of the generic UI component, not the React module! typescript

Comments

@VFritsch
Copy link

VFritsch commented Sep 10, 2024

Steps to reproduce

Link to live example: (required)
https://stackblitz.com/edit/react-ndxp8o?file=Demo.tsx%3AL41
Steps:

  1. Import and add <ChartsLegend/> component
  2. Add empty Array to seriesToDisplay property in slotProps -> legend
  3. Object literal may only specify known properties, and 'seriesToDisplay' does not exist in type 'Partial'.

Current behavior

Custom legend can't be used/displayed as seriesToDisplay property does not exist anymore.

Expected behavior

seriesToDisplay property can be accessed again.

Context

No response

Your environment

npx @mui/envinfo
System:
    OS: Windows 11 10.0.22631
  Binaries:
    Node: 22.5.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome: Not Found
    Edge: Chromium (127.0.2651.74)
  npmPackages:
    @emotion/react: ^11.13.3 => 11.13.3
    @emotion/styled: ^11.13.0 => 11.13.0
    @mui/base:  5.0.0-beta.40
    @mui/core-downloads-tracker:  5.16.7
    @mui/icons-material:  5.16.7
    @mui/lab: ^5.0.0-alpha.173 => 5.0.0-alpha.173
    @mui/material: ^5.16.7 => 5.16.7
    @mui/private-theming:  5.16.6
    @mui/styled-engine:  5.16.6
    @mui/system: ^5.16.7 => 5.16.7
    @mui/types:  7.2.16
    @mui/utils:  5.16.6
    @mui/x-charts: ^7.16.0 => 7.16.0
    @mui/x-charts-vendor:  7.16.0
    @mui/x-data-grid:  7.16.0
    @mui/x-data-grid-premium: ^7.16.0 => 7.16.0
    @mui/x-data-grid-pro:  7.16.0
    @mui/x-internals:  7.16.0
    @mui/x-license:  7.16.0
    @mui/x-tree-view: ^7.16.0 => 7.16.0
    @types/react: ^18.3.5 => 18.3.5
    react: ^18.3.1 => 18.3.1
    react-dom: ^18.3.1 => 18.3.1
    typescript:  5.5.4

Browser used: Chrome - Version 128.0.6613.120 (64-Bit)

Search keywords: ChartsLegend, @mui/x-charts, seriesToDisplay

Search keywords:

@VFritsch VFritsch added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 10, 2024
@zannager zannager transferred this issue from mui/material-ui Sep 10, 2024
@zannager zannager added the component: charts This is the name of the generic UI component, not the React module! label Sep 10, 2024
@alexfauquette
Copy link
Member

This look like a TS error.

In your reproduction, the error message come from the fact is not inside the <PieChart /> so it does not have access to the context

This should let the code work

<PieCharts
  ... 
- />
+ >
<ChartsLegend ... />
+</PieChart>

AN the Typescript error message is something to fix on our side

@michelengelen michelengelen changed the title ChartsLegendPropsBase type is broken [charts] ChartsLegendPropsBase type is broken Sep 10, 2024
@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 11, 2024
@Samuel-Therrien-Beslogic

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.

Note

We value your feedback @VFritsch! How was your experience with our support team?
We'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!

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! typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants