Display information of project on home tab

This commit is contained in:
Takeshi Kimata
2024-05-06 19:02:29 +09:00
parent 6ccbf1be29
commit 47457e45f4
7 changed files with 131 additions and 5 deletions

View File

@@ -0,0 +1,60 @@
import React from "react";
import { useState, useEffect } from "react";
import dynamic from "next/dynamic";
import { ProgressSeriesType } from "@/types/run";
const Chart = dynamic(() => import("react-apexcharts"), { ssr: false });
type Props = {
progressSeries: ProgressSeriesType[];
progressCategories: string[];
};
export default function TestProgressBarChart({
progressSeries,
progressCategories,
}: Props) {
const [chartData, setChartData] = useState({
series: [],
options: {
labels: [],
colors: [],
},
});
useEffect(() => {
const updateChartDate = () => {
if (progressSeries) {
setChartData({
series: progressSeries,
options: {
chart: {
toolbar: {
show: false,
},
stacked: true,
},
legend: {
position: "right",
},
xaxis: {
type: "datetime",
categories: progressCategories,
},
},
});
}
};
updateChartDate();
}, [progressSeries, progressCategories]);
return (
<Chart
options={chartData.options}
series={chartData.series}
type="bar"
width={"100%"}
height={"100%"}
/>
);
}