我有一个甜甜圈图,在其中我需要在中间添加两个堆叠的标签。我不知道的是如何在它们之间添加一些垂直空间。ReCharts将这两条线呈现为SVG。图表位于响应式容器中,因此没有硬编码值。我知道如何在中心放置一个标签,但是如果不为整个图表编写渲染方法,就无法弄清楚如何在其中放置两个标签。有什么建议吗?
<ResponsiveContainer>
<PieChart >
<Tooltip/>
<Legend
verticalAlign="bottom"
align="left"
iconType="circle"
payload={ getCustomLegendValues(tasks) } />
<Pie
data={tasks}
nameKey="name"
dataKey="value"
innerRadius="60%"
outerRadius="80%"
startAngle={90}
endAngle={-270}
fill="#8884d8">
{
tasks.map((entry, index) => <Cell fill={ entry.color }/>)
}
<Label width={30} position="center">
{ `${totalTasks} ${tasksNameLabel}` }
</Label>
</Pie>
</PieChart>
</ResponsiveContainer>
Run Code Online (Sandbox Code Playgroud)