kasemir / org.csstudio.display.builder

Update of org.csstudio.opibuilder.*
Eclipse Public License 1.0
2 stars 10 forks source link

X/Y Plot working with single-value PVs #391

Open claudio-rosati opened 6 years ago

claudio-rosati commented 6 years ago

My integrators are asking a better compatibility of X/Y Plot with BOY's X/Y Graph.

Being that I've also request for a polar plot, I'm not sure if:

  1. Upgrade X/Y Plot to accept single-value PVs and implement a new Polar Plot widget (working with both arrays and single-value PVs), or
  2. Implement a new Plot widget (Multi Plot?) to perform X/Y and Polar drawings with single-value PVs.

@kasemir What do you think?

In case of 1., will you do the change, or point me in the right sources to do it myself?

kasemir commented 6 years ago

This is basically the same question as #243, with the same answer:

The BOY XYPlot has been proven hard to understand by users because it tries to implement several fundamentally different types of behaviour: 1) Plot a "Y" waveform over its indices 2) Plot a "Y" waveform over an "X" waveform 3) Plot a scalar "Y" over time

For cases 1 & 2 users need to set the "buffer size" to match the expected maximum waveform size (why?). For 3 users need to configure the buffer size, "concat" and the "plot mode", and you don't get archived data.

In the display builder, the waveform vs. scalar handling has been simplified: The XY Plot handles waveforms, case 1 & 2. No need to configure anything but PV names. "buffer size" is automatically using the size of the received waveform data.

The Data Browser widget handles scalars, case 3. Since this is using an existing tool, it loads *.plt files. There is a "bufffer size" for each channel because if it kept adding live data to the sample buffer, you'd eventually exhaust the available memory. It can read archived data.

Unfortunately, there is no way to automatically determine if an XYPlot in a legacy .opi file was for a waveform or scalar, so we cannot automatically translate XYPlot widgets in .opi files into data browser widgets. All XYPlots in *.opi files are therefore assumed to be for waveforms.

I intend to keep the separation of XYPlots for waveforms vs. Data Browser for scalars. One could think about a tighter integration by somehow editing the data browser configuration right within the data browser widget. Right now, when you add a data browser widget, you edit all its settings in a separate *.plt file. Maybe as a first step allow opening the data browser right from the display builder editor's property panel.

claudio-rosati commented 6 years ago

So, if I've understood correctly,

is not possible to have a plot of Y over X if they are scalars.

So how do we want to allow this? I'm fine to to do this kind of widget:

To solve mixed cases, maybe we can provide some loc/sim PVs to convert an array PV into a scalar one (read-only) and vice versa.

Do you agree on that?

kasemir commented 6 years ago

Exactly. A scalar Y against a scalar X is fundamentally different from waveform (XYPlot) as well as scalar-over-time (data browser), so it needs to be a new type of plot, like a "Scalar Scatter Plot" that you plan to implement.

It's tricky, though. When two scalar PVs X and Y update, you get two separate notifications. I think BOY simply added received data to an in-client circular buffer for each channel. With that, it's easy to be one step out of sync. Assume X and Y send updates x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, ... at 10Hz. BOY starts, and the first values it receives happen to be y1, x2, y2, x3, y3, x4, y4, ... So it now has in-client arrays Xhist = [x2, x3, x4, ...] and Yhist = [ y1, y2, y3, .. ] from which it happily plots (x2, y1), (x3, y2), ..

How do you intent to prevent his? Do you then check their time stamps to see if these describe the same point (X, Y) on the plot?

To handle that right now in a more dependably way, have the IOC that has the X and Y also produce X and Y waveforms based on the compress record. When the IOC processes X and Y, it can at that time FLNK to an Xhist and Yhist compress record with ALG="Circular Buffer", N=(size of desired waveform). So now the IOC produces correct Xhist and Yhist arrays. Then use the existing XYPlot for Xhist and Yhist -> done.

Sorry, but BOY's X/Y Graph had problems. People not understanding it and asking for the bugs back is not a good idea.

claudio-rosati commented 6 years ago

I understand, and I think that the only way is using the timestamp and possibly (or, better, optionally) a linear interpolator to get intermediate values. It is something I've already done in the past.