Skip to content

Commit 1a3f4d3

Browse files
committed
CSSTUDIO-1928-branch2 Add adjustment of range to LogTicks.compute().
1 parent 2098f64 commit 1a3f4d3

File tree

1 file changed

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

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,21 @@ public Pair<Double, Double> adjustRange(Double low, Double high) {
6060

6161
/** {@inheritDoc} */
6262
@Override
63-
public void compute(final Double low, final Double high, final Graphics2D gc, final int screen_width)
63+
public void compute(Double low, Double high, final Graphics2D gc, final int screen_width)
6464
{
65+
Pair<Double, Double> adjustedRange = adjustRange(low, high);
66+
double newLow = adjustedRange.getKey();
67+
double newHigh = adjustedRange.getValue();
68+
69+
if (newLow != low || newHigh != high) {
70+
logger.log(Level.WARNING, "Bad value range for a logarithmic scale {0} ... {1}. Adjusting the range to {2} ... {3}.",
71+
new Object[] {low, high, newLow, newHigh });
72+
high = newHigh;
73+
low = newLow;
74+
}
75+
6576
logger.log(Level.FINE, "Compute log ticks, width {0}, for {1} - {2}",
66-
new Object[] { screen_width, low, high });
77+
new Object[] { screen_width, low, high });
6778

6879
double low_exp_exact = Log10.log10(low);
6980
double high_exp_exact = Log10.log10(high);

0 commit comments

Comments
 (0)