Background
For some graphs in my application, I use the MPAndroidChart library. All the horizontal axes of my graphs are time-based, they can cover a full year, month, week, day or one hour circle. It always shows the full period, so from January to December, from Monday to Sunday, from 0:00 to 24:00, etc. The axis value is always a time stamp (in seconds).
Demand
I want the x-axis labels to follow the following rules:
- on the 1st of the month in the case of the year ;
- at the beginning of the day in the case of a month or a week ;
- at any full hour (##: 00) (do not strain everything) in case of a span day ;
- at any 5 minute point in an hour .
Problem
I can set the granularity
the x axis, which guarantees that there will be less space between the two points than the granularity says, but this may mean that (in the case of the daytime span) the first mark is 1:00 am and the second at 2:01 am and the third at 3:16 in the morning, as this corresponds to a granularity (minimum) of 60 minutes.
The current incorrect situation, which ideally would be something like [0:00, 3:00, 6:00, 9:00 ..]
Question
Is there a way to control the positioning of the X axis labels to achieve the results above?
source share