Line Chart

PreviousNext

Interactive line chart visualization with trends, multiple line types, area fills, and data point analysis.

Line chart visualization built on Recharts for showing trends, time series data, and comparisons over time.

Basic Usage

Revenue Trends
Simple line chart showing revenue trends

Line Chart with Axis

Add X-axis labels to your chart for better context.

Monthly Revenue
Line chart with X-axis labels

Multiple Lines

Display multiple data series in a single chart.

Financial Overview
Multiple data series on one chart

Area Chart

Fill the area below the line to create an area chart.

Revenue Area Chart
Area chart with fill below the line

Variants

Choose from four visual styles: card, outline, ghost, or minimal.

Card Variant
Outline Variant
Ghost Variant
Minimal Variant

All features enabled for a comprehensive visualization.

Comprehensive Analytics
Complete example with all features enabled

API Reference

LineChartItem Props

PropTypeDefaultDescription
dataRecord<string, unknown>[]-Required. Array of data points to visualize
configChartConfig-Required. Configuration object mapping data keys to labels and colors
dataKeysstring[]-Specific data keys to display (defaults to all keys in config)
xAxisKeystring"name"Data key to use for X-axis labels
showGridbooleantrueShow/hide cartesian grid
showXAxisbooleantrueShow/hide X-axis
showYAxisbooleanfalseShow/hide Y-axis
showLegendbooleanfalseShow/hide legend
showTooltipbooleantrueShow/hide tooltip on hover
lineType"linear" | "monotone" | "step" | "stepBefore" | "stepAfter""monotone"Type of line interpolation
showDotsbooleanfalseShow/hide data point markers
dotSizenumber4Size of data point markers in pixels
strokeWidthnumber2Width of the line stroke
filledbooleanfalseFill area below the line (area chart mode)
connectNullsbooleanfalseConnect lines across null values
titlestring-Chart title
descriptionstring-Chart description
variant"card" | "outline" | "ghost" | "minimal""card"Visual style variant
size"sm" | "md" | "lg""md"Size preset
heightnumber | string-Custom height override
aspectRatio"video" | "square" | "auto""video"Aspect ratio preset
onClick() => void-Click handler for interactive charts
ariaLabelstring-Custom accessibility label
classNamestring-Additional CSS classes
classNamesobject-CSS classes for specific elements

LineChartCollection Props

PropTypeDefaultDescription
itemsLineChartItemProps[]-Required. Array of chart configurations
layout"stack" | "grid""stack"Layout mode
columns1 | 2 | 31Number of columns (grid layout only)
gap"sm" | "md" | "lg""md"Spacing between charts
variant"card" | "outline" | "ghost" | "minimal""card"Default variant for all items
size"sm" | "md" | "lg""md"Default size for all items
onItemClick(item, index) => void-Click handler receiving item and index
classNamestring-Additional CSS classes

ChartConfig Type

type ChartConfig = {
  [key: string]: {
    label?: React.ReactNode;
    icon?: React.ComponentType;
    color?: string;
    theme?: Record<string, string>;
  };
};