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

Getting the percentage and label for a slice #2273

Closed
4rianton opened this issue Mar 23, 2017 · 1 comment
Closed

Getting the percentage and label for a slice #2273

4rianton opened this issue Mar 23, 2017 · 1 comment

Comments

@4rianton
Copy link

I want to add a unit test in my application that allows me to verify that the data on the Piechart is being correctly displayed.

I would therefore need to get the name and percentage value of each slice. What is the simplest way to do it?

Currently I can only extract the name of the slice and not the percentage. The name extraction too is very complex:

((statsView.chart.data?.dataSets[0] as! PieChartDataSet).values[0] as! PieChartDataEntry).label!

((statsView.chart.data?.dataSets[0] as! PieChartDataSet).values[0] as! PieChartDataEntry).value

Thanks

@liuxuan30
Copy link
Member

add whatever code you need to get.. The library can't forecast you need to get a label and give you a short way in advance.

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

2 participants