【问题标题】:How to make piechart hiegher in recharts如何在 recharts 中制作饼状图 hiegher
【发布时间】:2020-12-06 09:10:38
【问题描述】:

如何让recharts中的饼图更高?容器里有空位,我想展开图表,如何?

我的代码是:

        <ResponsiveContainer
            height={285} 
        >
            <PieChart
                margin={{ top: 0, left: 0, right: 0, bottom: 0 }}  
            >
                <Pie 
                    data={datasets} 
                    innerRadius={60}
                    outerRadius={80}
                    fill="#8884d8"
                    paddingAngle={0}
                    dataKey="value" 
                >
                    {
                        datasets.map((_, index: number) => <Cell key={backgroundColor[index]} fill={backgroundColor[index]} />)
                    }
                </Pie> 
            </PieChart>
        </ResponsiveContainer>

演示: https://jsfiddle.net/op0cq2ja/4/

查看图片问题:

【问题讨论】:

标签: reactjs pie-chart recharts


【解决方案1】:

如果您想增加饼图的半径,请更改PieouterRadius 属性。

您还可以更改innerRadius 属性来增加或减少饼图中心的孔的面积。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-16
    • 1970-01-01
    • 2020-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    相关资源
    最近更新 更多