import React from 'react'
import ReactApexChart from 'react-apexcharts'
import './styles.css'
const ApexChart = () => {
const [state, setState] = React.useState({
series: [
{
name: 'Desktops',
data: [
{
x: 'Apple',
y: 50,
},
{
x: 'Acer',
y: 30,
},
{
x: 'Asus',
y: 21,
},
],
},
{
name: 'Laptops',
data: [
{
x: 'Dell',
y: 21,
},
{
x: 'HP',
y: 16,
},
{
x: 'Lenovo',
y: 20,
},
],
},
{
name: 'Tablets',
data: [
{
x: 'Samsung',
y: 4,
},
{
x: 'Huawei',
y: 7,
},
{
x: 'Microsoft',
y: 11,
},
{
x: 'Amazon',
y: 31,
},
{
x: 'Lenovo',
y: 13,
},
],
},
{
name: 'Mobile',
data: [
{
x: 'Apple',
y: 10,
},
{
x: 'Samsung',
y: 20,
},
{
x: 'Huawei',
y: 51,
},
{
x: 'Xiaomi',
y: 30,
},
],
},
],
options: {
legend: {
show: true,
offsetY: 10,
height: 30,
},
chart: {
height: 350,
type: 'treemap',
},
title: {
text: 'Multi-dimensional Treemap',
align: 'center',
},
plotOptions: {
treemap: {},
},
},
})
return (
<div>
<div id="chart">
<ReactApexChart
options={state.options}
series={state.series}
type="treemap"
height={350}
/>
</div>
</div>
)
}
export default ApexChart