chartsrecharts

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


Solution

  • 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.