PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.65k stars 9.02k forks source link

Long data type for Timestamps in Timeseries chart #2203

Open utkarshns opened 8 years ago

utkarshns commented 8 years ago

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 commented 8 years ago

@PhilJay Anything?

zkdzegede commented 8 years ago

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.

utkarshns commented 8 years ago

@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?

xelnaga commented 8 years ago

Same problem. This is a big limitation.

zkdzegede commented 8 years ago

@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?

LunarWatcher commented 7 years ago

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

nisiode commented 6 years ago

+1

l2dev commented 5 years ago

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

utkarshns commented 5 years ago

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 <notifications@github.com 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 .

KhushbuShah25 commented 2 years ago

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.