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

const ApexChart = () => {
  const [state, setState] = React.useState({
    series: [
      {
        name: 'Funnel Series',
        data: [1380, 1100, 990, 880, 740, 548, 330, 200],
      },
    ],
    options: {
      chart: {
        type: 'funnel',
        height: 350,
        dropShadow: {
          enabled: true,
        },
      },
      plotOptions: {
        bar: {
          borderRadius: 0,
          barHeight: '80%',
        },
      },
      dataLabels: {
        enabled: true,
        formatter: function (val, opt) {
          return opt.w.globals.labels[opt.dataPointIndex] + ':  ' + val
        },
        dropShadow: {
          enabled: true,
        },
      },
      title: {
        text: 'Recruitment Funnel',
        align: 'middle',
      },
      xaxis: {
        categories: [
          'Sourced',
          'Screened',
          'Assessed',
          'HR Interview',
          'Technical',
          'Verify',
          'Offered',
          'Hired',
        ],
      },
      legend: {
        show: false,
      },
    },
  })

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

export default ApexChart
Funnel Chart - React Funnel Charts | ApexCharts.js | ApexCharts.js