-
Notifications
You must be signed in to change notification settings - Fork 657
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
Data has been down sampling when render with LineChart #192
Comments
Can you add a log in render method to print size of data? |
@wuxudong thanks for you quick response. the size of the is 12000+, |
you can tell from the two pics above that the time duration between them are more than 2 mins, but the original data is only 5 seconds duration. |
What is the origin x value, not the time in 'marker'. |
#160 may help. |
I see, thanks man. This solves my problem. |
@wuxudong after making x value smaller, all data has been rendered. However, I think this is NOT the root cause of this issue, after chasing down the code. First, We do have a date value formater which also has customized date pattern:
Second, DateFormatter should be able to format very very very... large number unix timestamp should NOT be a problem at all. float or long is way larger than timestamp.
|
#160 is just a work around. |
The main problem of using timestamp as x value is data is too sparse. For example, there is an entry like {x:1517369866415, y: 1} '2018-01-31 11:37', and another entry {x:1517373466415, y: 2} '2018-01-31 12:37', |
no, as I said that data I use to render only have 5 seconds difference between each other. such as: |
I am able to fix this locally with a new formater for time series data like this. Pull request has been made, can you please have a check ? |
sorry, I forget that yours is line chart. It should be ok to use Unix time as x in line chart. I have no idea why it looks like this. Maybe you can use some static data to test it. |
I think I find the root cause. The precision lost when converting a long to float or float to long,
I did test
output, which is not expected, is
The precision lost only happens when the number is big, not for small ones, I guess that's why DateSinceFormater works (in the pull request). |
this should be a specific issue for Java, let me try another way, convert unix time for float in react native (javascript). |
no difference, still got this issue. |
I check the code in MpAndroidChart, it use float as x index, that means directly using timestamp will definitely be overflowed or cause precision problem. #160 is a workaround. if x is not sequential, you can use unix timestamp/1000/60 as x. |
I don't that will fix my issue.
|
can following code work?
after divide by 1000, it can be handled by int/float, and there is no need provide all entries for an entire day. |
the date valueFormatter can help. |
I am using LineChart to display data collected from somewhere every 5 seconds on a daily basis, which means my chart will be maximum about 17000+ points.
However, I found LineChart won't render the whole points, instead, it will down sample my data to about 2 minutes.
I've go through the MPAndroidChart docs and your examples, but no luck.
Can you please help me on this? here are my code:
The text was updated successfully, but these errors were encountered: