Skip to content

Commit fa0ab84

Browse files
committed
XYPlot: Support 'VImage' to plot (1-dim) NTNDArray
1 parent b1506fd commit fa0ab84

File tree

1 file changed

+22
-4
lines changed
  • app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/plots

1 file changed

+22
-4
lines changed

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/plots/XYPlotRepresentation.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015-2020 Oak Ridge National Laboratory.
2+
* Copyright (c) 2015-2022 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
@@ -44,6 +44,8 @@
4444
import org.csstudio.javafx.rtplot.internal.NumericAxis;
4545
import org.epics.util.array.ArrayDouble;
4646
import org.epics.util.array.ListNumber;
47+
import org.epics.vtype.Display;
48+
import org.epics.vtype.VImage;
4749
import org.epics.vtype.VNumber;
4850
import org.epics.vtype.VNumberArray;
4951
import org.epics.vtype.VType;
@@ -286,11 +288,22 @@ private void computeTrace()
286288
return;
287289

288290
final ListNumber x_data, y_data, error;
289-
final VType y_value = model_trace.traceYValue().getValue();
291+
VType y_value = model_trace.traceYValue().getValue();
292+
293+
if (y_value instanceof VImage)
294+
{ // Extract VNumberArray from image, then continue with that
295+
final VImage image = (VImage) y_value;
296+
y_value = VNumberArray.of(image.getData(), image.getAlarm(), image.getTime(), Display.none());
297+
}
290298

291299
if (y_value instanceof VNumberArray)
292300
{
293-
final VType x_value = model_trace.traceXValue().getValue();
301+
VType x_value = model_trace.traceXValue().getValue();
302+
if (x_value instanceof VImage)
303+
{ // Extract VNumberArray from image, then continue with that
304+
final VImage image = (VImage) x_value;
305+
x_value = VNumberArray.of(image.getData(), image.getAlarm(), image.getTime(), Display.none());
306+
}
294307
x_data = (x_value instanceof VNumberArray) ? ((VNumberArray)x_value).getData() : null;
295308

296309
final VNumberArray y_array = (VNumberArray)y_value;
@@ -323,7 +336,12 @@ else if (y_value instanceof VNumber)
323336
else
324337
{ // No Y Data.
325338
// Do we have X data?
326-
final VType x_value = model_trace.traceXValue().getValue();
339+
VType x_value = model_trace.traceXValue().getValue();
340+
if (x_value instanceof VImage)
341+
{ // Extract VNumberArray from image, then continue with that
342+
final VImage image = (VImage) x_value;
343+
x_value = VNumberArray.of(image.getData(), image.getAlarm(), image.getTime(), Display.none());
344+
}
327345
if (x_value instanceof VNumberArray)
328346
{
329347
x_data = ((VNumberArray)x_value).getData();

0 commit comments

Comments
 (0)