Skip to content

Commit

Permalink
fix(heatmap): destroy canvas bbox calculator when done (opensearch-pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 authored Oct 5, 2020
1 parent 5e221a4 commit 4c1fd55
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ export const computeChartDimensionsSelector = createCachedSelector(
};
});
const measuredYValues = textMeasure(config.yAxisLabel.fontSize, boxedYValues);
const maxTextWidth = d3Max(measuredYValues, ({ width }) => width) ?? 0;

let yColumnWidth: number = maxTextWidth;
let yColumnWidth: number = d3Max(measuredYValues, ({ width }) => width) ?? 0;
if (typeof config.yAxisLabel.width === 'number') {
yColumnWidth = config.yAxisLabel.width;
} else if (typeof config.yAxisLabel.width === 'object' && yColumnWidth > config.yAxisLabel.width.max) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const getXAxisRightOverflow = createCachedSelector(
const textSize = bboxCompute.compute(text, padding, fontSize, fontFamily, 1);
return Math.max(acc, textSize.width + padding);
}, 0);

bboxCompute.destroy();
return maxTextWidth / 2;
},
)(getChartIdSelector);

0 comments on commit 4c1fd55

Please sign in to comment.