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
Highlight sync #2285
Comments
basically v3 has redesigned x axis, so you have to figure out a way to sync the correct dataSet index calculation. Sorry it's kind of beyond the current scope of this library and I can't tell you what's wrong. But I do know you could sit down and spend sometime to understand what's changed and use the new calculation. |
If you see my post from Sep 15, 2016 you can see that this was working with version 3 before the official release of 3.0.1 Why does it work from the combined to the lower line but not from the line to the upper combined? Again this was not an issue in the pre-released V3. I think > dataIndex (combined charts): -1< is a bug as it did not behave this way in September before the official release. |
Are you able to track down what causes it to be -1? A lot of things can change and for your case, we don't know where it goes off. |
Here is the console output below. I am unsure as to why it is -1. It is stopped at line 278 of CombinedChartData.swift
This seems similar to issue #2076 Same line of code, same error just arrived at differently in the approach. Console output:
|
FYI this is the version that was working:
I am going to try and clone this project and change the charts library to this one as I still have it on hard drive. I will let you know the results when finished copying and testing the project with the old charts version. |
could you check the calculation code? The combinedData is just an array of sub data like bar data, line data, so it will do a mapping. On the other side, were you able to reproduce it with ChartsDemo, so we can take a look? |
Not sure what you are referring to specifically for the calculation code. The combined is a collection of candlesticks and line charts. I will try to simplify and replicate with the demo code and do some digging around to see what I can come up with. Hopefully over the weekend. |
@moon47usaco what I mean is, First, we must know why
You can add some breakpoints or just search "dataIndex =" in the library to see where it gets updated, and if dataIndex is not set at all, or it mistakenly is set to -1 due to some errors. I did a quick check, but can't find any clues yet. |
Thanks, that gives me something to go on.
I will dig into it this weekend and try to reproduce the error in the demo.
…On Thu, Mar 30, 2017 at 7:55 AM, Xuan ***@***.***> wrote:
@moon47usaco <https://github.com/moon47usaco> what I mean is, let data =
dataObjects[highlight.dataIndex] has oob crash, and this is fetching sub
chartData from combinedData.
First, we must know why highlight.dataIndex is -1.
highlgiht.dataIndex is -1 by default, however, to get the real dataIndex,
it should be updated, for example, in getHighlights() of
CombinedHighlighter
You can add some breakpoints or just search "dataIndex =" in the library
to see where it gets updated, and if dataIndex is not set at all, or it
mistakenly is set to -1 due to some errors.
I did a quick check, but can't find any clues yet.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2285 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO_CZ__UsE0da50qU0_m12GrFnYF-K1oks5rqv1kgaJpZM4Mp-w2>
.
|
FYI - I was able to dig up the old V3 that was working before. With the same code and data set these are the values I get from printing the highlight. Clicking in the combined chart gives:
While clicking in the lower line chart (the one that throws the index out of range in 3.0.1) gives:
These are the same values but the old V3 is not throwing an error while V3.0.1 is. Again this is the "Charts-Swift3.0-ChartV3" from when 2.2.5 was the current release.
|
Wait, are you saying your "lower line chart" is not in the combined chart? I looked at your old posts, it looks like there are one upper combined chart and one lower line chart. If so, You need to figure out a mapping that can map your lower line chart into your combined chart by using the highlight class |
I am not specifically using the dataIndex I just remembered it was an issue with 2.2.5 so I though it might be causing the out of bounds error here in 3.0.1. After recompiling the version 3 that did work i realized that the values reported by the highlight were most likely correct. I am using this code below to sync the highlight and it was working in V3 pre release but is broken in version 3.0.1. Yes lower is line and upper is combined.
I am now not sure what is causing the out of bounds but I will try to reproduce the error with the demo on 3.0.1 soon. |
I was able to reproduce the error with Charts Demo. Below link is a repo with three examples: I did not have time to set breakpoints and trace/debug the issue yet but I can try next weekend if I have time. https://github.com/moon47usaco/Charts-3.0.1-Highlight-Sync-Issues |
If you are not using One quick workround is set it to -1 and try, if you do not rely on I checked
this code snippet was added on May 3, 2016 in commit 0e7c26b, when Chart 3.0 is not released, so it's old code. It's weird that you said an early V3 chart does not crash... I need to check more things when I am free. |
Please refer to old issue #1424
I am getting the -1 dataIndex problem again with 3.0.1
This is the print out from clicking in the combined chart (upper chart):
This is the print from highlight when clicking in the (lower) line chart:
dataIndex for the line chart is -1... =[
Clicking in the line chart then throws a "fatal error: Index out of range"
code is now:
The text was updated successfully, but these errors were encountered: