diff --git a/app/components/ui/chart.tsx b/app/components/ui/chart.tsx new file mode 100644 index 0000000..ed1074a --- /dev/null +++ b/app/components/ui/chart.tsx @@ -0,0 +1,66 @@ +import { + Chart as ChartJS, + ArcElement, + Tooltip, + Legend, + type ChartOptions, +} from 'chart.js' +import { Pie } from 'react-chartjs-2' +ChartJS.register(ArcElement, Tooltip, Legend) + +export const ChartPie = () => { + const data = { + labels: [ + 'Pidana', + 'Perdata', + 'Perceraian', + 'Surat Bisnis', + 'Surat Tanah', + 'Lainnya', + ], + datasets: [ + { + data: [33.7, 13, 22.8, 9.3, 9.3, 21.2], + backgroundColor: [ + '#FFB300', + '#4CAF50', + '#3F51B5', + '#F44336', + '#2196F3', + '#FF9800', + ], + hoverOffset: 4, + }, + ], + } + + const options: ChartOptions<'pie'> = { + maintainAspectRatio: true, + responsive: false, + plugins: { + legend: { + position: 'right', + labels: { + usePointStyle: true, + pointStyle: 'circle', + padding: 20, + }, + }, + }, + layout: { + padding: 0, + }, + } + + return ( +