diff --git a/client/src/components/brushableHistogram/index.js b/client/src/components/brushableHistogram/index.js index 58379b20..8f5755d1 100644 --- a/client/src/components/brushableHistogram/index.js +++ b/client/src/components/brushableHistogram/index.js @@ -44,7 +44,7 @@ class HistogramBrush extends React.PureComponent { return varData.col(field); } - calcHistogramCache = memoize((col, field) => { + calcHistogramCache = memoize(col => { /* recalculate expensive stuff, notably bins, summaries, etc. */ @@ -240,15 +240,23 @@ class HistogramBrush extends React.PureComponent { }; } - drawHistogram(svgRef) { - const { field, world } = this.props; - const col = HistogramBrush.getColumn(world, field); - const histogramCache = this.calcHistogramCache(col, field); - const { x, y, bins } = histogramCache; - this._histogram = { x, y, bins, svgRef }; - } + handleSetGeneAsScatterplotX = () => { + const { dispatch, field } = this.props; + dispatch({ + type: "set scatterplot x", + data: field + }); + }; - handleColorAction() { + handleSetGeneAsScatterplotY = () => { + const { dispatch, field } = this.props; + dispatch({ + type: "set scatterplot y", + data: field + }); + }; + + handleColorAction = () => { const { dispatch, field, world, ranges } = this.props; if (world.obsAnnotations.hasCol(field)) { @@ -260,9 +268,9 @@ class HistogramBrush extends React.PureComponent { } else if (world.varData.hasCol(field)) { dispatch(actions.requestSingleGeneExpressionCountsForColoringPOST(field)); } - } + }; - removeHistogram() { + removeHistogram = () => { const { dispatch, field, @@ -291,26 +299,14 @@ class HistogramBrush extends React.PureComponent { data: null }); } - } + }; - handleSetGeneAsScatterplotX() { - return () => { - const { dispatch, field } = this.props; - dispatch({ - type: "set scatterplot x", - data: field - }); - }; - } - - handleSetGeneAsScatterplotY() { - return () => { - const { dispatch, field } = this.props; - dispatch({ - type: "set scatterplot y", - data: field - }); - }; + drawHistogram(svgRef) { + const { field, world } = this.props; + const col = HistogramBrush.getColumn(world, field); + const histogramCache = this.calcHistogramCache(col); + const { x, y, bins } = histogramCache; + this._histogram = { x, y, bins, svgRef }; } renderAxesBrushBins(x, y, bins, svgRef, field) { @@ -439,7 +435,7 @@ class HistogramBrush extends React.PureComponent {