Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable animation for LineChart in recharts?

I was trying to disable animation in this way:

<ResponsiveContainer width="99%" height={300}>
    <LineChart isAnimationActive={false}
               animationDuration={0}
               height={300} width={400}
               data={chartData}>
        ...
    </LineChart>
</ResponsiveContainer>

But it doesn't work

like image 657
Gregory Orlov Avatar asked Jan 21 '26 14:01

Gregory Orlov


1 Answers

You need to disable the animations at line level.

<ResponsiveContainer width="99%" height={300}>
    <LineChart height={300} width={400} data={chartData}>
        <Line type="monotone" isAnimationActive={false} dataKey="pv" />
        <Line type="monotone" isAnimationActive={false} dataKey="uv" />
    </LineChart>
</ResponsiveContainer>

Check this JSFiddle to see an example.

like image 173
Matthijs van der Veer Avatar answered Jan 27 '26 01:01

Matthijs van der Veer