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

PieChart legend.yOffset bug #2552

Closed
iad24 opened this issue Jun 23, 2017 · 3 comments
Closed

PieChart legend.yOffset bug #2552

iad24 opened this issue Jun 23, 2017 · 3 comments

Comments

@iad24
Copy link

iad24 commented Jun 23, 2017

I have this code:

pieChartView.delegate = self
pieChartView.legend.enabled = false
pieChartView.drawEntryLabelsEnabled = false
pieChartView.drawCenterTextEnabled = true
pieChartView.holeRadiusPercent = 0.95
pieChartView.drawSlicesUnderHoleEnabled = false
pieChartView.highlightPerTapEnabled = false
pieChartView.chartDescription = nil

pieChartView.legend.horizontalAlignment = .center
pieChartView.legend.verticalAlignment = .bottom
pieChartView.legend.orientation = .vertical
pieChartView.legend.drawInside = false

// pieChartView.legend.yOffset = 10.0 // it u comment this one, it will clip the legend

it always clip the last the legend, irregardless of how many entries in the data set.
screen shot 2017-06-23 at 5 54 52 pm

screen shot 2017-06-23 at 5 56 10 pm

I need to put this line to move it up close to the pie chart:
pieChartView.legend.yOffset = 10.0

screen shot 2017-06-23 at 5 58 58 pm

If I set to -10.0, it will clip some more.
pieChartView.legend.yOffset = -10.0

@liuxuan30
Copy link
Member

what's your problem again? you set yOffset, it seems working fine; you set yEntrySpace and it works fine as well.

@iad24
Copy link
Author

iad24 commented Jun 27, 2017

@liuxuan30 my issue is that yOffset does not work. If you don't set a positive value into it, it will clip the last part of the legend. The orange part is another view.

@liuxuan30
Copy link
Member

liuxuan30 commented Jun 30, 2017

yOffset does not work. If you don't set a positive value into it

so you set a positive value and it will not clip? Sounds like it's working...

BTW, have you checked open func renderLegend(context: CGContext)? It should be very simple, take the yOffset and apply to the y position, nothing more.

About the clip - there's lot to check: contentRect, view bounds etc, so maybe it's not yOffset problem.

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