Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

fix asymmetric padding bug #153

Merged
merged 1 commit into from
Aug 13, 2017
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
7 changes: 7 additions & 0 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,14 @@ export default class App extends React.Component {

<div style={containerStyle}>
<VictoryPie
startAngle={90} endAngle={-90}
style={{ parent: parentStyle }}
padding={{ bottom: 50, left: 50, right: 10 }}
width={400} height={200}
/>
<VictoryPie
style={{ parent: parentStyle }}
padding={{ bottom: 50, left: 50, right: 10 }}
width={400} height={200}
/>

Expand Down
9 changes: 3 additions & 6 deletions src/components/helper-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,9 @@ export default {
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
const padding = Helpers.getPadding(props);
const radius = this.getRadius(props, padding);
const offsetWidth = width / 2 + padding.left - padding.right;
const offsetHeight = height / 2 + padding.top - padding.bottom;
const origin = {
x: offsetWidth + radius > width ? radius + padding.left - padding.right : offsetWidth,
y: offsetHeight + radius > height ? radius + padding.top - padding.bottom : offsetHeight
};
const offsetWidth = ((radius + padding.left) + (width - radius - padding.right)) / 2;
const offsetHeight = ((radius + padding.top) + (height - radius - padding.bottom)) / 2;
const origin = { x: offsetWidth, y: offsetHeight };
const data = Data.getData(props);
const slices = this.getSlices(props, data);
const pathFunction = d3Shape.arc()
Expand Down