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] Pie Chart Positioning #13787

Open
josh-thompson13 opened this issue Jul 10, 2024 · 2 comments
Open

[charts] Pie Chart Positioning #13787

josh-thompson13 opened this issue Jul 10, 2024 · 2 comments
Labels
breaking change 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

Comments

@josh-thompson13
Copy link

josh-thompson13 commented Jul 10, 2024

The problem in depth

The legend on my PieChart is overlapping my pie chart. I need a way to ensure my PieChart is as far left as possible. If I set the cx value to 150 that works, however this component will come in varying sizes and therefore I cannot use a fixed value here.

In the image I've supplied you can see the piechart has been given permission to take 75% of the width. So I want the legend to stay in the same spot, but the piechart itself to be moved left. How can I achieve this? Here's my code.

return (
        <>
            <PieChart
                series={dataSeries}
                onItemClick={(event, i) => tapMarker(i.dataIndex)}
                leftAxis={{ position: "left" }}
                style={{ left: 0 }}
            />

            
        </>
    );

Screenshot 2024-07-10 at 2 03 10 pm

Your environment

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: Pie Chart Positioning
Order ID:

@josh-thompson13 josh-thompson13 added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Jul 10, 2024
@alexfauquette alexfauquette added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jul 10, 2024
@alexfauquette
Copy link
Member

You can restrain the area available for the pie by adding a margin props But this is also a fixed placement

The issue with positioning the pie on the left is that the cx position will depend on the height of the drawing area which is not possible for now.

Maybe a solution could be to modify that computation of percent values such that cx='0%' does not mean "the pie center is at the left of the drawing area" but "the pie touch the left of the drawing area while being totally visible"

@michelengelen
Copy link
Member

@alexfauquette should we add this to the board?

@michelengelen michelengelen changed the title [question] Pie Chart Positioning [charts] Pie Chart Positioning Jul 15, 2024
@alexfauquette alexfauquette added the component: charts This is the name of the generic UI component, not the React module! label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change 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
Projects
None yet
Development

No branches or pull requests

3 participants