Skip to content

Commit 8d570c4

Browse files
committed
Revert "CSSTUDIO-1928 Remove invocations of adjustRange() from AxisPart.setValueRange() and AxisPart.computeTicks()."
This reverts commit 9b8b6e6.
1 parent 9b8b6e6 commit 8d570c4

File tree

1 file changed

+13
-3
lines changed
  • app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal

1 file changed

+13
-3
lines changed

app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/AxisPart.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,17 @@ public boolean setValueRange(T low, T high)
268268
return false;
269269
logger.log(Level.FINE, "Axis {0}: Value range {1} ... {2}",
270270
new Object[] { getName(), low, high });
271-
range = new AxisRange<>(low, high);
272-
transform.config(low, high, low_screen, high_screen);
271+
// Adjust range if necessary
272+
Pair<T, T> possiblyNewLowAndHigh = ticks.adjustRange(low, high);
273+
T newLow = possiblyNewLowAndHigh.getKey();
274+
T newHigh = possiblyNewLowAndHigh.getValue();
275+
if (newLow != low || newHigh != high)
276+
{
277+
logger.log(Level.WARNING, "Axis {0}: Bad value range {1} ... {2}. Adjusting the range to {3} ... {4}.",
278+
new Object[] { getName(), low, high, newLow, newHigh });
279+
}
280+
range = new AxisRange<>(newLow, newHigh);
281+
transform.config(newLow, newHigh, low_screen, high_screen);
273282
}
274283
dirty_ticks = true;
275284
requestLayout();
@@ -352,7 +361,8 @@ protected void computeTicks(final Graphics2D gc)
352361
{
353362
if (! dirty_ticks)
354363
return;
355-
364+
Pair<T, T> adjustedRange = ticks.adjustRange(range.getLow(), range.getHigh());
365+
range = new AxisRange<>(adjustedRange.getKey(), adjustedRange.getValue());
356366
if (horizontal)
357367
ticks.compute(range.getLow(), range.getHigh(), gc, getBounds().width);
358368
else

0 commit comments

Comments
 (0)