-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppWebSiteVisit.js
More file actions
46 lines (41 loc) · 1.26 KB
/
Copy pathAppWebSiteVisit.js
File metadata and controls
46 lines (41 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import PropTypes from 'prop-types';
import ReactApexChart from 'react-apexcharts';
// @mui
import { Card, CardHeader, Box } from '@mui/material';
// components
import { useChart } from '../../../components/chart';
// ----------------------------------------------------------------------
AppWebsiteVisits.propTypes = {
title: PropTypes.string,
subheader: PropTypes.string,
chartData: PropTypes.array.isRequired,
chartLabels: PropTypes.arrayOf(PropTypes.string).isRequired,
};
export default function AppWebsiteVisits({ title, subheader, chartLabels, chartData, ...other }) {
const chartOptions = useChart({
plotOptions: { bar: { columnWidth: '16%' } },
fill: { type: chartData.map((i) => i.fill) },
labels: chartLabels,
xaxis: { type: 'datetime' },
tooltip: {
shared: true,
intersect: false,
y: {
formatter: (y) => {
if (typeof y !== 'undefined') {
return `${y.toFixed(0) } L/Km`;
}
return y;
},
},
},
});
return (
<Card {...other}>
<CardHeader title={title} subheader={subheader} />
<Box sx={{ p: 3, pb: 1 }} dir="ltr">
<ReactApexChart type="line" series={chartData} options={chartOptions} height={500} />
</Box>
</Card>
);
}