@octopusdeploy/design-system-components
Version:
The design systems component library.
34 lines (33 loc) • 1.62 kB
TypeScript
import type { ObjectPropertyPath } from "@octopusdeploy/type-utils";
import type { ReactNode } from "react";
import type { TooltipContentProps } from "recharts";
import type { NameType, ValueType } from "recharts/types/component/DefaultTooltipContent";
import type { AxisDomain, Margin } from "recharts/types/util/types";
export interface MultiSeriesData<TResource> {
name: string;
id: string;
data: TResource[];
}
export interface BaseChartProps<TResource> {
data: MultiSeriesData<TResource>[];
dataKey: ObjectPropertyPath<TResource>;
xAxisDataKey: ObjectPropertyPath<TResource>;
yAxisDataKey?: ObjectPropertyPath<TResource>;
xAxisLabel?: string;
yAxisLabel?: string;
xAxisType?: "number" | "category";
yAxisType?: "number" | "category";
margin?: Margin;
yTickFormatter?: (value: any, index: number) => string;
xTickFormatter?: (value: any, index: number) => string;
xAxisDomain?: AxisDomain;
yAxisDomain?: AxisDomain;
loading?: boolean;
yAxisTickArray?: (string | number)[];
xAxisTickInterval?: number;
}
export interface LineChartProps<TResource> extends BaseChartProps<TResource> {
tooltip?: JSX.Element | ((props: TooltipContentProps<ValueType, NameType>) => ReactNode);
showLegend?: boolean;
}
export declare function LineChart<TResource>({ data, dataKey, xAxisDataKey, yAxisDataKey, xAxisLabel, yAxisLabel, xTickFormatter, yTickFormatter, xAxisDomain, yAxisDomain, xAxisType, yAxisType, margin, tooltip, showLegend, loading, yAxisTickArray, xAxisTickInterval, }: LineChartProps<TResource>): import("react/jsx-runtime").JSX.Element;