import React from 'react'
import ReactApexChart from 'react-apexcharts'
import './styles.css'
// This demo also loads: https://cdn.jsdelivr.net/npm/apexcharts/dist/unit-shapes.js
const ApexChart = () => {
const [state, setState] = React.useState({
series: [4800, 2400, 1800, 600],
options: {
chart: {
type: 'unit',
height: 470,
animations: {
enabled: true,
speed: 900,
},
},
labels: ['Resolved by bot', 'Bot, then human', 'Human only', 'Escalated'],
colors: ['#008FFB', '#00B8A9', '#F2994A', '#FF4560'],
plotOptions: {
unit: {
layout: 'custom',
// One of the shapes in apexcharts/unit-shapes.
positions: 'robot',
transition: 'flow',
unitValue: 12,
clusterLabels: {
show: false,
},
},
},
legend: {
position: 'bottom',
},
},
})
return (
<div>
<div className="wrap">
<h1>9,600 support tickets, one dot per 12</h1>
<p>
The two eyes are cut out of the head as reverse wound subpaths, which
is what makes this a robot rather than a rounded box on a stalk. They
are also the first detail to close up: below roughly 220 dots the rows
fill them in.
</p>
<div className="chart-wrap">
<div id="chart">
<ReactApexChart
options={state.options}
series={state.series}
type="unit"
height={470}
/>
</div>
</div>
<p className="note">1 dot = 12 tickets</p>
</div>
</div>
)
}
export default ApexChart