首页 > 解决方案 > 如何使用胜利做实时图表?

问题描述

我可以知道如何使用胜利来制作实时折线图吗?

胜利库:https ://github.com/FormidableLabs/victory

<div className="chart-header">Temperature</div>
  <VictoryChart
   theme={VictoryTheme.material}
   width={1500}
  >
  <VictoryLine
   style={{
    data: { stroke: "#c43a31" },
    parent: { border: "1px solid #ccc"}
   }}
   labelComponent={<VictoryTooltip />} 
   data={temperatureData}
   x="timestamp"
   y="temperature"
   labels={p => `${p.timestamp} $${p.temperature}`} 
  />
 </VictoryChart>
</div>

这是添加新温度时,它会自动更新到图表中。现在我将它与 Redux 一起使用,我使用的后端是环回。我可以知道如何实时进行吗?谢谢你。

标签: reactjsreact-reduxreal-timeloopbackvictory-charts

解决方案


推荐阅读