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

Last bar not calculated in ChartDataSet.calcMinMaxY #2042

Open
dan-huang opened this issue Jan 7, 2017 · 5 comments
Open

Last bar not calculated in ChartDataSet.calcMinMaxY #2042

dan-huang opened this issue Jan 7, 2017 · 5 comments

Comments

@dan-huang
Copy link

Set a simple BarChartView like BarChartTests.
let values = [8, 104, 1000]
chart.autoScaleMinMaxEnabled = true

screen shot 2017-01-07 at 2 20 45 pm

If set autoScaleMinMaxEnabled = false, then everything ok.

@pmairoldi
Copy link
Collaborator

Usually it is best practice to setup the chart first and then set chart.data = data. Let us know if changing the order fixes your issue.

@dan-huang
Copy link
Author

dan-huang commented Jan 9, 2017

    chart = BarChartView(frame: CGRect(x: 0, y: 0, width: 300, height: 350))
    chart.autoScaleMinMaxEnabled = true
    chart.data = data

Still not fixed. @petester42

@andysharp
Copy link

andysharp commented Feb 13, 2017

I have the same issue with a candlestick chart. It looks to me that the issue is in ChartDataSet.swift, calcMinMaxY(fromX: Double, toX: Double). It iterates the data using indexFrom..<indexTo. Shouldn't this be indexFrom...indexTo otherwise it does not include the last point?

@dan-huang
Copy link
Author

Agree with @andysharp . Should be indexFrom...indexTo in this case.

@liuxuan30
Copy link
Member

Please take a look at #2177, I'm not sure if this can solve the issue, or it's different

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

4 participants