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

How to custom axis' label in horizontal bar chart #3270

Closed
dekphoenix opened this issue Feb 16, 2018 · 5 comments
Closed

How to custom axis' label in horizontal bar chart #3270

dekphoenix opened this issue Feb 16, 2018 · 5 comments

Comments

@dekphoenix
Copy link

dekphoenix commented Feb 16, 2018

here is my horizontal bar chart
img_0283
but I want custom to it
screenshot at feb 16 14-30-12

My horizontal bar chart doesn't zoom and scrollable
I try to use chartView.xAxis.valueFormatter = IndexAxisValueFormatter(values: ["2551","2552","2553","2554","2555","2556","2557","2558","2559","2560"])

but it only works at the first bar only

what should I do for customize like 2nd image

@liuxuan30
Copy link
Member

just debug stringForValue to see anything wrong.
for the interval, you have to override computeAxisValues to return every value for your bars to axis.entries. So every bar will have a x axis label.

@jjatie I'm feeling too many people asking how to set x label for every line dot/bar. We might want to support that in 4.0 release.

@annjawn
Copy link

annjawn commented Feb 22, 2018

I think that would be a splendid idea. Right now, it's a little unclear how to use the IndexAxisValueFormatter feature. Atleast, some documentation where it says that we must use the IAxisValueFormatter protocols stringForValue() method in order to compute the xAxis labels based on the data points and the labels array.

The one response that helped me solve the problem is - #1909 (comment)

@liuxuan30
Copy link
Member

apparently there are many things we could improve, but not without everyone's help. Usually it's just jjatie and me doing daily maintenance. You are welcome to add some documentation and maybe improve the sample formatters.

@annjawn
Copy link

annjawn commented Feb 23, 2018

@liuxuan30 absolutely. I just started using the lib. I will be more than happy to add some documentation, but I am not sure if there is a separate Github wiki or you guys hope to have Github Pages, or is it just the md file you want to update.

@liuxuan30
Copy link
Member

not sure haha. It used to refer its android portion for documentation

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

3 participants