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

const ApexChart = () => {
  const [state, setState] = React.useState({
    series: [
      {
        data: [
          {
            x: 'Engineering',
            y: [54, 66, 69, 75, 88],
            goals: [
              {
                value: 90,
                strokeWidth: 10,
                strokeHeight: 0,
                strokeLineCap: 'round',
                strokeColor: '#F283B6',
              },
              {
                value: 93,
                strokeWidth: 10,
                strokeHeight: 0,
                strokeLineCap: 'round',
                strokeColor: '#F283B6',
              },
            ],
          },
          {
            x: 'Sales',
            y: [43, 65, 69, 76, 81],
          },
          {
            x: 'Marketing',
            y: [31, 39, 45, 51, 59],
          },
          {
            x: 'Support',
            y: [39, 46, 55, 65, 71],
            goals: [
              {
                value: 30,
                strokeWidth: 10,
                strokeHeight: 0,
                strokeLineCap: 'round',
                strokeColor: '#F283B6',
              },
              {
                value: 32,
                strokeWidth: 10,
                strokeHeight: 0,
                strokeLineCap: 'round',
                strokeColor: '#F283B6',
              },
              {
                value: 76,
                strokeWidth: 10,
                strokeHeight: 0,
                strokeLineCap: 'round',
                strokeColor: '#F283B6',
              },
            ],
          },
          {
            x: 'Design',
            y: [41, 49, 58, 61, 67],
          },
        ],
      },
    ],
    options: {
      chart: {
        type: 'boxPlot',
        height: 350,
      },
      title: {
        text: 'Salary Range by Department ($k)',
        align: 'left',
      },
      plotOptions: {
        bar: {
          horizontal: true,
          barHeight: '40%',
        },
        boxPlot: {
          colors: {
            upper: '#B6C454',
            lower: '#EDBFB7',
          },
        },
      },
      stroke: {
        colors: ['#333'],
      },
    },
  })

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

export default ApexChart
Horizontal BoxPlot - React BoxPlot Charts | ApexCharts.js | ApexCharts.js