-
Notifications
You must be signed in to change notification settings - Fork 38
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
Causes chart to prematurely stop rendering #44
Comments
The issue seems to be related to the frequency in which your parent component needs to rerender, or possibly how often your data array reference changes. The workaround seems to be to do two things:
I set a unique key on the Chart or const RingChart = ({data, colors, angle = 140}) => {
let [animate, setAnimate] = useState(true)
const onAnimationStart = useCallback(() => {
setTimeout(() => {
setAnimate(false)
}, 2000)
}, [])
return (<div>
<div ref={ref} className={"absolute w-grid-7 h-grid-1 l-grid-7 t-grid-7"}/>
<ResponsiveContainer key={uniqid()}>
<PieChart>
<Pie
isAnimationActive={animate}
data={data}
startAngle={angle}
endAngle={angle + 360}
cx={'50%'}
cy={'50%'}
outerRadius={'70%'}
innerRadius={'47%'}
fill="#8884d8"
dataKey="value"
paddingAngle={0}
labelLine={<LabelLine/>}
label={<Label/>}
onAnimationStart={onAnimationStart}
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={colors[index % colors.length]} stroke="none"/>
))}
</Pie>
</PieChart>
</ResponsiveContainer>
</div>
)
} |
any updates ? |
It's worth noting that when the Perhaps there could be an |
We would love a contribution from your side @pl12133 , calling the onAnimationEnd on unmount |
Merged #80 which calls |
There are some indications from users that Animations from react-smooth are causing the graph to render partially / in an incomplete state. Users have been using
isAnimationActive={false}
to disable animations to workaround the bug. Seerecharts
issues:recharts/recharts#1426
recharts/recharts#1821
The text was updated successfully, but these errors were encountered: