175 lines
4.2 KiB
JavaScript
175 lines
4.2 KiB
JavaScript
import React from "react";
|
|
import { Box, Typography } from "@mui/material";
|
|
import Card from "@mui/material/Card";
|
|
import Menu from "@mui/material/Menu";
|
|
import MenuItem from "@mui/material/MenuItem";
|
|
import IconButton from "@mui/material/IconButton";
|
|
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
|
import dynamic from "next/dynamic";
|
|
const Chart = dynamic(() => import("react-apexcharts"), {
|
|
ssr: false,
|
|
});
|
|
|
|
const SessionsByCountries = () => {
|
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
const open = Boolean(anchorEl);
|
|
const handleClick = (event) => {
|
|
setAnchorEl(event.currentTarget);
|
|
};
|
|
const handleClose = () => {
|
|
setAnchorEl(null);
|
|
};
|
|
|
|
// Chart
|
|
const series = [
|
|
{
|
|
data: [1200, 930, 748, 670, 540, 580, 690, 1100, 1200, 1380],
|
|
},
|
|
];
|
|
const options = {
|
|
chart: {
|
|
toolbar: {
|
|
show: false,
|
|
},
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
borderRadius: 4,
|
|
horizontal: true,
|
|
},
|
|
},
|
|
dataLabels: {
|
|
enabled: false,
|
|
},
|
|
colors: ["#757FEF"],
|
|
xaxis: {
|
|
categories: [
|
|
"United State",
|
|
"China",
|
|
"Canada",
|
|
"Indonesia",
|
|
"Russia",
|
|
"Bangladesh",
|
|
"Brazil",
|
|
"United Kingdom",
|
|
"Vietnam",
|
|
"Germany",
|
|
],
|
|
labels: {
|
|
style: {
|
|
colors: "#5B5B98",
|
|
fontSize: "12px",
|
|
},
|
|
},
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
style: {
|
|
colors: "#5B5B98",
|
|
fontSize: "11px",
|
|
},
|
|
},
|
|
axisBorder: {
|
|
show: false,
|
|
colors: "#f6f6f7",
|
|
},
|
|
},
|
|
fill: {
|
|
opacity: 1,
|
|
},
|
|
grid: {
|
|
show: true,
|
|
borderColor: "#f6f6f7",
|
|
},
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Card
|
|
sx={{
|
|
boxShadow: "none",
|
|
borderRadius: "10px",
|
|
p: "25px 20px 10px",
|
|
mb: "15px",
|
|
}}
|
|
>
|
|
<Box
|
|
sx={{
|
|
display: "flex",
|
|
justifyContent: "space-between",
|
|
alignItems: "center",
|
|
borderBottom: "1px solid #EEF0F7",
|
|
paddingBottom: "10px",
|
|
}}
|
|
className="for-dark-bottom-border"
|
|
>
|
|
<Typography
|
|
as="h3"
|
|
sx={{
|
|
fontSize: 18,
|
|
fontWeight: 500,
|
|
}}
|
|
>
|
|
Sessions By Countries
|
|
</Typography>
|
|
|
|
<Box>
|
|
<IconButton
|
|
onClick={handleClick}
|
|
size="small"
|
|
aria-controls={open ? "account-menu" : undefined}
|
|
aria-haspopup="true"
|
|
aria-expanded={open ? "true" : undefined}
|
|
>
|
|
<MoreHorizIcon />
|
|
</IconButton>
|
|
</Box>
|
|
<Menu
|
|
anchorEl={anchorEl}
|
|
id="account-menu"
|
|
open={open}
|
|
onClose={handleClose}
|
|
onClick={handleClose}
|
|
PaperProps={{
|
|
elevation: 0,
|
|
sx: {
|
|
overflow: "visible",
|
|
filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
|
|
mt: 1.5,
|
|
"& .MuiAvatar-root": {
|
|
width: 32,
|
|
height: 32,
|
|
ml: -0.5,
|
|
mr: 1,
|
|
},
|
|
"&:before": {
|
|
content: '""',
|
|
display: "block",
|
|
position: "absolute",
|
|
top: 0,
|
|
right: 14,
|
|
width: 10,
|
|
height: 10,
|
|
bgcolor: "background.paper",
|
|
transform: "translateY(-50%) rotate(45deg)",
|
|
zIndex: 0,
|
|
},
|
|
},
|
|
}}
|
|
transformOrigin={{ horizontal: "right", vertical: "top" }}
|
|
anchorOrigin={{ horizontal: "right", vertical: "bottom" }}
|
|
>
|
|
<MenuItem sx={{ fontSize: "14px" }}>Last 15 Days</MenuItem>
|
|
<MenuItem sx={{ fontSize: "14px" }}>Last Month</MenuItem>
|
|
<MenuItem sx={{ fontSize: "14px" }}>Last Year</MenuItem>
|
|
</Menu>
|
|
</Box>
|
|
|
|
<Chart options={options} series={series} type="bar" height={500} />
|
|
</Card>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default SessionsByCountries;
|