MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Not able to draw a proper Linear graph where X is date timestamp

Open l2dev opened this issue 7 years ago • 2 comments

Graph looks okay when I draw it with graphView http://prntscr.com/hjg501 (tested with plot.ly: http://prntscr.com/hjgiim)

And then graph looks bad when using hellochart/mpchart:

Hellochart: http://prntscr.com/hjg8fa

MPChart: http://prntscr.com/hjghbb

My dataset on both graphs is this (X, Y):

1512488280000	1.200000048
1512488310000	1.200000048
1512488346000	1.200000048
1512488370000	3.599999905
1512488400000	1.200000048
1512488430000	1.200000048
1512488460000	1.200000048
1512488490000	1.200000048
1512488524000	1.200000048
1512488550000	6
1512488580000	1.200000048
1512488612000	1.200000048
1512488646000	1.200000048
1512488674000	3.599999905
1512488702000	1.200000048
1512488730000	1.200000048
1512488760000	6
1512488790000	1.200000048
1512488820000	1.200000048
1512488850000	1.200000048
1512488880000	2.400000095
1512488910000	1.200000048
1512488940000	1.200000048
1512488970000	1.200000048
1512489000000	1.200000048
1512489030000	1.200000048
1512489060000	12
1512489090000	1.200000048
1512489126000	13.19999981
1512489150000	7.199999809

I see that in hellochart and mpchart graphs look the same, while in graphview it shows properly, so I must be doing something wrong then...

Is there a way to make it work?

l2dev avatar Dec 05 '17 16:12 l2dev

If you're using a unix timestamp, the problem is when it gets converted to Float, it loses precision, so lots of timestamps that actually represent different times end up being rounded and represented as the same x value. See #2891

timusus avatar Aug 30 '18 06:08 timusus

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