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

xAxis.axisMaxValue is never considered #1293

Closed
velthune opened this issue Aug 5, 2016 · 5 comments
Closed

xAxis.axisMaxValue is never considered #1293

velthune opened this issue Aug 5, 2016 · 5 comments

Comments

@velthune
Copy link

velthune commented Aug 5, 2016

As in title, I set the property but does not change anything:

let view = LineChartView()
view.xAxis.axisMinValue = 6
view.xAxis.axisMaxValue = 14

on 'axisMinValue' change, graph is drawn as I expect, but changing 'axisMaxValue' nothing happens.

@liuxuan30
Copy link
Member

liuxuan30 commented Aug 5, 2016

currently it's just for y axis. for x axis, use setVisibleXRange()

@danielgindi will v3 solve this issue?

@velthune
Copy link
Author

velthune commented Aug 5, 2016

No, I've already tried using "setVisibleXRange", but still doesn't work unfortunately

@liuxuan30
Copy link
Member

liuxuan30 commented Aug 5, 2016

@velthune it should work, I have tested it.

If you call this method, chart must have data or it has no effect

which means you have to call setVisibleXRange() after chartView.data = chartData

@velthune
Copy link
Author

velthune commented Aug 5, 2016

Can you try with this values?

X - VALS
    [-1...15] with -1 and 15 includes

Y - VALS
    X: -1 Y: 0.0
    X: 1 Y: 0.0
    X: 3 Y: 0.0
    X: 5 Y: 0.0
    X: 7 Y: 0.0
    X: 9 Y: 48.0
    X: 11 Y: 24.0
    X: 13 Y: 0.0
    X: 15 Y: 0.0

These are values, and I want too see graph in range [0...14]

I use:

self.viewChart.xAxis.axisMinValue = 0
self.viewChart.setVisibleXRange(minXRange: 14, maxXRange: 14)

My chart is drawn in this way:

But I expect that points will centered on days segments.

@liuxuan30
Copy link
Member

liuxuan30 commented Aug 6, 2016

my bad, seems I misunderstand.

/// Limits the maximum and minimum value count that can be visible by pinching and zooming.
/// e.g. minRange=10, maxRange=100 no less than 10 values and no more that 100 values can be viewed
/// at once without scrolling
public func setVisibleXRange(minXRange: CGFloat, maxXRange: CGFloat)

Try this, should work:

_chartView.data = data;
[_chartView setVisibleXRangeWithMinXRange:1 maxXRange:15];
[_chartView moveViewToX:1];

Please note, calling setVisibleXRange() will zoom your chart. Not sure what's your use case

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