Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calculating y scale range based on label position configurations #445

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading