【问题标题】:How to decrease the width of the PieChart in the module react-native-svg-charts如何减小模块 react-native-svg-charts 中 PieChart 的宽度
【发布时间】:2020-10-24 08:05:08
【问题描述】:

既然已经谢谢你想知道是否有人知道如何减小 Graph Pie 的宽度,为了让它变得更薄,我尝试了 svg 中的一些属性,但没有任何人可以提供帮助

今天我有这个结果我想达到这个结果

当前

期待

当前组件


    <View style={styles.areaGraphic}>

      <PieChart style={{ height: '100%', top: 20 }} data={pieData} strokeWidth={0.2} />
      <Text style={{
        top: -50, left: 38, fontSize: 14, fontWeight: 'bold',
      }}
      >
        {data.label.name}
      </Text>
      <Text style={{
        top: -50, fontSize: 12, textAlign: 'center',
      }}
      >
        {data.label.description}
      </Text>
    </View>

【问题讨论】:

    标签: react-native react-native-svg react-native-svg-charts


    【解决方案1】:

    您可以使用 PieChart 组件的道具:

    内半径: 内半径,用它来创建一个甜甜圈。采用百分比或绝对数字(像素)

    外半径: 外半径,用它来调整你的馅饼离它的容器边缘有多近。采用百分比或绝对数字(像素)

    我会玩弄这两个道具来达到上面截图中的结果。

    祝你好运!

    【讨论】:

    • 谢谢,@realarb 为我工作&lt;PieChart style={{ height: '100%', top: 20 }} data={pieData} strokeWidth={0.2} outerRadius={30} /&gt;outerRadius
    猜你喜欢
    • 1970-01-01
    • 2016-12-11
    • 2016-01-30
    • 2023-01-23
    • 1970-01-01
    • 2021-02-05
    • 1970-01-01
    • 1970-01-01
    • 2021-12-30
    相关资源
    最近更新 更多