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

VictoryPie Chart is not Responsive (Constrained) to Parent's Width #709

Closed
geirman opened this issue Aug 10, 2017 · 1 comment · Fixed by FormidableLabs/victory-pie#153
Closed

Comments

@geirman
Copy link

geirman commented Aug 10, 2017

Ok, I think I'm ready to call this a bug...
https://twitter.com/geirmanc/status/895396018337882112

According to the VictoryContainer Docs...

  • The container is Responsive by Default
  • "In responsive containers, the width and height props affect the aspect ratio of the rendered component"

Yet no matter what I've tried, I've been unsuccessful in solving the following VictoryPie render issues

  • too much padding to the left
  • chart bleeds off to the right (not constrained to it's parent)
  • not centered between the available, visible width of the parent.

Setting the width, as described in the docs, does not change the aspect ratio of the container, but instead clips the right edge of the chart. Here's an image to further demonstrate the problem.

2017-08-09_1700

@boygirl
Copy link
Contributor

boygirl commented Aug 13, 2017

@geirman sorry for the delay. I took a look at your demo code, and I noticed a potential problem which is that you're placing the height prop directly on the container rather than letting that be controlled by VictoryPie. The pie elements are absolutely positioned within the svg, and positioning is controlled by VictoryPie using width / height / padding.

This issue did also expose a bug in asymmetric pie padding, which I have fixed here: FormidableLabs/victory-pie#153

I can see why you're setting the height directly on the container to avoid creating a container that would normally fit a whole pie, when you're rendering only half. This trick will only work when your height is exactly 1/2 your width. I will open a new discussion / feature request for calculating positions differently when only 1/2 a pie will be rendered, but this would be a breaking change for VictoryPie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants