-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Crash when calling func highlightValue(x: Double, dataSetIndex: Int, callDelegate: Bool)
#2840
Comments
You can pass
Before that you create the highlight object you need to calculate dataIndex carefully when you manually call it. |
Or we add a new method to pass |
…ls. Default is -1
…ls. Default is -1
Not sure how this is an However, seems like the fixes you've created would solve it. |
@everlof because you use the wrong API as they don't have |
@liuxuan30 I agree. This sounds like a problem with documentation more than anything else, but your #2852 also works ; ) |
I use charts version 3.0.2.
I call
highlightValue
like this:highlightValue(x: 2, dataSetIndex: 0, callDelegate: true)
.I then get a crash here:
When following the code stack trace from the crash:
Stack trace step 5:
Row 522 in ChartViewBase.swift
The
Highlight
object is created withx=2
,y=Nan
,dataSetIndex=0
.Step trace step 4:
The
Highlight
object is then passed toentryForHighlight
on row 547 in ChartViewBase.swift.Then it crashes with
Index out of range
on row 278 in CombinedChartData:let data = dataObjects[highlight.dataIndex]
Because
highlight.dataIndex
is-1
, since it's not set from the constructor. The constructor that is used is:Where
highlight.dataIndex
is not initialized.The text was updated successfully, but these errors were encountered: