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

const ApexChart = () => {
  const [state, setState] = React.useState({
    series: [58],
    options: {
      chart: {
        height: 350,
        type: 'gauge',
      },
      plotOptions: {
        radialBar: {
          hollow: {
            margin: 15,
            size: '70%',
          },
          dataLabels: {
            name: {
              show: true,
              offsetY: -20,
              fontSize: '16px',
              color: '#999',
            },
            value: {
              show: true,
              fontSize: '40px',
              fontWeight: 700,
              offsetY: 6,
              formatter: function (val) {
                return val + '%'
              },
            },
          },
        },
      },
      fill: {
        type: 'gradient',
        gradient: {
          shade: 'dark',
          type: 'horizontal',
          shadeIntensity: 0.5,
          gradientToColors: ['#ABE5A1'],
          inverseColors: true,
          opacityFrom: 1,
          opacityTo: 1,
          stops: [0, 100],
        },
      },
      stroke: {
        lineCap: 'round',
      },
      labels: ['CPU Usage'],
    },
  })

  return (
    <div>
      <div id="chart">
        <ReactApexChart
          options={state.options}
          series={state.series}
          type="gauge"
          height={350}
        />
      </div>
    </div>
  )
}

export default ApexChart
Gauge with Custom Label - React Gauge Charts | ApexCharts.js | ApexCharts.js