【问题标题】:How to disable animation for LineChart in recharts?如何在图表中禁用 LineChart 的动画?
【发布时间】:2019-06-13 12:00:05
【问题描述】:

我试图以这种方式禁用动画:

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

但它不起作用

【问题讨论】:

    标签: charts recharts


    【解决方案1】:

    您需要在行级别禁用动画。

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

    查看此JSFiddle 以查看示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-01
      • 2018-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-05
      相关资源
      最近更新 更多