Skip to content

Commit

Permalink
fix(charts): undesired space between axis label and bottom positioned…
Browse files Browse the repository at this point in the history
… legend
  • Loading branch information
dlabrecq committed Aug 8, 2024
1 parent 78282d1 commit 6c27769
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-charts/src/components/Chart/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export const Chart: React.FunctionComponent<ChartProps> = ({

// Adjust for axis label
React.Children.toArray(children).map((child: any) => {
if (child.type.role === 'axis' && child.props.label && !child.props.dependentAxis) {
if (child.type.role === 'axis' && child.props.label && child.props.fixAxisLabelHeight) {
xAxisLabelHeight = getLabelTextSize({ text: child.props.label, theme }).height + 10;
legendTitleHeight = 0;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/react-charts/src/components/ChartAxis/ChartAxis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export interface ChartAxisProps extends VictoryAxisProps {
* @propType object[]
*/
externalEventMutations?: EventCallbackInterface<string | string[], StringOrNumberOrList>[];
/**
* When true, this prop adjusts the height between the axis label and bottom positioned legend
*/
fixAxisLabelHeight?: boolean;
/**
* When true, this prop reduces the number of tick labels to fit the length of the axis.
* Labels are removed at approximately even intervals from the original array of labels.
Expand Down

0 comments on commit 6c27769

Please sign in to comment.