public static final int calcNumberOfDatapointsForPeriod(final Duration TIME_PERIOD, final TimeUnit RESOLUTION) {
        switch(RESOLUTION) {
            case DAYS   : return (int) (TIME_PERIOD.getSeconds() / SECONDS_PER_DAY);
            case HOURS  : return (int) (TIME_PERIOD.getSeconds() / SECONDS_PER_HOUR);
            case MINUTES: return (int) (TIME_PERIOD.getSeconds() / SECONDS_PER_MINUTE);
            case SECONDS:
            default     : return (int) TIME_PERIOD.getSeconds();
        }
    }
Returns a "niceScaling" number approximately equal to the range.
Rounds the number if ROUND == true.
Takes the ceiling if ROUND = false.

@param RANGE the value range (maxValue - minValue)
@param ROUND whether to round the result or ceil
@return a "niceScaling" number to be used for the value range
src/main/java/eu/hansolo/tilesfx/tools/Helper.java