[Visualize] Coloring tooltip in Heatmap is not working for ">= n" values (#124521)

This commit is contained in:
Alexey Antonov 2022-02-04 12:37:11 +03:00 committed by GitHub
parent a5b4b822ce
commit ffeff57f00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,15 +286,21 @@ export const HeatmapComponent: FC<HeatmapRenderProps> = memo(
const bands = ranges.map((start, index, array) => {
// by default the last range is right-open
let end = index === array.length - 1 ? Infinity : array[index + 1];
let end = index === array.length - 1 ? Number.POSITIVE_INFINITY : array[index + 1];
// if the lastRangeIsRightOpen is set to false, we need to set the last range to the max value
if (args.lastRangeIsRightOpen === false) {
const lastBand = max === start ? Infinity : endValue;
const lastBand = max === start ? Number.POSITIVE_INFINITY : endValue;
end = index === array.length - 1 ? lastBand : array[index + 1];
}
const overwriteArrayIdx = `${metricFormatter.convert(start)} - ${metricFormatter.convert(
end
)}`;
let overwriteArrayIdx;
if (end === Number.POSITIVE_INFINITY) {
overwriteArrayIdx = `${start}`;
} else {
overwriteArrayIdx = `${metricFormatter.convert(start)} - ${metricFormatter.convert(end)}`;
}
const overwriteColor = overwriteColors?.[overwriteArrayIdx];
return {
// with the default continuity:above the every range is left-closed