131 lines
2.7 KiB
JavaScript
131 lines
2.7 KiB
JavaScript
import React, { Component } from "react";
|
|
import Card from "@mui/material/Card";
|
|
import { Typography } from "@mui/material";
|
|
import dynamic from "next/dynamic";
|
|
const Chart = dynamic(() => import("react-apexcharts"), {
|
|
ssr: false,
|
|
});
|
|
|
|
class PieCharts extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.state = {
|
|
series: [44, 55, 41, 17, 15],
|
|
options: {
|
|
chart: {
|
|
width: 380,
|
|
type: "donut",
|
|
dropShadow: {
|
|
enabled: true,
|
|
color: "#111",
|
|
top: -1,
|
|
left: 3,
|
|
blur: 3,
|
|
opacity: 0.2,
|
|
},
|
|
},
|
|
stroke: {
|
|
width: 0,
|
|
},
|
|
plotOptions: {
|
|
pie: {
|
|
donut: {
|
|
labels: {
|
|
show: true,
|
|
total: {
|
|
showAlways: true,
|
|
show: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
labels: ["Comedy", "Action", "SciFi", "Drama", "Horror"],
|
|
dataLabels: {
|
|
dropShadow: {
|
|
blur: 3,
|
|
opacity: 0.8,
|
|
},
|
|
},
|
|
fill: {
|
|
type: "pattern",
|
|
opacity: 1,
|
|
pattern: {
|
|
enabled: true,
|
|
style: [
|
|
"verticalLines",
|
|
"squares",
|
|
"horizontalLines",
|
|
"circles",
|
|
"slantedLines",
|
|
],
|
|
},
|
|
},
|
|
states: {
|
|
hover: {
|
|
filter: "none",
|
|
},
|
|
},
|
|
theme: {
|
|
palette: "palette2",
|
|
},
|
|
title: {
|
|
text: "Favourite Movie Type",
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 480,
|
|
options: {
|
|
chart: {
|
|
width: 200,
|
|
},
|
|
legend: {
|
|
position: "bottom",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<>
|
|
<Card
|
|
sx={{
|
|
boxShadow: "none",
|
|
borderRadius: "10px",
|
|
p: "25px",
|
|
mb: "15px",
|
|
}}
|
|
>
|
|
<Typography
|
|
as="h3"
|
|
sx={{
|
|
fontSize: 18,
|
|
fontWeight: 500,
|
|
borderBottom: "1px solid #EEF0F7",
|
|
paddingBottom: "5px",
|
|
mb: "15px",
|
|
}}
|
|
className="for-dark-bottom-border"
|
|
>
|
|
Pie Charts
|
|
</Typography>
|
|
|
|
<Chart
|
|
options={this.state.options}
|
|
series={this.state.series}
|
|
type="donut"
|
|
width={380}
|
|
/>
|
|
</Card>
|
|
</>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default PieCharts;
|