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

Chart adds a -1 x-axis entry #1782

Closed
narciero opened this issue Nov 4, 2016 · 2 comments
Closed

Chart adds a -1 x-axis entry #1782

narciero opened this issue Nov 4, 2016 · 2 comments

Comments

@narciero
Copy link

narciero commented Nov 4, 2016

I have a LineChart's xAxis set up with follwing properties:

xAxis.axisMinimum = 0.0
xAxis.granularityEnabled = true
xAxis.labelPosition = .bottom
xAxis.labelTextColor = UIColor.genioWhite()
xAxis.axisLineColor = UIColor.genioGray()
xAxis.drawGridLinesEnabled = false
xAxis.valueFormatter = StringFormatter(["some date strings"])

I then add 3 entries with x-values of 0.0, 1.0, and 2.0 - however this is what my graph looks like:
screen shot 2016-11-03 at 10 28 44 pm

While debugging my xAxis value formatter I found that magically an x axis entry of -1 is being created, hence the extra space to the left...the line chart should (as expected) fill the whole width since only 3 data points were added, yet there are 4

@narciero narciero changed the title Chart decides to randomly add a -1 x-axis entry Chart adds a -1 x-axis entry Nov 4, 2016
@tushuaidianzi
Copy link

能不能把这个demo发给我一下,谢谢

@liuxuan30
Copy link
Member

Take a look at ChartsDemo for different line charts, including time line chart to get started. By default, it will calculate x axis range. If you don't want it, set xAxis.axisMinimum = whatever you like

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