public void setDateRange(DateTime minDate, DateTime maxDate, int tickCount) throws Exception { /* validate dates */ long minDateTS = (minDate != null) ? minDate.getTimeSec() : 0L; long maxDateTS = (maxDate != null) ? maxDate.getTimeSec() : 0L; if ((minDate == null) || (minDateTS < MIN_DATE) || (maxDate == null) || (maxDateTS < MIN_DATE) || (minDateTS >= maxDateTS) || ((maxDateTS - minDateTS) <= 60L)) { throw new Exception("Invalid Date range specification"); } /* adjust 'maxDateTS' to make sure (maxDateTS - minDateTS) is a multiple of 'tickCount' */ maxDateTS += (maxDateTS - minDateTS) % tickCount; /* vars */ this.minDateTS = minDateTS; this.maxDateTS = maxDateTS; this.timeZone = minDate.getTimeZone(); this.xTickCount = (tickCount > 0) ? tickCount : 6; }