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

const ApexChart = () => {
  const [state, setState] = React.useState({
    series: [42, 23, 15, 12, 8],
    options: {
      chart: {
        width: 480,
        type: 'pie',
      },
      labels: ['Organic Search', 'Direct', 'Social', 'Referral', 'Email'],
      title: {
        text: 'Website Traffic by Source',
        align: 'center',
      },
      legend: {
        show: false,
      },
      plotOptions: {
        pie: {
          dataLabels: {
            external: {
              show: true,
            },
          },
        },
      },
      responsive: [
        {
          breakpoint: 480,
          options: {
            chart: {
              width: 320,
            },
          },
        },
      ],
    },
  })

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

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