简体   繁体   English

反应顶点饼图未显示 label

[英]React apex pie chart not showing label

I am trying to plot a series using a pie/radial chart to react.我正在尝试使用饼图/径向图对 plot 一个系列做出反应。 As per the documentation, I am passing the showAlways: true property that keeps showing a certain value in the middle of the chart even when the cursor is hovered or not hovered over the radial area.根据文档,我正在传递showAlways: true属性,即使 cursor 悬停或未悬停在径向区域上,该属性仍会在图表中间显示某个值。

But the following property does not seem to work in my case.但是以下属性在我的情况下似乎不起作用。 Here is the link to the working snippet.这是工作片段的链接。

https://codesandbox.io/s/amazing-violet-wrp7y https://codesandbox.io/s/amazing-violet-wrp7y

I am not sure what's going wrong with the code here.我不确定这里的代码出了什么问题。 Any help to resolve the same.解决相同问题的任何帮助。

Your total.formatter function was not returning after calculating the total.您的total.formatter function 在计算总数后没有返回。

Here is the updated code这是更新的代码

formatter(w) {
  return w.globals.seriesTotals.reduce((a, b) => a + b, 0)
}

Updated CodeSandbox更新了 CodeSandbox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM