-
-
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 on getMarkerPosition #1034
Comments
whats the error message associated with the crash? |
@aastein
|
what line? what value? |
How many datasets are actually in there? |
@danielgindi:
|
@128keaton I think the error message is clear enough: |
@liuxuan30 its pretty vague to me: |
then can you trace down why dataSetIndex is -1? |
@liuxuan30 I've tried, and the coding style is really confusing to follow, so I couldn't trace it. |
It should be very easy for you: |
@liuxuan30 we have BarLineChartViewBase.swift:
and ChartViewBase.swift:
|
Yes I know the code, but we need to know why dataSetIndex is calculated as -1 |
@liuxuan30 ok. Looks like for some reason this in ChartHighlighter:
is only returning -1 because of the math on the last line...which eventually gets this line: which is literally: |
You mean stackIndex: -1? It is not dataSetIndex. |
@liuxuan30 no, CombinedChart,
|
oh man, you have to say it's a combined chart first. My bad |
@liuxuan30 what do you want me to debug? I'm really confused... I appreciate the help, but I feel like this is an issue with the library, and since I didn't write the library, and the coding styles are so different, its very confusing to peel through, when for the past three months, I've been looking at my code and my head is filled with my style, functions, etc... Just really maddening when this is the last issue I have before I can submit this application on ITC |
follow the call stack to figure out why it returns -1. |
@liuxuan30 ok |
it looks like its something with highlightFullBar |
@danielgindi I had a chat with @128keaton , now he can't reproduce any more, but we were able to several times. Some context: @128keaton calls getMarkerPosition() in custom chartValueSelected delegate. Then, In the picture, highlight object gives a reasonable value, while h is not. I walk through the code, and find that if self is BarLineChartViewBase
&& (self as! BarLineChartViewBase).isHighlightFullBarEnabled
{
h = ChartHighlight(xIndex: h!.xIndex, value: Double.NaN, dataIndex: -1, dataSetIndex: -1, stackIndex: -1)
}
_indicesToHighlight = [h!] However, @128keaton said he never touches highlightFullBarEnabled, so it is false all the time. Anyway, @128keaton can't reproduce anymore, so we keep an eye on for this. |
It might be a Clean->Build issue. If the code shows a clear check for -1 but in runtime it's faulty, then the code was just not recompiled after a pull from the repo. Xcode bug... |
crashes on line #536 in BarLineChartViewBase.swift
getTransformer(data.getDataSetByIndex(dataSetIndex)!.axisDependency).pointValueToPixel(&pt)
One value in the debugger looks off:
dataSetIndex= (Int) =1
My code:
The text was updated successfully, but these errors were encountered: