javascript - recharts pie chart centering using responsive container -
i'm using recharts create pie charts. when @ example, http://recharts.org/#/en-us/examples/pieresponsivecontainer pie chart can centered using responsivecontainer component.
but attempt failed : https://codesandbox.io/s/ll68p643xl. try change size of viewport larger width, pie isn't center anymore. wonder what's wrong here.
responsivecontainer
makes pie take size of container. if inspect html, see container in fact size of parent. if want center it, can make container not take whole parent, , use css. this:
.pie-row .pie-wrap > div { background: red; margin: 0 auto; }
and container:
<responsivecontainer classname="container" height={70} width='30%'>
wiki
Comments
Post a Comment