-
-
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
highlightValue is throwing "fatal error: Index out of range" in Combined Chart #2076
Comments
can you give where it crashes? You have to post the back trace so we know more details.. |
My bad sorry about that, below is the full back trace of the error.
|
It says you crashed at:
which is: can you check what's dataObjects count, and what highlight.dataIndex you want to get? What's the layout of your dataObjects? It's easy to debug from here on your side, so you know what's wrong. either you don't add the data correctly or something else, but I have no idea. I am seeing |
Same problem after upgrading from Swift 2 to Swift 3 - I try to highlight a value with Up the callstack a Highlight objects get created with y=NaN
...
Am I using this wrong? It worked with the Charts 2.x ... |
don't hijack other's thread when your issue is not the same. y = NaN do not tell it's the same
why your dataIndex is -1. |
@prajeshpeter double check your highlight object dataIndex. I think you are not using the right API, as combined chart data consists of sub chart data, like bar data, line data. If you don't give a valid dataIndex, it will be -1 and crash. |
@liuxuan30, could you please advice me the correct API and how to use it with Few lines of code as sample. It is very much important for me to get fixed this issue.
Both are crashing, I have tried more APIs. I can only specify the dataSetIndex . I am using charts(3.0.1)version
|
It's not
you have to create a highlight object manually, and set Other convenient methods are just wrappers if I remember correctly, they don't touch I am closing this since it's old and I think we have the answer. |
Thank you very much, I got it... |
Did you solve this problem? @prajeshpeter ,I still have this problem,If you have solved it, please give me some advice,Thank you very much |
ChartHighlight *chartHighlight = [[ChartHighlight alloc] initWithX:1.0 y:800.0 xPx:0.0 yPx:0.0 dataIndex:1 dataSetIndex:0 stackIndex:0 axis:0]; [self.barGraphView highlightValue:chartHighlight callDelegate:YES]; Use the above code to solve the issue ... use y value to solve another unexpected crash... Hope this will be helpful.. .. please let me know if you still face the issue... |
I am using the combined chart (Bar and line) and when I try to highlight the bar programatically using the below code, i get an index out of range error. I am trying to set the first bar in the chart highlighted, but it is not working as expected.
There is no chance of count mismatch between the x and y values or empty count in my code as these checks are placed beforehand and only after the condition is satisfied the chart is set. I even tried setting this after notifyDataSetChanged, but still the issue remains the same.
Strange enough I never encountered this issue in v2.2.5 or before and this issue seems to have arisen in v3.0. Any help would be appreciated, Thanks!
Note: All the highlightValue functions throw this error.
The text was updated successfully, but these errors were encountered: