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

Zero valued slices overlap #305

Closed
christosc opened this issue Aug 17, 2015 · 2 comments
Closed

Zero valued slices overlap #305

christosc opened this issue Aug 17, 2015 · 2 comments

Comments

@christosc
Copy link

Hi,
I'm trying to use ios-charts to show some pie charts. Some of the values of the pie are zero and they seem to overlap one another. For example

screen shot 2015-08-17 at 10 34 33 am

Slices B and C, which have values 0, are completely indistinguishable. Is there some way to have such zero-valued labels not shown on the pie, while leaving them on the legend? I've found a way to achieve this by tweaking PieChartRenderer.swift, but I wondered If there's some better way.

Thank you very much for your work and for any help.

@alinoz77
Copy link

The simple solution is to filter your input array and remove the zero values and add a custom legend.

yourChart.legend.setCustom(colors: [UIColor.redColor(), UIColor.greenColor(), UIColor.blueColor(), UIColor.blackColor()], labels: ["A", "B", "C", "D"])

@christosc
Copy link
Author

That worked great!
Thank you very much for your help!

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