move colorScale and colorAccessor to redux to make it global

This commit is contained in:
Colin Megill
2017-11-17 14:59:28 -08:00
parent e18f57e6f2
commit 42bef3d6cd
7 changed files with 61 additions and 39 deletions
+6 -8
View File
@@ -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({
+14 -5
View File
@@ -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;