use of org.jfree.chart.axis.DateTickUnitType in project pinot by linkedin.
the class AnomalyGraphGenerator method getDateTickUnit.
private DateTickUnit getDateTickUnit(final TimeGranularity timeGranularity, final long windowMillis) {
long windowBuckets = timeGranularity.convertToUnit(windowMillis);
int tickSize = (int) Math.ceil(windowBuckets / (double) NUM_X_TICKS);
DateTickUnitType unitType;
switch(timeGranularity.getUnit()) {
case DAYS:
unitType = DateTickUnitType.DAY;
break;
case HOURS:
unitType = DateTickUnitType.HOUR;
break;
case MILLISECONDS:
unitType = DateTickUnitType.MILLISECOND;
break;
case MINUTES:
unitType = DateTickUnitType.MINUTE;
break;
case SECONDS:
unitType = DateTickUnitType.SECOND;
break;
default:
throw new IllegalArgumentException("Unsupported time unit granularity: " + timeGranularity.getUnit());
}
return new DateTickUnit(unitType, tickSize);
}
Aggregations