MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Long data type for Timestamps in Timeseries chart

Open utkarshns opened this issue 9 years ago • 10 comments

Please add long datatype support for unix timestamps in the timeseries LineChart. The current float datatype isn't precisely able to store timestamps which are near to each other, as a result the end bits are truncated and the nearby values end up being overwritten leading to incorrect plots.

utkarshns avatar Aug 27 '16 19:08 utkarshns

@PhilJay Anything?

utkarshns avatar Sep 18 '16 05:09 utkarshns

For a temporary fix.

I just record the first timestamp myself, and then use the diff between the first timestamp and subsequent ones (and divide by 1000), so that my xAxis starts from 0 and increases by 1 for each second.

zkdzegede avatar Sep 23 '16 10:09 zkdzegede

@zkdzegede Even I am using that sort of technique but it adds to extra processing, it would be great to just have a larger datatype.

@PhilJay anything?

utkarshns avatar Sep 28 '16 08:09 utkarshns

Same problem. This is a big limitation.

xelnaga avatar Oct 27 '16 23:10 xelnaga

@utkarshns

I agree it would be nice, but a double/long could hurt performance so I could see why they chose float

:(

edit: Maybe it could be made more extensible, so that the user can pick what they need e.g using the Number object?

zkdzegede avatar Nov 10 '16 04:11 zkdzegede

I know I'm rather late on this issue, but there is a way Double and/or Long could be added.

While they apparently hurt performance, anyone who wants to use it should be allowed to. Maintaining Float as the "main" data type but adding support for Double and Long would allow those that need fast charts to use Float and those who need accurate charts and don't care about performance to use Double and Long. A warning could be added to warn anyone who wants to use it that it does hurt performance.

This way everyone is happy, as it supports multiple data types while still having the option of taking a fast chart.

I'm basically saying keep float, but add support for double and long. Keep float as the "main" data type and add different classes that have different names for Double and Long. The existing code (if this is implemented) would still be Float based unless it is rewritten with the class names for Double or Long

LunarWatcher avatar Sep 16 '17 10:09 LunarWatcher

+1

nisiode avatar Aug 20 '18 18:08 nisiode

It's 2019 and we still dont have ability to use longs for timestamps?

l2dev avatar Feb 15 '19 13:02 l2dev

True, you can however have a workaround. Please look at earlier messages for the same.

On Fri 15 Feb, 2019, 6:52 PM Eimantas Urbonas <[email protected] wrote:

It's 2019 and we still dont have ability to use longs for timestamps?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PhilJay/MPAndroidChart/issues/2203#issuecomment-464048787, or mute the thread https://github.com/notifications/unsubscribe-auth/AI2yrWfJ7ZklXAumh1w7IVaKn4GmJ-zTks5vNrShgaJpZM4Juw-I .

utkarshns avatar Feb 15 '19 13:02 utkarshns

Hello, any update on this ? I have the same issue and I am looking for a solution to plot a lot of points where X is unix timestamp.

KhushbuShah25 avatar Mar 06 '22 05:03 KhushbuShah25