Search in sources :

Example 6 with Day

use of org.jfree.data.time.Day in project nimbus by nimbus-org.

the class TimeSeriesCollectionFactoryService method addTimeSeries.

/**
 * TimeSeriesに値を追加する。<p>
 *
 * @param series TimeSeries
 * @param date 日付
 * @param value 値
 * @param periodType TimePeriodタイプ
 * @param inOut メソッドコールの入出力で必要なデータを保持したクラス
 * @return TimeSeries
 */
protected TimeSeries addTimeSeries(TimeSeries series, Date date, double value, int periodType, long period, Holder inOut, boolean isAddOrUpdate) {
    switch(collateDataType) {
        case COLLATE_DATA_TYPE_START:
        case COLLATE_DATA_TYPE_END:
        case COLLATE_DATA_TYPE_AVERAGE:
        case COLLATE_DATA_TYPE_SUM:
            date = createCollateDate(date, period);
            break;
        case COLLATE_DATA_TYPE_ALL:
        case COLLATE_DATA_TYPE_OHLC:
        default:
            break;
    }
    RegularTimePeriod regTimePeriod = null;
    switch(periodType) {
        case PERIOD_MILLISECOND:
            regTimePeriod = new Millisecond(date);
            break;
        case PERIOD_FIXEDMILLISECOND:
            regTimePeriod = new FixedMillisecond(date);
            break;
        case PERIOD_SECOND:
            regTimePeriod = new Second(date);
            break;
        case PERIOD_MINUTE:
            regTimePeriod = new Minute(date);
            break;
        case PERIOD_HOUR:
            regTimePeriod = new Hour(date);
            break;
        case PERIOD_DAY:
            regTimePeriod = new Day(date);
            break;
        case PERIOD_WEEK:
            regTimePeriod = new Week(date);
            break;
        case PERIOD_MONTH:
            regTimePeriod = new Month(date);
            break;
        case PERIOD_QUARTER:
            regTimePeriod = new Quarter(date);
            break;
        case PERIOD_YEAR:
            regTimePeriod = new Year(date);
            break;
        default:
    }
    if (isAddOrUpdate) {
        series.addOrUpdate(regTimePeriod, value);
    } else {
        series.add(regTimePeriod, value);
    }
    if (inOut.lastDate == null) {
        inOut.lastDate = (Date) date.clone();
    } else {
        inOut.lastDate.setTime(date.getTime());
    }
    inOut.lastValue = value;
    return series;
}
Also used : Quarter(org.jfree.data.time.Quarter) FixedMillisecond(org.jfree.data.time.FixedMillisecond) Millisecond(org.jfree.data.time.Millisecond) Month(org.jfree.data.time.Month) FixedMillisecond(org.jfree.data.time.FixedMillisecond) Second(org.jfree.data.time.Second) Minute(org.jfree.data.time.Minute) Year(org.jfree.data.time.Year) Hour(org.jfree.data.time.Hour) RegularTimePeriod(org.jfree.data.time.RegularTimePeriod) Day(org.jfree.data.time.Day) Week(org.jfree.data.time.Week)

Aggregations

Day (org.jfree.data.time.Day)6 Date (java.util.Date)4 TimeSeries (org.jfree.data.time.TimeSeries)4 Hour (org.jfree.data.time.Hour)3 Second (org.jfree.data.time.Second)3 TimeSeriesCollection (org.jfree.data.time.TimeSeriesCollection)3 StatisticData (com.cubrid.cubridmanager.core.monstatistic.model.StatisticData)2 Month (org.jfree.data.time.Month)2 Quarter (org.jfree.data.time.Quarter)2 RegularTimePeriod (org.jfree.data.time.RegularTimePeriod)2 Week (org.jfree.data.time.Week)2 Year (org.jfree.data.time.Year)2 MetricType (com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.MetricType)1 TimeType (com.cubrid.cubridmanager.core.monstatistic.model.StatisticParamUtil.TimeType)1 IOException (java.io.IOException)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Timestamp (java.sql.Timestamp)1 SimpleDateFormat (java.text.SimpleDateFormat)1