Skip to content

Commit 8fcfbb2

Browse files
authored
Merge pull request #2539 from ControlSystemStudio/autoscale_zero
Fix Y axis autoscale for data that's all zero
2 parents f29ae57 + 9b36e78 commit 8fcfbb2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2014-2020 Oak Ridge National Laboratory.
2+
* Copyright (c) 2014-2023 Oak Ridge National Laboratory.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -441,8 +441,16 @@ public void autoscale()
441441
if (low == high)
442442
{ // Center trace with constant value (empty range)
443443
final double half = Math.abs(low/2);
444-
low -= half;
445-
high += half;
444+
if (half > 0)
445+
{
446+
low -= half;
447+
high += half;
448+
}
449+
else
450+
{ // low = high = half = 0, default to [-1, 1]
451+
low = -1.0;
452+
high = 1.0;
453+
}
446454
}
447455
if (axis.isLogarithmic())
448456
{ // Perform adjustment in log space.

0 commit comments

Comments
 (0)