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

pie label label should use g element #1833

Open
gordonwoodhull opened this issue May 3, 2021 · 1 comment
Open

pie label label should use g element #1833

gordonwoodhull opened this issue May 3, 2021 · 1 comment

Comments

@gordonwoodhull
Copy link
Contributor

gordonwoodhull commented May 3, 2021

It's pretty common to want to add or change the stuff that goes into the pie slices. Right now you have to calculate the position yourself, and animations don't come out right.

We use g elements for the slices themselves, but this doesn't really help for adding images at the center where labels would go, as asked in this SO question:

https://stackoverflow.com/questions/67340109/how-to-add-icons-in-dc-js-piechart-slices-instead-texts

This has come up before. There are other charts where we put the label in a g and it is helpful.

@gordonwoodhull
Copy link
Contributor Author

Btw, the answer provides a great example of why it's nice that we exposed all the private methods on upgrading to ES6 in v4. It uses both PieChart._buildArcs() and PieChart._labelPosition() and it would be a lot messier without them.

@gordonwoodhull gordonwoodhull changed the title pie label text should use g element pie label label should use g element May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant