Files
walden-tech-screen/src/app/(authenticated)/dashboard/components/BarChart/BarChart.tsx
mifi 7119957c9e Initial commit
Load this up somewhere where I can setup CI/CD
2024-01-24 13:05:19 -05:00

41 lines
728 B
TypeScript

import {
Chart as ChartJS,
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend,
ChartData,
ChartOptions,
} from 'chart.js';
import { Bar } from 'react-chartjs-2';
import styles from './BarChart.module.scss';
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend
);
interface BarChartOpts {
className?: string;
data: ChartData<"bar">;
opts: ChartOptions<"bar">;
title?: string;
}
export function BarChart({ className, data, opts, title }: BarChartOpts) {
return (
<div className={className}>
{title && <h2 className={styles.title}>{title}</h2>}
<Bar data={data} options={opts} />
</div>
);
}