Closed graft closed 5 years ago
Implemented in branch em-d3-v5
, as follows:
Each plot has a { plot_type, layout, plot_series }. plot_series is an array of { name, series_type, variables: {} }
For the moment plot_type and series_type will be identical (e.g. 'lineplot'), but, paving the way for #215 they could be separated (e.g. plot_type could be '2d' and series_type could be 'lineplot').
The series_type determines which variables are bound into the plot, e.g. a lineplot expects 'x' and 'y'.
The rendering end of this is setup (although only implemented for lineplot, the rest can be filled in relatively easily), the generation end (via the plots view) must be completed.
To fix the plotter page:
[ ] Add inputs to edit the Layout - the layout object in the plot.configuration consists of: { height, margins }, where margins is { left, right, top, bottom }. We need to make an input for height, and margin left, right, top, bottom. This component can go at the very top (just below the name/access editor).
[x] Add inputs to set the plot_type - a dropdown selector of plot types that sets the plot.configuration.plot_type value
[x] Add plot series editor The plot series editor component looks like this:
Add new plot series button - shows a popup list of plot series (e.g., 'line', 'scatter', 'contour'). When one is selected, a new series with blank name and variable expressions is added to the series list
Series list, each series component shows:
For an existing plot, this component gets populated with the existing values and the editable parts can be modified.
Currently only two plot types are available in the 'Plot' view, the Scatter X/Y plot and the Heatmap plot. Both of these require a configuration object, constructed using the UI, which binds data in the consignment generated from a manifest to the plot.
This configuration object needs to be extended to cover all possible plot types. Following #214 and #215, we should create a configuration methodology that allows the user to bind arbitrary pieces of data into composable plots. The workflow might look like this:
manifest => consignment => plot_config => secondary_consignment => plot_params => plot
To begin, the manifest is computed, yielding a consignment with some data in it. We don't care about the form of the data, it can be anything. The bindable elements in the consignment will be Vectors (either from a Vector variable or from a column of a Matrix variable). A Vector will have a set of labels associated with it, which the plot may or may not ignore. Later when we are computing dendrograms for heatmaps we might make a special type for those that is bindable (a Vector tree).
To make a plot, we select a plot type (1D, 2D or Heatmap) and create a set of Series. Each Series has data bound into it. E.g., a Scatter element must bind a Vector to x and y variables. It might also optionally bind another Vector to a color variable - or a value from a color selector. It may optionally bind a label variable, or else the labels may be taken from the x Vector.
The configuration builder presents this basic selection process already - choose plot type, add series. The reformation involves only creating a configuration for each Series type that lets you bind data to a particular set of variables. These configurations could be very simple, e.g. scatter: { X: 'vector', Y: 'vector', color: [ 'vector', 'color' ], labels: ['vector'] }.
A given configuration and a consignment can be combined via a service object to yield params for a set of plot components, which are drawn on the appropriate plot surface (1D or 2D).