'use client' import { ResponsiveBar } from '@nivo/bar' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { nivoTheme, scoreGradient } from './chart-theme' interface ScoreDistributionProps { data: { score: number; count: number }[] averageScore: number totalScores: number } export function ScoreDistributionChart({ data, averageScore, totalScores, }: ScoreDistributionProps) { const chartData = data.map((d) => ({ score: String(d.score), count: d.count, })) return ( Score Distribution Avg: {averageScore.toFixed(2)} ({totalScores} scores)
scoreGradient(Number(bar.indexValue))} borderRadius={4} enableLabel={true} labelSkipHeight={12} labelTextColor="#ffffff" axisBottom={{ legend: 'Score', legendPosition: 'middle', legendOffset: 36, }} axisLeft={{ legend: 'Count', legendPosition: 'middle', legendOffset: -40, }} margin={{ top: 20, right: 20, bottom: 50, left: 50 }} padding={0.2} animate={true} />
) }