我正在刷卡中绘制VictoryChart,刷卡速度很慢。我怀疑原因是图表呈现速度较慢(当替换为静态图像时,滑动速度很快)。
在阅读有关Victory和Victory Native性能的各种讨论后,似乎动画渲染缓慢的原因之一。
我在图表中没有做任何动画处理。
除了我在下面的代码中所做的之外,我是否还必须显式禁用动画?
还有其他建议如何改善此图表的呈现性能? (我知道对值进行预先排序可能会有所帮助。还有其他吗?)
<VictoryChart scale={{ x: 'time' }}>
<VictoryAxis tickFormat={(t) => `${t.getHours()}:${t.getMinutes()}`}/>
<VictoryAxis dependentAxis/>
<VictoryCandlestick data={candleStickData} />
<VictoryLine labels={['']}
animate={{ duration: 0, onLoad: { duration: 0 } }}
data={[
{ x: dateStartX, y: dateStartY },
{ x: dateStartX, y: dateStartY }
]}
/>
<VictoryLine
labels={['']}
animate={{ duration: 0, onLoad: { duration: 0 } }}
data={[
{ x: secondDateStartX, y: secondDateStartY },
{ x: secondDateStartX, y: secondDateStartY }
]}
/>
</VictoryChart>