95 lines
2.2 KiB
TypeScript
95 lines
2.2 KiB
TypeScript
"use client";
|
|
|
|
import dynamic from "next/dynamic";
|
|
import { useTheme } from "next-themes";
|
|
|
|
import { getGridConfig, getLabel, getYAxisConfig } from "@/lib/utils/appex-chart-options";
|
|
import { colors } from "@/lib/utils/colors";
|
|
import { useConfig } from "@/lib/hooks/use-config";
|
|
import { hexToRGB } from "@/lib/utils/utils";
|
|
|
|
const Chart = dynamic(() => import("react-apexcharts"), { ssr: false });
|
|
|
|
const MissingDataLineChart = ({ height = 300 }) => {
|
|
const [config] = useConfig();
|
|
const { theme: mode } = useTheme();
|
|
|
|
const series = [
|
|
{
|
|
name: "Peter",
|
|
data: [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9],
|
|
},
|
|
{
|
|
name: "Johnny",
|
|
data: [10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null],
|
|
},
|
|
{
|
|
name: "David",
|
|
data: [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null],
|
|
},
|
|
];
|
|
|
|
const options: any = {
|
|
chart: {
|
|
toolbar: {
|
|
show: false,
|
|
},
|
|
},
|
|
dataLabels: {
|
|
enabled: false,
|
|
},
|
|
stroke: {
|
|
width: [5, 5, 4],
|
|
curve: "straight",
|
|
},
|
|
zoom: {
|
|
enabled: false,
|
|
},
|
|
animations: {
|
|
enabled: false,
|
|
},
|
|
colors: [colors.primary, colors.danger, colors.success],
|
|
tooltip: {
|
|
theme: mode === "dark" ? "dark" : "light",
|
|
},
|
|
grid: getGridConfig(),
|
|
|
|
yaxis: getYAxisConfig(mode === "light" ? colors["default-600"] : colors["default-300"]),
|
|
|
|
xaxis: {
|
|
axisBorder: {
|
|
show: false,
|
|
},
|
|
axisTicks: {
|
|
show: false,
|
|
},
|
|
labels: getLabel(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 MissingDataLineChart;
|