Skip to content

Commit fbc13e2

Browse files
authored
fix: label position fix (#1357)
fixes #1266
1 parent b90cfea commit fbc13e2

File tree

6 files changed

+4
-1
lines changed

6 files changed

+4
-1
lines changed

src/axes/Axis.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ export abstract class Axis {
9191
// If we don't have a label ahead and we have only two labels in total, we just take the remaining distance to
9292
// on the whole axis length. We limit that to a minimum of 30 pixel, so that labels close to the border will
9393
// still be visible inside of the chart padding.
94-
labelLength = Math.max(this.axisLength - projectedValue, 30);
94+
labelLength = Math.max(
95+
this.axisLength - projectedValue,
96+
this.axisLength / this.ticks.length
97+
);
9598
}
9699

97100
// Skip grid lines and labels where interpolated label values are falsey (except for 0)
-64 Bytes
Loading
-22 Bytes
Loading
-92 Bytes
Loading
172 Bytes
Loading
9 Bytes
Loading

0 commit comments

Comments
 (0)