import { CSSProperties, PropsWithChildren, ReactNode } from 'react'; import { Margin } from '../../common/types/margin'; import { BarChartMarker } from '../BarChart/types'; import * as d3 from 'd3'; export type LineChartCustomAxis = (axis: d3.Axis) => void; type LineChartCustomAxisSelection = (selection: d3.Selection) => void; export interface LineChartProps extends PropsWithChildren { className?: string; style?: CSSProperties; data: LineChartData[]; width?: number; height?: number; margin?: Margin; labels?: (string | number)[]; customYAxis?: LineChartCustomAxis; customXAxis?: LineChartCustomAxis; customYAxisSelection?: LineChartCustomAxisSelection; customXAxisSelection?: LineChartCustomAxisSelection; yAxisPadding?: number; xAxisPadding?: number; curve?: d3.CurveFactory; areaCurve?: d3.CurveFactory; drawGridY?: boolean; drawGridX?: boolean; min?: number; max?: number; stacked?: boolean; formatLabel?: (value: number, index: number, label: HTMLDivElement[]) => string | number; withLabels?: boolean; eachLabel?: (value: number, index: number, divs: HTMLDivElement[]) => void; dynamicTooltipEnable?: boolean; dynamicCircleRadius?: number; formatDynamicTooltip?: (invertValue: number, value: number | null) => number | string; renderTooltip?: (datas: LineChartDatas[], properties: { indexX: number; indexY: number; svg: d3.Selection; event: MouseEvent | TouchEvent; }) => ReactNode; stackedTooltip?: boolean; stackedTooltipIndex?: number | undefined; tooltipLineTop?: boolean; customize?: (args: { svg: d3.Selection; yScale: d3.ScaleLinear; xScale: d3.ScaleLinear; }) => void; customYScale?: (yScale: (value: number) => number) => void; customLine?: (line: d3.Line<[number, number]>) => void; tooltipRoot?: Element; tooltipClassName?: string; xScaleItemWidth?: number; dotSnapping?: boolean; rightAxis?: number[]; markers?: BarChartMarker[]; transitionDuration?: number; } export type LineChartDot = { radius?: number; style?: string; filter?: (value: LineChartData, index: number, circles: (d3.BaseType | SVGCircleElement)[] | ArrayLike) => boolean; }; export type LineChartData = { name?: string; values: (number | null)[]; minAreaValues?: (number | null)[]; stroke?: string; fill?: string; tooltipOff?: boolean; style?: string; dot?: LineChartDot; dynamicDotStyle?: string; dynamicDotOff?: boolean; areaStyle?: string; tooltipOrder?: number; }; export type LineChartDatas = Omit & { value: number | null; invertValue: number; }; export {};