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/bars-disappear-on-zoom #2970

Merged
merged 8 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
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
Next Next commit
added solution for disappearing bars inside zoom container
  • Loading branch information
nstolpe committed Nov 15, 2024
commit 890f746966432e335fe9db610f391e5c78d5d2cc
8 changes: 8 additions & 0 deletions packages/victory-bar/src/helper-methods.ts
Original file line number Diff line number Diff line change
@@ -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 };
};

11 changes: 8 additions & 3 deletions packages/victory-bar/src/victory-bar.tsx
Original file line number Diff line number Diff line change
@@ -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;
@@ -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)