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

Can't set x axis offset #677

Closed
pawelurb opened this issue Jan 14, 2016 · 3 comments
Closed

Can't set x axis offset #677

pawelurb opened this issue Jan 14, 2016 · 3 comments

Comments

@pawelurb
Copy link

Hello,

I have a problem with a CombinedChartView which I'm trying to fix but I can't find a decent solution. Here's a screenshot of the chart:
chart_problem

As you can see the LineChartDataSet which I have doesn't start directly at the beginning of horizontal axis. There is a small offset which I'm trying to eliminate and I would like the dataset to start directly from the zero position of X axis, so basically what I'm trying to achieve is that:
chart_fixed
(actually that's not a screenshot but the previous one edited in an image editor, anyway I think you get the point)

I guess that's not a big deal to implement, but I'm trying to find a solution how to achieve that and I'm not able to. I hope that you will be able to help me with it. Thank you!

@pawelurb pawelurb changed the title Can't set fix axis offset Can't set x axis offset Jan 14, 2016
@pmairoldi
Copy link
Collaborator

Can you not subtract an amount from your X values so that it does start at zero?

@pawelurb
Copy link
Author

@petester42 thank you for reply! Could you show me an example code how to do that?

@pmairoldi
Copy link
Collaborator

if you take the chart demo line chart and look at where the data set is created you can see it creates X and Y values. Just take the X array and loop through it while subtracting the correct amount from each one.

As far as what the correct value is (if it is not constant) then you can subtract the smallest X value in your data set.

That should result in what you are trying to achieve.

@pawelurb pawelurb closed this as completed Mar 6, 2016
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