Search in sources :

Example 1 with DateTickUnitType

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);
}
Also used : DateTickUnit(org.jfree.chart.axis.DateTickUnit) DateTickUnitType(org.jfree.chart.axis.DateTickUnitType)

Aggregations

DateTickUnit (org.jfree.chart.axis.DateTickUnit)1 DateTickUnitType (org.jfree.chart.axis.DateTickUnitType)1