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

getFormattedLabel Index Out of Range #2782

Closed
lfchockey opened this issue Sep 11, 2017 · 1 comment
Closed

getFormattedLabel Index Out of Range #2782

lfchockey opened this issue Sep 11, 2017 · 1 comment

Comments

@lfchockey
Copy link

Hi,

I keep getting an 'index out of range' error in the getFormattedLabel() function.
The strange part is that it only occurs roughly around 5% of the time, and I cannot replicate it for the same set of data.

I retrieve and format JSON from a server and use the information to populate a lineChart.
I customize the xAxis using:
lineChart?.xAxis.valueFormatter = IndexAxisValueFormatter(values: years)

But for some reason this line produces an error every so often:
return valueFormatter?.stringForValue(entries[index], axis: self) ?? ""

I'm not sure how the index could be out of range when a conditional check is done in the lines prior:
if index < 0 || index >= entries.count
{
return ""
}

Any help would be greatly appreciated.

@liuxuan30
Copy link
Member

What's the trace log? This should be easy to know if you post the full stack. You also need to check if you touch you entries on the fly. We can say nothing from what you post.

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