import { useTheme } from '@mui/material/styles';
import PropTypes from 'prop-types';
import Card from '@mui/material/Card';
import CardContent from '@mui/material/CardContent';
import Chip from '@mui/material/Chip';
import Typography from '@mui/material/Typography';
import Stack from '@mui/material/Stack';
import { LineChart } from '@mui/x-charts/LineChart';
function AreaGradient({ color, id }) {
return (
);
}
AreaGradient.propTypes = {
color: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
};
function getDaysInMonth(month, year) {
const date = new Date(year, month, 0);
const monthName = date.toLocaleDateString('en-US', {
month: 'short',
});
const daysInMonth = date.getDate();
const days = [];
let i = 1;
while (days.length < daysInMonth) {
days.push(`${monthName} ${i}`);
i += 1;
}
return days;
}
export default function SessionsChart() {
const theme = useTheme();
const data = getDaysInMonth(4, 2024);
const colorPalette = [
theme.palette.primary.light,
theme.palette.primary.main,
theme.palette.primary.dark,
];
return (
Sessions
13,277
Sessions per day for the last 30 days
(i + 1) % 5 === 0,
height: 24,
},
]}
yAxis={[{ width: 50 }]}
series={[
{
id: 'direct',
label: 'Direct',
showMark: false,
curve: 'linear',
stack: 'total',
area: true,
stackOrder: 'ascending',
data: [
300, 900, 600, 1200, 1500, 1800, 2400, 2100, 2700, 3000, 1800, 3300,
3600, 3900, 4200, 4500, 3900, 4800, 5100, 5400, 4800, 5700, 6000,
6300, 6600, 6900, 7200, 7500, 7800, 8100,
],
},
{
id: 'referral',
label: 'Referral',
showMark: false,
curve: 'linear',
stack: 'total',
area: true,
stackOrder: 'ascending',
data: [
500, 900, 700, 1400, 1100, 1700, 2300, 2000, 2600, 2900, 2300, 3200,
3500, 3800, 4100, 4400, 2900, 4700, 5000, 5300, 5600, 5900, 6200,
6500, 5600, 6800, 7100, 7400, 7700, 8000,
],
},
{
id: 'organic',
label: 'Organic',
showMark: false,
curve: 'linear',
stack: 'total',
stackOrder: 'ascending',
data: [
1000, 1500, 1200, 1700, 1300, 2000, 2400, 2200, 2600, 2800, 2500,
3000, 3400, 3700, 3200, 3900, 4100, 3500, 4300, 4500, 4000, 4700,
5000, 5200, 4800, 5400, 5600, 5900, 6100, 6300,
],
area: true,
},
]}
height={250}
margin={{ left: 0, right: 20, top: 20, bottom: 0 }}
grid={{ horizontal: true }}
sx={{
'& .MuiAreaElement-series-organic': {
fill: "url('#organic')",
},
'& .MuiAreaElement-series-referral': {
fill: "url('#referral')",
},
'& .MuiAreaElement-series-direct': {
fill: "url('#direct')",
},
}}
hideLegend
>
);
}