Skip to content

Commit 785d7cc

Browse files
committed
CSSTUDIO-1928-branch2 Add adjustment of range to LinearTicks.compute().
1 parent a473508 commit 785d7cc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ public Pair<Double, Double> adjustRange(Double low, Double high)
8585
@Override
8686
public void compute(Double low, Double high, final Graphics2D gc, final int screen_width)
8787
{
88+
Pair<Double, Double> adjustedRange = adjustRange(low, high);
89+
double newLow = adjustedRange.getKey();
90+
double newHigh = adjustedRange.getValue();
91+
92+
if (newLow != low || newHigh != high) {
93+
logger.log(Level.WARNING, "Bad value range for a linear scale {0} ... {1}. Adjusting the range to {2} ... {3}.",
94+
new Object[] {low, high, newLow, newHigh });
95+
high = newHigh;
96+
low = newLow;
97+
}
98+
8899
logger.log(Level.FINE, "Compute linear ticks, width {0}, for {1} - {2}",
89100
new Object[] { screen_width, low, high });
90101

0 commit comments

Comments
 (0)