[DO NOT MERGE] performance improvements in color-by feature (#535)

performance improvements in color-by feature
This commit is contained in:
Bruce Martin
2018-12-27 14:05:49 -08:00
committed by GitHub
parent bc59074300
commit cfcf16aa69
3 changed files with 56 additions and 48 deletions
@@ -26,7 +26,7 @@ import actions from "../../actions";
obsAnnotations: _.get(state.controls.world, "obsAnnotations", null)
}))
class HistogramBrush extends React.Component {
calcHistogramCache = memoize((obsAnnotations, field, ranges) => {
calcHistogramCache = memoize((obsAnnotations, field, rangeMin, rangeMax) => {
const { world } = this.props;
const histogramCache = {};
@@ -40,7 +40,7 @@ class HistogramBrush extends React.Component {
histogramCache.x = d3
.scaleLinear()
.domain([ranges.min, ranges.max])
.domain([rangeMin, rangeMax])
.range([0, this.width]);
histogramCache.bins = d3
@@ -130,7 +130,8 @@ class HistogramBrush extends React.Component {
const histogramCache = this.calcHistogramCache(
obsAnnotations,
field,
ranges
ranges.min,
ranges.max
);
const { x, y, bins, numValues } = histogramCache;