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

Monthly X-Axis labels (corresponding values) in my LineChart are not at the right position #3858

Closed
1 task done
1800Terran opened this issue Feb 21, 2019 · 1 comment
Closed
1 task done

Comments

@1800Terran
Copy link

1800Terran commented Feb 21, 2019

Hi guys!

I want to build a Chart for my Swift iOS App where I can track when I lifted Y-amounts of weights in the gym. Therefore I neet dates on the X-Axis and some weight-values on the Y-Axis. I use timestamps for the X-Axis. On the X-Axis Labels I don't want to see the exact dates when I trained but rather the rough span of the months. With the formatter I made it that the months show up on the labels, but the labels/the corresponding vertical line are not at the right position.

So my issue is, that the months don't start and end at the right time. How can I manually change the values (and with that the corresponding position) for the months.

For simplification purposes I attached a picture. at the top as X-Axis labels you see values beginning from 1542000000 with a fixed space of 3000000 between them. With the formatter I made it that here are normally the right months. To make it clear I put the line-values at the beginning and at the end of the months. You see for past months the difference gets bigger. With some tweaking of the setLabelCount I make it to look right for a current set of data but when the data changes it will become wrong again.

bildschirmfoto 2019-02-20 um 13 57 50

Are these numbers set in the entries? How can I change/define these?

Since it is my first post here and I am still new at coding, I apologize in advance for any lack of knowledge.

**Charts version/Branch/Commit Number: The newest I think.
**Xcode version: 10
**Swift version: 4.0
**Platform(s) running Charts: iPhone
**macOS version running Xcode:

@liuxuan30
Copy link
Member

please take a look at the ChartsDemo and maybe ask on stack overflow. IMO you shouldn't use timeInterval, just 1,2,3,4 and format it to month.

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