Computing for good
Atlanta Food Consortium/Feature Docs

LineChartComponent

A single or multi-line chart for comparing metrics over time. Built on Recharts.

Overview

LineChartComponent renders a line chart that supports multiple lines. Each line is defined by a lines config array with its own dataKey, label, and color. Used in the Admin Dashboard to show monthly platform trends.

Props

PropTypeRequiredDescription
dataobject[]YesArray of data points.
linesLineConfig[]YesArray of line definitions - each with dataKey, label, and color.
xAxisKeystringYesKey used for X-axis labels.
titlestringNoTitle above the chart.
descriptionstringNoSubtitle below the title.

Single-line usage

import LineChartComponent from '@/components/charts/LineChartComponent';

const data = [
  { month: 'Jan', claims: 12 },
  { month: 'Feb', claims: 19 },
  { month: 'Mar', claims: 15 },
];

<LineChartComponent
  data={data}
  xAxisKey='month'
  title='Claims Over Time'
  lines={[{ dataKey: 'claims', label: 'Claims', color: '#3b82f6' }]}
/>;

Multi-line usage

<LineChartComponent
  data={data}
  xAxisKey='month'
  title='Platform Activity'
  lines={[
    { dataKey: 'claims', label: 'Claims', color: '#3b82f6' },
    { dataKey: 'products', label: 'Products Posted', color: '#10b981' },
  ]}
/>

Source file: src/components/charts/LineChartComponent.tsx