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

[Enhancement] avoidFirstLastClipping should keep the labels centered #619

Closed
dbmrq opened this issue Dec 20, 2015 · 1 comment
Closed

[Enhancement] avoidFirstLastClipping should keep the labels centered #619

dbmrq opened this issue Dec 20, 2015 · 1 comment

Comments

@dbmrq
Copy link

dbmrq commented Dec 20, 2015

I think the avoidFirstLastClipping option should keep the labels centered, like this:
simulator screen shot 20 de dez de 2015 19 36 05

Instead of this:
simulator screen shot 20 de dez de 2015 19 37 13

I can't see why anyone would prefer the last option, which is what happens right now.
This is what I'm doing to achieve what I want:

chartView.xAxis.avoidFirstLastClippingEnabled = false
let left = 10 + 3 * CGFloat(chartDataPoints.first!.characters.count)
let right = 10 + 3 * CGFloat(chartDataPoints.last!.characters.count)
chartView.setExtraOffsets(left: left, top: chartView.extraTopOffset, right: right, bottom: chartView.extraBottomOffset)

So my offsets are increased by three times the number of characters in the respective label.
This is working fine, but since there already is an avoidFirstLastClipping method, I think it should do all that for me. (Maybe by considering the width of the labels and increasing the offset by half of it?)

@danielgindi
Copy link
Collaborator

Seems to me like you are choosing a very specific value for your offsets.
And avoidFirstLastClipping is doing something very specific, which is avoid being clipped, by sliding the values even while scrolling the chart, which provides for smoother experience.

Not everyone wants the labels to bleed out of the content bounds, which can cause two labels being rendered on top of each other.

So, you have those extraOffsets for those kind of situations where you want to do something a little different :-)

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