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 can I plot all Axis Value? #3540

Closed
haroldogtf opened this issue Jun 29, 2018 · 5 comments
Closed

How can I plot all Axis Value? #3540

haroldogtf opened this issue Jun 29, 2018 · 5 comments

Comments

@haroldogtf
Copy link

What did you do?

I am using xAxis with IAxisValueFormatter

I want to show these labels:
let months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

What did you expect to happen?

Show all values of my formatter: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

What happened instead?

Not show all, show only: ["Jan", "Mar", "May", "Jul", "Sep", "Nov"]

untitled

Charts Environment

Charts version/Branch/Commit Number: 3.1.1
Xcode version: 9.4.1
Swift version: 4.
Platform(s) running Charts: iOS
macOS version running Xcode: 10.13.5

@chenhaibo
Copy link

the same question !

@CodingEleven
Copy link

CodingEleven commented Jul 4, 2018

So it is the question that how to set the space between the xAxis label !
Maybe you can try this :
xAxis.granularity = 1; //例如 : 如果值为3 , X轴label间隔3个数据显示一个label,X轴将显示1月,4月,7月,10月 . 可以自己修改值实践一下

@haroldogtf
Copy link
Author

I tried to use granularity, but even then the labels did not appear as I expected.

I expected all those visible ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

@bsachetta
Copy link

I've been stumped by the same issue for the last couple of days. I've read a bunch of different solutions but still haven't come up with anything. I think this thread sums it up well: #1340

The thing that isn't making sense to me is: if you have a month for which there is no data (let's say March, or 2 in Int representation), it appears as though your custom value formatter will never call stringForValue(_ value: Double, axis: AxisBase?) with a value of 2.

I'm pretty sure that's why you're seeing the wrong month labels and why I can't get my chart to work either.

@bsachetta
Copy link

See if this thread is helpful at all: #3557. We were able to figure out how to get day of week labels to show even without backing data. The code can easily be modified to support months (I actually had to do that in my project as well - it's pretty straightforward).

Here's the answer I refer to in the issue thread I linked to above: https://stackoverflow.com/questions/51333345/ios-charts-library-x-axis-labels-without-backing-data-not-showing

@jjatie jjatie closed this as completed Sep 17, 2018
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

5 participants