mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-30 11:08:12 +08:00
move colorScale and colorAccessor to redux to make it global
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user