Closed graft closed 5 years ago
Eleanor implemented (1) and (2) - the plots expect external calculation as inputs. She had also implemented (3) which I somewhat went back on when implementing #218, introducing vectors into the plots themselves. I'll amend this so that vectors are reduced to arrays before being bound to the plot, as I think we seemed to agree that having the plots be uncoupled from manifest code concepts (like vectors/matrices) seems better.
The current plot element architecture is best described as "varied". Some plots use d3 to draw; some use plotly.js; some use pure SVG with a few d3 elements. In addition, each of the plots has a unique interface - some expect JS primitives as input (i.e. a JSON block) while others expect manifest elements (e.g. a Vector or Matrix JS object). In addition some plots expect to do calculations in Javascript in order to render correctly, and use varying strategies to accomplish this (force the user to do calculations in the manifest or do them in JS).
We should unify plots on each of these criteria: 1) All plots should be drawn using pure SVG elements, with some help from d3 for computing scales, axis labels, tick positions, etc. No more d3 DOM-binding or plotly.js. 2) As much as possible calculation should occur outside the plot. Obviously it is impossible to draw a plot without some amount of calculation, but if the plot requires complex statistical calculation (e.g. drawing a density plot requires kernel density estimation), this calculation should occur outside the plot component itself and be passed into the plot as a parameter. 3) Plots should expect primitives as input, not manifest elements.