102 lines
2.1 KiB
TypeScript
102 lines
2.1 KiB
TypeScript
"use client";
|
|
import dynamic from "next/dynamic";
|
|
const Chart = dynamic(() => import("react-apexcharts"), { ssr: false });
|
|
import { colors } from "@/lib/colors";
|
|
import { useTheme } from "next-themes";
|
|
import { hexToRGB } from "@/lib/utils";
|
|
import { useConfig } from "@/hooks/use-config";
|
|
import {
|
|
getGridConfig,
|
|
getXAxisConfig,
|
|
getYAxisConfig,
|
|
} from "@/lib/appex-chart-options";
|
|
|
|
const DashedLineChart = ({ height = 300 }) => {
|
|
const [config] = useConfig();
|
|
const { theme: mode } = useTheme();
|
|
|
|
|
|
|
|
const series = [
|
|
{
|
|
name: "Sesson Duration",
|
|
data: [45, 52, 38, 24, 33, 26, 21, 20, 6, 8, 15, 10],
|
|
},
|
|
{
|
|
name: "Page Views",
|
|
data: [35, 41, 62, 42, 13, 18, 29, 37, 36, 51, 32, 35],
|
|
},
|
|
{
|
|
name: "Total Visits",
|
|
data: [87, 57, 74, 99, 75, 38, 62, 47, 82, 56, 45, 47],
|
|
},
|
|
];
|
|
const options: any = {
|
|
chart: {
|
|
toolbar: {
|
|
show: false,
|
|
},
|
|
zoom: {
|
|
enabled: false,
|
|
},
|
|
},
|
|
dataLabels: {
|
|
enabled: false,
|
|
},
|
|
stroke: {
|
|
width: [5, 7, 5],
|
|
curve: "straight",
|
|
dashArray: [0, 8, 5],
|
|
},
|
|
colors: [
|
|
colors.primary,
|
|
colors.info,
|
|
colors.success,
|
|
],
|
|
tooltip: {
|
|
theme: mode === "dark" ? "dark" : "light",
|
|
},
|
|
grid: getGridConfig(),
|
|
|
|
yaxis: getYAxisConfig(
|
|
mode === 'light' ? colors["default-600"] : colors["default-300"]
|
|
),
|
|
xaxis: getXAxisConfig(
|
|
mode === 'light' ? colors["default-600"] : colors["default-300"]
|
|
),
|
|
|
|
padding: {
|
|
top: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
left: 0,
|
|
},
|
|
legend: {
|
|
labels: {
|
|
colors: mode === 'light' ? colors["default-600"] : colors["default-300"],
|
|
},
|
|
itemMargin: {
|
|
horizontal: 5,
|
|
vertical: 5,
|
|
},
|
|
markers: {
|
|
width: 10,
|
|
height: 10,
|
|
radius: 10,
|
|
offsetX: config.isRtl ? 5 : -5
|
|
}
|
|
},
|
|
};
|
|
return (
|
|
<Chart
|
|
options={options}
|
|
series={series}
|
|
type="line"
|
|
height={height}
|
|
width={"100%"}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default DashedLineChart;
|