Search code examples
reactjsapexcharts

React apex pie chart not showing label


I am trying to plot a series using a pie/radial chart to react. 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.

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

I am not sure what's going wrong with the code here. Any help to resolve the same.


Solution

  • Your total.formatter function was not returning after calculating the total.

    Here is the updated code

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

    Updated CodeSandbox