import React from 'react'
import ReactApexChart from 'react-apexcharts'
import './styles.css'

const ApexChart = () => {
  const [state, setState] = React.useState({
    series: [128, 96, 74, 52, 38],
    options: {
      chart: {
        width: 380,
        type: 'donut',
      },
      plotOptions: {
        pie: {
          startAngle: -90,
          endAngle: 270,
        },
      },
      labels: ['Compute', 'Storage', 'Database', 'Networking', 'Analytics'],
      dataLabels: {
        enabled: false,
      },
      fill: {
        type: 'gradient',
      },
      legend: {
        formatter: function (val, opts) {
          return val + ' - $' + opts.w.globals.series[opts.seriesIndex] + 'k'
        },
      },
      title: {
        text: 'Cloud Spend by Service',
      },
      responsive: [
        {
          breakpoint: 480,
          options: {
            chart: {
              width: 200,
            },
            legend: {
              position: 'bottom',
            },
          },
        },
      ],
    },
  })

  return (
    <div>
      <div id="chart">
        <ReactApexChart
          options={state.options}
          series={state.series}
          type="donut"
          width={380}
        />
      </div>
    </div>
  )
}

export default ApexChart
Gradient Donut - React Pie / Donut Charts | ApexCharts.js | ApexCharts.js