【发布时间】:2021-04-20 16:42:37
【问题描述】:
我试图让 react native 的图表响应,根据那里的文档,如果你想响应图表,你必须放在下面的代码中。我检查了其他代码,但他们的代码正在运行。试了好久还是解决不了
import { Dimensions } from "react-native";
const screenWidth = Dimensions.get("window").width;
<LineChart
data={data}
width={screenWidth}
height={220}
chartConfig={chartConfig}
/>
但我尝试过像这样
const screenWidth = Dimensions.get("window").width;
<LineChart
data={{
labels: ["January", "February", "March", "April", "May", "June"],
datasets: [
{
data: [
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
],
},
],
}}
width={screenWidth} // from react-native
height={220}
/>
```
Can anyone help me why it is not working....
【问题讨论】:
-
你遇到了什么错误?
-
没有错误...这不是响应...
标签: react-native charts react-native-chart-kit