-
-
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
32 bit Device not handling high x-values #3507
Comments
I was really getting confused by this, because 32 bit device should still be able to hold that size of integer, but realizing it now the Entry stores it as a Double. Ive been looking around for a while and from what I can tell 32 bit devices cant actually use doubles, but instead use floats. Could this be the issue that the 32bit device is restricted to floats, which possibly restricts the max size for the x-value? Edit:I just did some testing in playground and a max 32bit Int is well within the limits if a float, Even able to be converted, but I believe the issue is with Significant figures. Floats only have 6 significant figures whereas my x value(x: 1528833348.0) has 10 sig figs. therefore until the last digit was increased a new point was not printed. Is there a way to have the datapoints x values stored as an integer instead of float |
I remember we used to see users reporting 32bit device issues like ##2583, #1737, #1679. I suspect it's still due to 32bit and 64bit precising issue, as CGFloat is Float on 32bit device, while it's Double on 64bit device. And Double is more precise. I am feeling if you are sure it's about 32bit and 64bit, there's basically nothing we can do as it's a closed hardware and software of Apple. Either it's a bug or by design. What I suggest is you simply move on, as iPhone 5 and iPod is in history. You don't have to worry about it or just abandon the support, not worthy to make it work... If you really think you should support that, then follow what #1679 does or subtract 1528833000 to make some tricks to make it work on a 32bit device. |
@liuxuan30 Is there any way to have the x-value stored as an Int? for my use case I don't need it to be CGFloat and the extra significant figures I gain from using an Integer would fix my issue I belive |
I don't think it's about Int. Int is way more smaller than even float. And drawing on screen require CGFloat. You will do the convert anyway. |
What did you do?
I have a graph representing live data values. Every second a new point is added to the data, x-value being time in seconds, and y-value being a measured value from an external device. This was working perfectly when I was using a different system to represent time(first datapoint was 0 seconds) but I changed it so that my data source stores all the points with their time in seconds(since 1970 I believe) because I wanted to be able to save the data set and view it in other places and so the time needed to be stored since 1970 and not starting at 0. The issue was not immediately showing as I was using a 64 bit device(iPhone 6S+) and this new system I implemented worked exactly as it should. But as I was testing on other devices for compatibility a 32 bit iPod was not able to work with this new system.
What did you expect to happen?
Here is what it should look like:
Here is what the data set looks like(only posted a few values):
ChartDataEntry, x: 1361.0, y 8.0
ChartDataEntry, x: 1362.0, y 18.0
ChartDataEntry, x: 1363.0, y 22.0
ChartDataEntry, x: 1365.0, y 22.0
ChartDataEntry, x: 1365.0, y 26.0
ChartDataEntry, x: 1366.0, y 30.0
What I did to get this to work here was take the stored x value and subtract 1528833000 from it, technically I could just subtract the the greatest multiple of 86400(24 hours) still less than the value, therefore still getting me the correct time of day, but I would rather find a better fix to this issue.
What happened instead?
Here is what it does look like:
Here is what the data set looks like(only posted a few values):
ChartDataEntry, x: 1528833342.0, y 128.0
ChartDataEntry, x: 1528833343.0, y 126.0
ChartDataEntry, x: 1528833344.0, y 128.0
ChartDataEntry, x: 1528833345.0, y 130.0
ChartDataEntry, x: 1528833346.0, y 132.0
ChartDataEntry, x: 1528833347.0, y 138.0
ChartDataEntry, x: 1528833348.0, y 136.0
If you really want I can post what it looks like on the iPhone 6S+ I can, but I can assure you that it looks exactly like it does in the first screenshot but without subtracting from the x-values, so they would be something in the size of this(x: 1528833348.0). Now I am not sure if this is to do with the iPod being a 32 bit device but that is my best guess. Also the entries were gotten from "Graph.data?.dataSets[0]" and so up to that point the values looked fine, and I wasn't sure where I could go to find where the x-values go wonky
Charts Environment
Charts version/Branch/Commit Number:Version 3.1.1
Xcode version:9.2 (9C40b)
Swift version:4.0
Platform(s) running Charts:iPhone 6S+(iPhone7,1), iPod5,1
macOS version running Xcode:10.13.5 (17F77)
Demo Project
My project requires the connection to a bluetooth device in order to function, It should be easily reproducible if I understand it correctly. Just create a chart using a line chart data set with very high x-values on a 32bit device
The text was updated successfully, but these errors were encountered: