Skip to content

Commit

Permalink
added solution for disappearing bars inside zoom container
Browse files Browse the repository at this point in the history
  • Loading branch information
nstolpe committed Nov 14, 2024
1 parent 3f41ff5 commit 0165ff9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/victory-bar/src/helper-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ const getCalculatedValues = (props) => {
let data = Data.getData(props);
data = Data.formatDataFromDomain(data, domain, 0);

if (props.groupComponent.type.displayName === 'VictoryClipContainer') {
data = data.map((datum) => {
datum._x = datum.x;
datum._y = datum.y;
return datum;
});
}

return { style, data, scale, domain, origin };
};

Expand Down
11 changes: 8 additions & 3 deletions packages/victory-bar/src/victory-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export type VictoryBarAlignmentType = "start" | "middle" | "end";

export interface VictoryBarProps
extends VictoryCommonProps,
VictoryDatableProps,
VictoryMultiLabelableProps {
VictoryDatableProps,
VictoryMultiLabelableProps {
alignment?: VictoryBarAlignmentType;
barRatio?: number;
barWidth?: NumberOrCallback;
Expand Down Expand Up @@ -141,7 +141,12 @@ class VictoryBarBase extends React.Component<VictoryBarProps> {
return this.animateComponent(props, animationWhitelist);
}

const children = this.renderData(props);
let children;
if (props.groupComponent.type.displayName === 'VictoryClipContainer') {
children = this.renderData(props, () => true);
} else {
children = this.renderData(props);
}

const component = props.standalone
? this.renderContainer(props.containerComponent, children)
Expand Down

0 comments on commit 0165ff9

Please sign in to comment.