diff --git a/src/components/app.js b/src/components/app.js index 1fc5764b..09b5b3d9 100644 --- a/src/components/app.js +++ b/src/components/app.js @@ -40,7 +40,7 @@ class App extends React.Component { /* first request includes query straight off the url bar for now, - + */ this.props.dispatch(actions.requestCells(window.location.search)) diff --git a/src/components/continuous/continuous.js b/src/components/continuous/continuous.js index 909d4967..05158cc6 100644 --- a/src/components/continuous/continuous.js +++ b/src/components/continuous/continuous.js @@ -35,8 +35,10 @@ import { metadata, initializeRanges, initializeMetadata, - color: state.controls.color, - continuousSelection: state.controls.continuousSelection + colorAccessor: state.controls.colorAccessor, + graphBrushSelection: state.controls.graphBrushSelection, + continuousSelection: state.controls.continuousSelection, + axesHaveBeenDrawn: state.controls.axesHaveBeenDrawn, } }) class Continuous extends React.Component { @@ -49,7 +51,6 @@ class Continuous extends React.Component { dimensions: null, }; } - componentDidMount() { const {svg, ctx} = setupParallelCoordinates( width, @@ -58,12 +59,10 @@ class Continuous extends React.Component { ); this.setState({svg, ctx}) } - componentWillReceiveProps(nextProps) { - this.maybeDrawLines(nextProps); this.maybeDrawAxes(nextProps); + this.maybeDrawLines(nextProps); } - maybeDrawAxes(nextProps) { if ( !this.state.axes && @@ -126,8 +125,7 @@ class Continuous extends React.Component { this.state.processedDimensions, this.state.xscale, this.state.ctx, - width, - height + this.props.colorAccessor, ); this.setState({ diff --git a/src/components/continuous/drawLinesCanvas.js b/src/components/continuous/drawLinesCanvas.js index ed90a73e..19d63030 100644 --- a/src/components/continuous/drawLinesCanvas.js +++ b/src/components/continuous/drawLinesCanvas.js @@ -10,7 +10,12 @@ import renderQueue from "./renderQueue"; ****************************************** ******************************************/ -const drawLinesCanvas = (ctx, dimensions, xscale) => { +const drawLinesCanvas = ( + ctx, + dimensions, + xscale, + color, +) => { return (d) => { // ctx.strokeStyle = d["Sample.name.color"]; @@ -54,14 +59,18 @@ const drawCellLinesUsingRenderQueue = ( dimensions, xscale, ctx, - width, - height + color, ) => { const _renderLinesWithQueue = renderQueue( - drawLinesCanvas(ctx, dimensions, xscale) + drawLinesCanvas( + ctx, + dimensions, + xscale, + color + ) ).rate(50); - + _renderLinesWithQueue(metadata); return _renderLinesWithQueue; diff --git a/src/components/controls/color.js b/src/components/controls/color.js index 09c38b41..b7e40062 100644 --- a/src/components/controls/color.js +++ b/src/components/controls/color.js @@ -22,10 +22,11 @@ const Option = ({name, selected, handleClick}) => { @connect((state) => { const ranges = state.cells.cells && state.cells.cells.data.ranges ? state.cells.cells.data.ranges : null; - + const initializeRanges = state.initialize.data && state.initialize.data.data.ranges ? state.initialize.data.data.ranges : null; return { ranges, - color: state.controls.color, + initializeRanges, + colorAccessor: state.controls.colorAccessor, } }) class ColorOptions extends React.Component { @@ -37,17 +38,18 @@ class ColorOptions extends React.Component { }; } - handleClick (data) { + handleClick (name) { return () => { this.props.dispatch({ type: "color changed", - data + colorAccessor: name, + rangeMaxForColorAccessor: this.props.initializeRanges[name].range.max }); } } render() { - if (!this.props.ranges) { return null } + if (!this.props.ranges || !this.props.initializeRanges) { return null } return (
Color: @@ -61,7 +63,7 @@ class ColorOptions extends React.Component { return