Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot rendering fix when PV disconnects #2189

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Stroke;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
Expand All @@ -29,7 +32,7 @@
import org.csstudio.javafx.rtplot.internal.util.ScreenTransform;

/** Helper for painting a {@link Trace}
* @param <XTYPE> Data type of horizontal {@link Axis}
* @param <XTYPE> Data type of horizontal {@link org.csstudio.javafx.rtplot.Axis}
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
Expand Down Expand Up @@ -254,7 +257,7 @@ final private void drawValueStaircase(final Graphics2D gc,
final PlotDataItem<XTYPE> item = data.get(i);
final int x = clipX(Math.round(x_transform.transform(item.getPosition())));
final double value = item.getValue();
if (poly_x.size() > 0 && x != last_x)
if (poly_x.size() > 0 && x != last_x && !Double.isNaN(value))
{ // Staircase from last 'y'..
poly_x.add(x);
poly_y.add(last_y);
Expand Down Expand Up @@ -301,8 +304,9 @@ final private void drawValueLines(final Graphics2D gc,
final PlotDataItem<XTYPE> item = data.get(i);
final int x = clipX(Math.round(x_transform.transform(item.getPosition())));
final double value = item.getValue();
if (Double.isNaN(value))
if (Double.isNaN(value)) {
flushPolyLine(gc, value_poly_x, value_poly_y, line_width);
}
else
{
final int y = clipY(y_axis.getScreenCoord(value));
Expand All @@ -318,7 +322,7 @@ final private void drawValueLines(final Graphics2D gc,
}

/** Draw min/max outline
* @param graphics2D GC
* @param gc GC
* @param x_transform Horizontal axis
* @param y_axis Value axis
* @param data Data
Expand Down Expand Up @@ -433,7 +437,7 @@ final private void drawStdDevLines(final Graphics2D gc, final ScreenTransform<XT
}

/** @param gc GC
* @param poly Points of poly line, will be cleared
* @param poly_x Points of poly line, will be cleared
* @param line_width
*/
final private void flushPolyLine(final Graphics2D gc, final IntList poly_x, final IntList poly_y, final int line_width)
Expand Down