import React, { FC } from 'react'; import { UncontrolledTooltip } from 'reactstrap'; import { Histogram } from '../../types/types'; import { bucketRangeString } from './DataTable'; type ScaleType = 'linear' | 'exponential'; const HistogramChart: FC<{ histogram: Histogram; index: number; scale: ScaleType }> = ({ index, histogram, scale }) => { const { buckets } = histogram; const rangeMax = buckets ? parseFloat(buckets[buckets.length - 1][2]) : 0; const countMax = buckets ? buckets.map((b) => parseFloat(b[3])).reduce((a, b) => Math.max(a, b)) : 0; const formatter = Intl.NumberFormat('en', { notation: 'compact' }); const positiveBuckets = buckets?.filter((b) => parseFloat(b[1]) >= 0); // we only want to show buckets with range >= 0 const xLabelTicks = scale === 'linear' ? [0.25, 0.5, 0.75, 1] : [1]; return (