use of eu.fthevenet.util.javafx.charts.XYChartSelection in project selenium_java by sergueik.
the class ChartViewportsState method setSelection.
public void setSelection(Map<Chart<Double>, XYChartSelection<ZonedDateTime, Double>> selectionMap, boolean toHistory) {
this.suspendAxisListeners();
try {
selectionMap.forEach((chart, xyChartSelection) -> get(chart).ifPresent(y -> y.setSelection(xyChartSelection, toHistory)));
selectionMap.entrySet().stream().findFirst().ifPresent(entry -> {
ZonedDateTime newStartX = roundDateTime(entry.getValue().getStartX());
ZonedDateTime newEndX = roundDateTime(entry.getValue().getEndX());
boolean dontPlotChart = newStartX.isEqual(startX.get()) && newEndX.isEqual(endX.get());
this.startX.set(newStartX);
this.endX.set(newEndX);
selectionMap.forEach((chart, xyChartSelection) -> get(chart).ifPresent(y -> y.setSelection(xyChartSelection, toHistory)));
parent.invalidateAll(toHistory, dontPlotChart, false);
});
timeRange.set(TimeRangePicker.TimeRange.of(startX.getValue(), endX.getValue()));
} finally {
this.resumeAxisListeners();
}
}
Aggregations