import { ReactNode } from 'react'; import { CartesianChartProps } from '../internal/components/cartesian-chart/interfaces'; export type ChartDataTypes = number | string | Date; export type ScaleType = 'linear' | 'log' | 'time' | 'categorical'; export interface InternalChartSeries { index: number; color: string; series: MixedLineBarChartProps.ChartSeries; } export interface CommonMixedChartProps extends CartesianChartProps> { /** * When set to `true`, adds a visual emphasis on the zero baseline axis. * See the usage guidelines for more details. */ emphasizeBaselineAxis?: boolean; /** * A function that determines the details that are displayed in the popover for each series. * Use this for wrapping keys or values in external links, or to display a metric breakdown by adding an additional level of nested items. * * The function is called with the parameters `{ series, x, y }` representing the series, the highlighted x coordinate value and its corresponding y value respectively, * and should return the following properties: * * `key` (ReactNode) - Name of the series. * * `value` (ReactNode) - Value of the series at the highlighted x coordinate. * * `subItems` (ReadonlyArray<{ key: ReactNode; value: ReactNode }>) - (Optional) List of nested key-value pairs. * * `expandable` (boolean) - (Optional) Determines whether the optional list of nested items provided via `subItems` is expandable. This is `false` by default. */ detailPopoverSeriesContent?: MixedLineBarChartProps.DetailPopoverSeriesContent; } export interface MixedLineBarChartProps extends CommonMixedChartProps { /** * Array that represents the source of data for the displayed chart. * Each element can represent a line series, bar series, or a threshold, and can have the following properties: * * * `title` (string): A human-readable title for this series. * * `type` (string): Series type (`"line"`, `"bar"`, or `"threshold"`). * * `data` (Array): For line and bar series, an array of data points, represented as objects with `x` and `y` properties. * * `y` (number): For threshold series, the value of the threshold. * * `color` (string): (Optional) A color hex value for this series. When assigned, it takes priority over the automatically assigned color. * * `valueFormatter` (Function): (Optional) A function that formats data values before rendering in the UI, For example, in the details popover. */ series: ReadonlyArray>; /** * When set to `true`, bars in the same data point are stacked instead of grouped next to each other. */ stackedBars?: boolean; /** * When set to `true`, the x and y axes are flipped, which causes any bars to be rendered horizontally instead of vertically. * This can only be used when the chart consists exclusively of bar series. */ horizontalBars?: boolean; /** * Determines the type of scale for values on the x axis. * Use `categorical` for charts with bars. */ xScaleType?: ScaleType; } export declare namespace MixedLineBarChartProps { export interface Datum { x: T; y: number; } interface IDataSeries { type: 'line' | 'bar' | 'threshold'; title: string; color?: string; data: T extends unknown ? ReadonlyArray> : ReadonlyArray>; valueFormatter?: T extends unknown ? CartesianChartProps.ValueFormatter : CartesianChartProps.ValueFormatter; } export interface BarDataSeries extends IDataSeries { type: 'bar'; } export interface LineDataSeries extends IDataSeries { type: 'line'; } export interface ThresholdSeries extends Omit, 'data' | 'valueFormatter'> { type: 'threshold'; y?: number; x?: T; valueFormatter?: CartesianChartProps.TickFormatter; } export interface YThresholdSeries extends Omit, 'x'> { type: 'threshold'; y: number; valueFormatter?: CartesianChartProps.TickFormatter; } export interface XThresholdSeries extends Omit, 'y' | 'valueFormatter'> { type: 'threshold'; x: T; } export type DataSeries = LineDataSeries | BarDataSeries; export type ChartSeries = DataSeries | ThresholdSeries; export type FilterChangeDetail = CartesianChartProps.FilterChangeDetail>; export type HighlightChangeDetail = CartesianChartProps.HighlightChangeDetail>; export type TickFormatter = CartesianChartProps.TickFormatter; export type ValueFormatter = CartesianChartProps.ValueFormatter; export type I18nStrings = CartesianChartProps.I18nStrings; export interface DetailPopoverSeriesData { series: ChartSeries; x: T; y: number; } export interface DetailPopoverSeriesKeyValuePair { key: ReactNode; value: ReactNode; expandable?: boolean; subItems?: ReadonlyArray<{ key: ReactNode; value: ReactNode; }>; } export interface DetailPopoverSeriesContent { (data: DetailPopoverSeriesData): DetailPopoverSeriesKeyValuePair; } export {}; } export interface VerticalMarkerX { scaledX: number; label: T | null; }