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

const ApexChart = () => {
  const [state, setState] = React.useState({
    series: [38, 52, 31, 44, 22],
    options: {
      chart: {
        width: 480,
        type: 'donut',
        dropShadow: {
          enabled: true,
          color: '#111',
          top: -1,
          left: 2,
          blur: 3,
          opacity: 0.2,
        },
      },
      stroke: {
        width: 0,
      },
      plotOptions: {
        pie: {
          dataLabels: {
            external: {
              show: true,
              formatter: function (name, opts) {
                return [name, opts.percent.toFixed(1) + '%']
              },
            },
          },
          donut: {
            labels: {
              show: true,
              total: {
                showAlways: true,
                show: true,
              },
            },
          },
        },
      },
      legend: {
        show: false,
      },
      labels: ['Comedy', 'Action', 'SciFi', 'Drama', 'Horror'],
      dataLabels: {
        enabled: false,
      },
      fill: {
        type: 'pattern',
        opacity: 1,
        pattern: {
          enabled: true,
          style: [
            'verticalLines',
            'squares',
            'horizontalLines',
            'circles',
            'slantedLines',
          ],
        },
      },
      states: {
        hover: {
          filter: 'none',
        },
      },
      theme: {
        palette: 'palette2',
      },
      title: {
        text: 'Favourite Movie Type',
      },
      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={480}
        />
      </div>
    </div>
  )
}

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