0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00

Fix SI units less than 1 on time to convert (#5403)

This commit is contained in:
Alex Gyujin Kim 2021-07-30 12:19:21 -07:00 committed by GitHub
parent e245cfbd93
commit 105f99f5ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,13 +63,11 @@ export function Histogram({
})
// y-axis scale
const y = d3
.scaleLinear()
.domain([0, d3.max(data, (d: HistogramDatum) => d.count) as number])
.range(config.ranges.y)
.nice()
const yMax = d3.max(data, (d: HistogramDatum) => d.count) as number
const y = d3.scaleLinear().domain([0, yMax]).range(config.ranges.y).nice()
const yAxis = config.axisFn
.y(y)
.tickValues(y.ticks().filter((tick) => Number.isInteger(tick)))
.tickSize(0)
.tickFormat((v: number) => {
const count = formatYTickLabel(v)