Skip to content

Commit 52e064e

Browse files
number (log scale) axis label overflow fix
1 parent e33bca7 commit 52e064e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/lib/d3_scales.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ export function getLogScaleTickValues(domain: number[], approxTickCount: number)
255255
if (!Number.isFinite(dMin) || !Number.isFinite(dMax) || dMin <= 0 || dMax <= 0) {
256256
return null;
257257
}
258-
const minExp = Math.floor(Math.log10(dMin));
259-
const maxExp = Math.ceil(Math.log10(dMax));
258+
// Use ceil/floor to keep ticks within the domain, preventing labels
259+
// from bleeding outside the chart area (especially on the distribution plot).
260+
const minExp = Math.ceil(Math.log10(dMin));
261+
const maxExp = Math.floor(Math.log10(dMax));
260262
const majorTicks: number[] = [];
261263
for (let exp = minExp; exp <= maxExp; exp++) {
262264
majorTicks.push(Math.pow(10, exp));

0 commit comments

Comments
 (0)