mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-03 18:58:12 +08:00
final component conversions
This commit is contained in:
@@ -49,9 +49,6 @@ class HistogramBrush extends React.Component {
|
|||||||
brush: null
|
brush: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
componentDidMount() {}
|
|
||||||
componentDidUpdate() {}
|
|
||||||
|
|
||||||
calcHistogramCache(nextProps) {
|
calcHistogramCache(nextProps) {
|
||||||
// recalculate expensive stuff
|
// recalculate expensive stuff
|
||||||
const allValuesForContinuousFieldAsArray = _.map(
|
const allValuesForContinuousFieldAsArray = _.map(
|
||||||
@@ -80,14 +77,6 @@ class HistogramBrush extends React.Component {
|
|||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
this.calcHistogramCache(this.props);
|
this.calcHistogramCache(this.props);
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
if (
|
|
||||||
this.props.metadataField !== nextProps.metadataField ||
|
|
||||||
!this.histogramCache.x
|
|
||||||
) {
|
|
||||||
this.calcHistogramCache(nextProps);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onBrush(selection, x) {
|
onBrush(selection, x) {
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@@ -123,21 +123,6 @@ class Scatterplot extends React.Component {
|
|||||||
colorBuffer
|
colorBuffer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
if (
|
|
||||||
nextProps.expression &&
|
|
||||||
nextProps.expression.data &&
|
|
||||||
nextProps.scatterplotXXaccessor &&
|
|
||||||
nextProps.scatterplotYYaccessor
|
|
||||||
) {
|
|
||||||
const scales = this.setupScales(
|
|
||||||
nextProps.expression,
|
|
||||||
nextProps.scatterplotXXaccessor,
|
|
||||||
nextProps.scatterplotYYaccessor
|
|
||||||
);
|
|
||||||
this.setState(scales);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (
|
if (
|
||||||
this.state.svg &&
|
this.state.svg &&
|
||||||
@@ -213,6 +198,22 @@ class Scatterplot extends React.Component {
|
|||||||
this.state.sizeBuffer({ data: sizes, dimension: 1 });
|
this.state.sizeBuffer({ data: sizes, dimension: 1 });
|
||||||
this.count = cellCount;
|
this.count = cellCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.props.expression &&
|
||||||
|
this.props.expression.data &&
|
||||||
|
this.props.scatterplotXXaccessor &&
|
||||||
|
this.props.scatterplotYYaccessor &&
|
||||||
|
(this.props.scatterplotXXaccessor !== prevProps.scatterplotXXaccessor || // was CLU now FTH1 etc
|
||||||
|
this.props.scatterplotYYaccessor !== prevProps.scatterplotYYaccessor)
|
||||||
|
) {
|
||||||
|
const scales = this.setupScales(
|
||||||
|
this.props.expression,
|
||||||
|
this.props.scatterplotXXaccessor,
|
||||||
|
this.props.scatterplotYYaccessor
|
||||||
|
);
|
||||||
|
this.setState(scales);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setupScales(expression, scatterplotXXaccessor, scatterplotYYaccessor) {
|
setupScales(expression, scatterplotXXaccessor, scatterplotYYaccessor) {
|
||||||
const xScale = d3
|
const xScale = d3
|
||||||
|
|||||||
Reference in New Issue
Block a user