final component conversions

This commit is contained in:
Colin Megill
2018-08-03 15:18:40 -04:00
parent 7ae1db627c
commit cb6b784dfd
2 changed files with 16 additions and 26 deletions

View File

@@ -49,9 +49,6 @@ class HistogramBrush extends React.Component {
brush: null
};
}
componentDidMount() {}
componentDidUpdate() {}
calcHistogramCache(nextProps) {
// recalculate expensive stuff
const allValuesForContinuousFieldAsArray = _.map(
@@ -80,14 +77,6 @@ class HistogramBrush extends React.Component {
componentWillMount() {
this.calcHistogramCache(this.props);
}
componentWillReceiveProps(nextProps) {
if (
this.props.metadataField !== nextProps.metadataField ||
!this.histogramCache.x
) {
this.calcHistogramCache(nextProps);
}
}
onBrush(selection, x) {
return () => {

View File

@@ -123,21 +123,6 @@ class Scatterplot extends React.Component {
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) {
if (
this.state.svg &&
@@ -213,6 +198,22 @@ class Scatterplot extends React.Component {
this.state.sizeBuffer({ data: sizes, dimension: 1 });
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) {
const xScale = d3