private static Granularity granularityFromPointsLessThanEqual ( double requestedDuration , int points , long assumedIntervalMillis ) { Granularity gran = granularityFromPointsLinear ( requestedDuration , points , assumedIntervalMillis ) ; if ( requestedDuration / gran . milliseconds ( ) > points ) { try { gran = gran . coarser ( ) ; } catch ( GranularityException e ) { /* do nothing, already at 1440m */ } } return gran ; }
Find the granularity in the interval that will yield a number of data points that are closest to the requested points but < = requested points .