import { type ReactNode } from 'react'; import type { TimeseriesBandDataPoint } from './timeseries-band.js'; import type { ChartVariant, TimeseriesZoomDomain } from './timeseries.js'; import type { BehaviorTrackingProps } from '../../../core/types/behavior-tracking-props.js'; import { MaskingProps } from '../../../core/types/masking-props.js'; import { StylingProps } from '../../../core/types/styling-props.js'; import type { TruncationMode } from '../../../typography/text-ellipsis/TextEllipsis.js'; import type { PointsDisplay } from '../../core/components/canvas/types/canvas-shape.js'; import type { ChartMessage } from '../../core/types/chart-message.js'; import type { ColorPalette, CustomColorPalette } from '../../core/types/color-palette.js'; import type { TimeGapPolicy } from '../../core/types/gap-policy.js'; import type { ZoomInteractions } from '../../core/types/interactions.js'; import type { ValueRepresentation } from '../../core/types/scales.js'; import type { SeriesActionsTemplate } from '../../core/types/series-actions-template.js'; import type { SeriesCurve, Timeseries, TimeseriesDatapoint } from '../../core/types/timeseries.js'; /** * Props for the timeseries chart * @public */ export interface TimeseriesChartProps extends StylingProps, MaskingProps, BehaviorTrackingProps, ZoomInteractions { /** * The series data passed to the chart */ data?: Timeseries[]; /** The height of the chart. If a number is passed, it will be treated as px. * @defaultValue 300px */ height?: number | string; /** * Chart width. When a number is specified, it's treated as pixels, * otherwise a valid width string is expected. * @defaultValue 100% */ width?: number | string; /** * Variant to configure the type of chart * @defaultValue 'line' */ variant?: ChartVariant; /** Exposed callback to display series actions for a series */ seriesActions?: (timeseries: unknown, datapoint?: TimeseriesDatapoint | TimeseriesBandDataPoint) => SeriesActionsTemplate; /** Messages emitted by the chart */ onMessage?: (messages: ChartMessage[]) => void; /** The gap policy to be applied to all series of the chart */ gapPolicy?: TimeGapPolicy; /** * Show the datapoints always, never or based on a threshold amount. * @defaultValue 'auto * */ pointsDisplay?: PointsDisplay; /** The value representation to be used, either absolute or relative */ valueRepresentation?: ValueRepresentation; /** Show the loading indicator when truly. * @defaultValue false */ loading?: boolean; /** * Color palette that will be applied to the chart. * @defaultValue 'categorical' */ colorPalette?: ColorPalette | CustomColorPalette; /** * Truncation mode to use (start, middle, end) * Applied to all the parts that truncate text. * @defaultValue 'middle' */ truncationMode?: TruncationMode; /** Defines the curve shape of the series * @defaultValue 'linear' */ curve?: SeriesCurve; /** Enables infinite zooming * @defaultValue 'false' */ infiniteZoom?: boolean; children?: ReactNode; }