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

Display the last label to the x axis #37

Closed
ghost opened this issue Oct 16, 2016 · 11 comments
Closed

Display the last label to the x axis #37

ghost opened this issue Oct 16, 2016 · 11 comments

Comments

@ghost
Copy link

ghost commented Oct 16, 2016

The last char (here "D") is not displayed.

var labelsAsString: Array = ["L", "M", "M", "J", "V", "S", "D"]
stats.xLabelsFormatter = { (labelIndex: Int, labelValue: Float) -> String in
return labelsAsString[labelIndex]
}

Even if we use xLabelsTextAlignment = .left

capture d ecran 2016-10-16 a 14 24 28

capture d ecran 2

@theduman
Copy link

if you create one more data without adding a xlabel for it.it shows the last label that you wanted.Your last xlabel still there but it needs one more chart data to shown.Its a bug i think.

@gpbl
Copy link
Owner

gpbl commented Oct 17, 2016

Hi people, yes this is a wanted behaviour, I still need to understand what's the best thing to do here. Where should the missing label go? What are your expectations?

@theduman
Copy link

Hi gpbl.Thanks for your respond.According to my project, i got (n) number data and (n) number xlabel for that data.xLabel is created right after the my data appeared in my chart.But when my last data appeared in chart view,chart ends.If there is a way to expand chart view without data so i can fit my last xlabel?Thanks for your attention.

@ghost
Copy link
Author

ghost commented Oct 17, 2016

I think it will be better if we can see all labels even if you need to add a margin. Thank you.

@gpbl
Copy link
Owner

gpbl commented Oct 17, 2016

@Cyphontin so in your first case how should it look the chart? Where would you put the D?

@ghost
Copy link
Author

ghost commented Oct 18, 2016

Is something like this possible ?
chart

@gpbl
Copy link
Owner

gpbl commented Feb 12, 2017

Yup this is something we could support, we should just remove [this line]. I need however to double check how does it works as the the labels would span outside the chart area.

@gpbl gpbl changed the title Last xLabelsFormatter not visible Display the last label to the x axis Feb 12, 2017
@rjong
Copy link

rjong commented Mar 6, 2017

+1

1 similar comment
@scinfu
Copy link

scinfu commented May 1, 2017

+1

@gpbl gpbl closed this as completed in 73cc103 May 20, 2017
@gpbl
Copy link
Owner

gpbl commented May 20, 2017

I've published v0.5.0 with a new option xLabelsSkipLast. Set it to false if you want to display the last label as well.

However, the label will overflow the chart width (this is the reason it is set to false as default). Since this seems a common feature request, please someone send a PR to try solving this issue 🙏🏽

@ghost
Copy link
Author

ghost commented May 21, 2017

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants