import { type ReactNode, type ReactElement, type PropsWithChildren } from 'react'; import { type StylingProps, type MaskingProps } from '@dynatrace/strato-components/core'; import type { TruncationMode } from '@dynatrace/strato-components/typography'; import type { TimeseriesBandDataPoint } from './timeseries-band.js'; import type { TimeseriesZoomDomain } from './timeseries.js'; import type { ChartMessage } from '../../core/types/chart-message.js'; import type { CustomColorPalette, ColorPalette } from '../../core/types/color-palette.js'; import type { ZoomInteractions } from '../../core/types/interactions.js'; import type { ValueRepresentation } from '../../core/types/scales.js'; import type { SeriesCurve, Timeseries, TimeseriesDatapoint } from '../../core/types/timeseries.js'; /** * options for choosing the chart variant * @public */ export declare const chartVariantOptions: readonly ["line", "area", "bar"]; /** * Type of the chart that will be displayed in a timeseries * @public */ export type ChartVariant = (typeof chartVariantOptions)[number]; /** * Props for the timeseries chart * @public */ export interface TimeseriesChartProps extends StylingProps, MaskingProps, 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. A number in pixels is expected. Otherwise, it will take the full width of the container * @defaultValue 100% */ width?: number; /** * 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) => ReactElement; /** Messages emitted by the chart */ onMessage?: (messages: ChartMessage[]) => void; /** The gap policy to be applied to all series of the chart */ gapPolicy?: GapPolicy; /** * 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; } /** * Time unit for time threshold expression * @public */ export type TimeUnit = 'ms' | 's' | 'min' | 'h' | 'd' | 'mo' | 'y'; /** * Time threshold expression. Example: 10min * @public */ export type TimeThreshold = `${number}${TimeUnit}`; /** * A gap policy configuration that includes a threshold * @public */ export type ThresholdGapPolicy = { threshold: TimeThreshold; }; /** * Whether to show gaps or interpolate "gap data points" between data points * @public */ export type GapPolicy = 'gap' | 'connect' | ThresholdGapPolicy; /** * Whether to show data points always, never, or depending on a width-based threshold amount * @public */ export declare const pointsDisplayOptions: readonly ["always", "never", "auto"]; /** * @public */ export type PointsDisplay = (typeof pointsDisplayOptions)[number];