Create progress donut chart

This commit is contained in:
Takeshi Kimata
2024-04-27 15:14:35 +09:00
parent 5f9a7c0dc2
commit 17d4c6326d
3 changed files with 92 additions and 134 deletions

View File

@@ -0,0 +1,39 @@
import React from "react";
import { useState } from "react";
import dynamic from "next/dynamic";
const Chart = dynamic(() => import("react-apexcharts"), { ssr: false });
const testCases = [
{ name: "Passed", value: 12, color: "#17c964" },
{ name: "Failed", value: 3, color: "#f31260" },
{ name: "Skipped", value: 14, color: "#71717a" },
{ name: "Untested", value: 32, color: "#d4d4d8" },
];
export default function RunProgressDounut() {
const [chartData, setChartData] = useState({
series: testCases.map((entry) => {
return entry.value;
}),
options: {
labels: testCases.map((entry) => {
return entry.name;
}),
colors: testCases.map((entry) => {
return entry.color;
}),
},
});
return (
<div>
<h1>Progress</h1>
<Chart
options={chartData.options}
series={chartData.series}
type="donut"
width={400}
height={400}
/>
</div>
);
}