ArmandasRokas / beeware

0 stars 0 forks source link

X axis labels shows random labels #99

Open ArmandasRokas opened 4 years ago

ArmandasRokas commented 4 years ago

https://stackoverflow.com/questions/43304637/mpandroidchart-how-to-set-x-axis-labels-at-fixed-interval https://github.com/philippeauriach/MPAndroidChart/tree/custom-labels

ArmandasRokas commented 4 years ago

Casting from long to float results in loss of precision

        long currTime = 1597305571560L;
        float currTimeFloat = currTime;
        System.out.println("long :" + currTime + "; currTimeFloat: " + currTimeFloat);
2020-08-13 10:24:44.621 31994-31994/dk.dtu.group22.beeware I/System.out: long :1597305571560; currTimeFloat: 1.59730552E12
2020-08-13 10:24:44.621 31994-31994/dk.dtu.group22.beeware I/System.out: long timestmap:2020-08-13 09:59:31.56 ; floatTimestamp2020-08-13 09:58:40.128

Maybe it does not matter if I divide by 1000 or not. Think that if I have 155555555 So when I divide by 1000 , so i get 155555 and than multiply by 1000 gives 155555000 Consider now float it it prcises only 6 digits, so it will automatically convert to 155555000 so the final result is the same, so there is no point for divition. Because number on the left does not get rounded up only on the left which is milisecond. https://stackoverflow.com/questions/55027165/why-can-you-store-a-long-into-a-float-without-typecast