【问题标题】:Rainbow-me React Native chart not showing PathRainbow-me React Native 图表未显示路径
【发布时间】:2021-09-12 00:36:04
【问题描述】:

我正在使用@rainbow-me/animated-charts 制作简单的图表,但似乎缺少线条路径。

我从他们的 NPM github 复制了下面的代码,但它只显示了一个黑框(我假设它只是图表的背景),但缺少主线路径。有什么帮助吗?

export const data = [
  {x: 1453075200, y: 1.47},
  {x: 1453161600, y: 1.37},
  {x: 1453248000, y: 1.53},
  {x: 1453334400, y: 1.54},
  {x: 1453420800, y: 1.52},
  {x: 1453507200, y: 2.03},
  {x: 1453593600, y: 2.1},
  {x: 1453680000, y: 2.5},
  {x: 1453766400, y: 2.3},
  {x: 1453852800, y: 2.42},
  {x: 1453939200, y: 2.55},
  {x: 1454025600, y: 2.41},
  {x: 1454112000, y: 2.43},
  {x: 1454198400, y: 2.2},
];
const {width: SIZE} = Dimensions.get('window');
const points = monotoneCubicInterpolation(data)(40);

const App = () => (
  <View style={{backgroundColor: 'black'}}>
    <ChartPathProvider data={{points: points, smoothingStrategy: 'bezier'}}>
      <ChartPath height={SIZE / 2} stroke="yellow" width={SIZE} />
      <ChartDot style={{backgroundColor: 'blue'}} />
    </ChartPathProvider>
  </View>
);

这就是我在 iphone 模拟器上看到的全部内容。

【问题讨论】:

    标签: ios reactjs react-native react-native-chart-kit


    【解决方案1】:

    变化:

    常量点 = monotoneCubicInterpolation(data)(40);

    收件人:

    const points = monotoneCubicInterpolation({ data, range: 40 })

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-27
      • 1970-01-01
      • 2022-10-23
      • 2016-05-13
      • 2016-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多