All files / src/features/statistics/components statistics-bar-chart.tsx

100% Statements 2/2
100% Branches 8/8
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                                  3x                     34x                                
import { BarChart } from '@/components/bar-chart';
import type { ChartDataPoint } from '../utils/chart-data';
import { CHART_DEFAULTS } from '@/constants/statistics';
 
// Props for the StatisticsBarChart component
export interface StatisticsBarChartProps {
  data: ChartDataPoint[];
  dataKey?: string;
  xAxisKey?: string;
  height?: number;
  showGrid?: boolean;
  showTooltip?: boolean;
  showXAxis?: boolean;
  showYAxis?: boolean;
  className?: string;
}
 
export const StatisticsBarChart = ({
  data,
  dataKey = CHART_DEFAULTS.DATA_KEY,
  xAxisKey = CHART_DEFAULTS.X_AXIS_KEY,
  height = CHART_DEFAULTS.HEIGHT,
  showGrid = CHART_DEFAULTS.SHOW_GRID,
  showTooltip = CHART_DEFAULTS.SHOW_TOOLTIP,
  showXAxis = CHART_DEFAULTS.SHOW_X_AXIS,
  showYAxis = CHART_DEFAULTS.SHOW_Y_AXIS,
  className = CHART_DEFAULTS.CLASS_NAME,
}: StatisticsBarChartProps) => {
  return (
    <div className="relative">
      <BarChart
        data={data}
        dataKey={dataKey}
        xAxisKey={xAxisKey}
        height={height}
        showGrid={showGrid}
        showTooltip={showTooltip}
        showXAxis={showXAxis}
        showYAxis={showYAxis}
        className={className}
      />
    </div>
  );
};