UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

24 lines (23 loc) 920 B
import type { Viewport } from '../../Viewport.js'; import type { Props as ViewProps } from '../../View.js'; import { Style } from '../../Style.js'; import { Chart, type ChartRange, type ChartLayout } from './Chart.js'; export interface LineChartProps<T> extends ViewProps { /** Extract [x, y] numeric values from each data row */ extract: (row: T) => [number, number]; /** Generate x-axis label from a data row */ xLabels?: (row: T) => string; /** Generate y-axis label from a numeric value */ yLabels?: (value: number) => string; /** Style for the line */ style?: Style; } export declare class LineChart<T> extends Chart<T> { #private; constructor(data: T[], props: LineChartProps<T>); getXRange(): ChartRange; getYRange(): ChartRange; getXLabels(): string[]; getYLabels(count: number): string[]; renderChart(viewport: Viewport, layout: ChartLayout): void; }