use of org.jfree.data.time.DateRange in project aspro by JMMC-OpenDev.
the class ObservabilityPanel method updateDateAxisBounds.
/**
* Update the data axis range i.e. zoom on date range
* @param lower lower value in milliseconds
* @param upper upper value in milliseconds
*/
private void updateDateAxisBounds(final long lower, final long upper) {
final BoundedDateAxis dateAxis = (BoundedDateAxis) this.xyPlot.getRangeAxis();
// add a margin of 1 ms :
dateAxis.setBounds(new DateRange(lower - 1l, upper + 1l));
dateAxis.setRange(lower - 1l, upper + 1l);
}
use of org.jfree.data.time.DateRange in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.
the class DateAxis method setMaximumDate.
/**
* Sets the maximum date visible on the axis and sends an
* {@link AxisChangeEvent} to all registered listeners. If
* {@code maximumDate} is on or before the current minimum date for
* the axis, the minimum date will be shifted to preserve the current
* length of the axis.
*
* @param maximumDate the date ({@code null} not permitted).
*
* @see #getMinimumDate()
* @see #setMinimumDate(Date)
*/
public void setMaximumDate(Date maximumDate) {
Args.nullNotPermitted(maximumDate, "maximumDate");
// check the new maximum date relative to the current minimum date
Date minDate = getMinimumDate();
long minMillis = minDate.getTime();
long newMaxMillis = maximumDate.getTime();
if (minMillis >= newMaxMillis) {
Date oldMax = getMaximumDate();
long length = oldMax.getTime() - minMillis;
minDate = new Date(newMaxMillis - length);
}
setRange(new DateRange(minDate, maximumDate), true, false);
fireChangeEvent();
}
use of org.jfree.data.time.DateRange in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.
the class DateAxis method setRange.
/**
* Sets the range for the axis, if requested, sends an
* {@link AxisChangeEvent} to all registered listeners. As a side-effect,
* the auto-range flag is set to {@code false} (optional).
*
* @param range the range ({@code null} not permitted).
* @param turnOffAutoRange a flag that controls whether or not the auto
* range is turned off.
* @param notify a flag that controls whether or not listeners are
* notified.
*/
@Override
public void setRange(Range range, boolean turnOffAutoRange, boolean notify) {
Args.nullNotPermitted(range, "range");
// conversion...
if (!(range instanceof DateRange)) {
range = new DateRange(range);
}
super.setRange(range, turnOffAutoRange, notify);
}
use of org.jfree.data.time.DateRange in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.
the class DateAxis method getMinimumDate.
/**
* Returns the earliest date visible on the axis.
*
* @return The date.
*
* @see #setMinimumDate(Date)
* @see #getMaximumDate()
*/
public Date getMinimumDate() {
Date result;
Range range = getRange();
if (range instanceof DateRange) {
DateRange r = (DateRange) range;
result = r.getLowerDate();
} else {
result = new Date((long) range.getLowerBound());
}
return result;
}
use of org.jfree.data.time.DateRange in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.
the class DateAxis method getMaximumDate.
/**
* Returns the latest date visible on the axis.
*
* @return The date.
*
* @see #setMaximumDate(Date)
* @see #getMinimumDate()
*/
public Date getMaximumDate() {
Date result;
Range range = getRange();
if (range instanceof DateRange) {
DateRange r = (DateRange) range;
result = r.getUpperDate();
} else {
result = new Date((long) range.getUpperBound());
}
return result;
}
Aggregations