Skip to content

Commit

Permalink
Fix calculating y scale range based on label position configurations (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
keithluchtel authored Dec 9, 2024
1 parent 9ab0e9a commit bd0bc33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-taxis-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"victory-native": patch
---

Fix calculating y scale range based on label position configurations.
8 changes: 4 additions & 4 deletions lib/src/cartesian/utils/transformInputData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,20 @@ export const transformInputData = <
(typeof yAxis?.tickCount === "number"
? yAxis?.tickCount
: xAxis?.tickCount) ?? 0;
const yLabelPosition = yAxis?.labelPosition;
const xAxisSide = xAxis?.axisSide;
const yLabelOffset = yAxis.labelOffset ?? 0;
const xAxisSide = xAxis?.axisSide;
const xLabelPosition = xAxis?.labelPosition;

// bottom, outset
if (xAxisSide === "bottom" && yLabelPosition === "outset") {
if (xAxisSide === "bottom" && xLabelPosition === "outset") {
return [
outputWindow.yMin,
outputWindow.yMax +
(xTickCount > 0 ? -fontHeight - yLabelOffset * 2 : 0),
];
}
// Top outset
if (xAxisSide === "top" && yLabelPosition === "outset") {
if (xAxisSide === "top" && xLabelPosition === "outset") {
return [
outputWindow.yMin +
(xTickCount > 0 ? fontHeight + yLabelOffset * 2 : 0),
Expand Down

0 comments on commit bd0bc33

Please sign in to comment.