Skip to content

Plotting - closes #560

Marcus Oskarsson requested to merge gh-9017cc23/618/mxcube/plotting into master

Created by: mguijarr

Finally, here it is :) The first version of the plotting facility for MXCuBE 3. It is based on Dygraphs javascript library, after the small study I made previously.

How does it work? There is a new 'plotting' hardware object, to be specified with -p in mxcube3-server command line (defaults to /plotting). Any hardware object that can emit the following signals is a plotting hardware object:

  • new_plot, signal argument: a dictionary like { "title": "plot title", "labels": ["x", "y1", ..., "yn"], "id": "plot_identifier (number?)" }
  • plot_data, signal argument: a dictionary like { "id": "plot_identifier", "data": a list of lists, see below }
    • data format is [ [x0, y01, y02, ..., y0n], [x1, y11, ... y1n] ]
    • data should be the whole data from the start - internally there is a rate limitation of this signal to 1 per second, and data will be sent in pieces : this is handled by the server itself
  • plot_end, signal argument: dictionary like { "id": "plot_identifier", "data": the whole scan data with the right format }

There is a new 'Plot1D' react component for the UI; when it is placed in a container, it will automatically receive plots from hardware objects and display them. It is also possible to specify which particular plot to display via the following properties:

  • autoNext: automatically display subsequent plots (default: true)
  • plotId: to specify a particular plot to be displayed
  • displayedPlotCallback: function, useful for the parent component to know which plot is currently being displayed; the function receives the plot identifier

Merge request reports

Loading