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

Changing chart data + autoScaleMinMaxEnabled causes crash #1151

Closed
debriennefrancoisjean opened this issue Jun 17, 2016 · 6 comments
Closed
Labels

Comments

@debriennefrancoisjean
Copy link

In this particular project, I need to change my Chart's data following the pressing of a button.

I create a new dataset and set the chart's data this way:

chartView.data = newData
chartView.notifyDataSetChanged()

When my chart has the property autoScaleMinMaxEnabled set to false, this works perfectly.

However, if this property is true, I get an error in func ChartDataSet.calcMinMax(start start: Int, end: Int) at the line:

for i in start ... endValue

Because start's value is greater than endValue.

Any ideas?

@debriennefrancoisjean
Copy link
Author

I noticed that start is derived from lowestVisibleXIndex. I've tried moving the chart to index 0 after setting data and still no luck.

@liuxuan30
Copy link
Member

are you able to fix it? Seems like the calc here is wrong. What's the start and end value?

Is it reproducible with ChartsDemo? If you can provide some code to reproduce with ChartsDemo, that's better.

@liuxuan30 liuxuan30 added the bug label Jun 17, 2016
@debriennefrancoisjean
Copy link
Author

I might have to dig deeper. My finding is that the chart needs to be scrollable (so that it shows a subset of the data).

After new data is set on the chart, it's hanging on to the old lowestVisibleXIndex (which might be greater than the number of items in the current chart) and not resetting it properly.

@debriennefrancoisjean
Copy link
Author

I don't think any of the ChartsDemo examples are scrollable, are they?

@liuxuan30
Copy link
Member

if you zoomed in, they are. You can turn on autoScaleMinMaxEnabled via options button in any chart view controller to see if you can reproduce

@danielgindi
Copy link
Collaborator

I don't seem to be able to reproduce this on Charts 3.0, please check again on 3.0 and re-open the issue if it persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants