Skip to content

Commit

Permalink
fix: label position fix (#1357)
Browse files Browse the repository at this point in the history
fixes #1266
  • Loading branch information
dangreen committed Sep 23, 2022
1 parent b90cfea commit fbc13e2
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/axes/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ export abstract class Axis {
// If we don't have a label ahead and we have only two labels in total, we just take the remaining distance to
// on the whole axis length. We limit that to a minimum of 30 pixel, so that labels close to the border will
// still be visible inside of the chart padding.
labelLength = Math.max(this.axisLength - projectedValue, 30);
labelLength = Math.max(
this.axisLength - projectedValue,
this.axisLength / this.ticks.length
);
}

// Skip grid lines and labels where interpolated label values are falsey (except for 0)
Expand Down
Binary file modified test/__image_snapshots__/BarChart__Adaptive__iPad-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/__image_snapshots__/BarChart__Default-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/__image_snapshots__/BarChart__Horizontal-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fbc13e2

Please sign in to comment.