Skip to content
Open
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/silver-crabs-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"victory-candlestick": minor
---

Handle undefined labelStyle properties in VictoryCandlestick. Fixes #3039
14 changes: 7 additions & 7 deletions packages/victory-candlestick/src/helper-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ const calculatePlotValues = (props) => {

const dy =
orientation === "top" || orientation === "bottom"
? signY * (candleWidth / 2) + signY * (labelStyle.padding || 0)
? signY * (candleWidth / 2) + signY * (labelStyle?.padding || 0)
: 0;

const dx =
orientation === "top" || orientation === "bottom"
? 0
: signX * (labelStyle.padding || 1);
: signX * (labelStyle?.padding || 1);

return { yValue, xValue, dx, dy };
}
Expand All @@ -283,13 +283,13 @@ const calculatePlotValues = (props) => {

const dy =
orientation === "top" || orientation === "bottom"
? signY * (labelStyle.padding || 1)
? signY * (labelStyle?.padding || 1)
: 0;

const dx =
orientation === "top" || orientation === "bottom"
? 0
: signX * (candleWidth / 2) + signX * (labelStyle.padding || 0);
: signX * (candleWidth / 2) + signX * (labelStyle?.padding || 0);

return { yValue, xValue, dx, dy };
};
Expand Down Expand Up @@ -358,10 +358,10 @@ const getLabelProps = (props, text, style, type?: string) => {
datum,
data,
orientation,
textAnchor: labelStyle.textAnchor || defaultTextAnchors[orientation],
textAnchor: labelStyle?.textAnchor || defaultTextAnchors[orientation],
verticalAnchor:
labelStyle.verticalAnchor || defaultVerticalAnchors[orientation],
angle: labelStyle.angle,
labelStyle?.verticalAnchor || defaultVerticalAnchors[orientation],
angle: labelStyle?.angle,
horizontal,
};

Expand Down
Loading