@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
95 lines (94 loc) • 3.73 kB
TypeScript
import { BarChartProps } from '../bar-chart/interfaces';
import { BaseComponentProps } from '../../base-component';
import { NonCancelableEventHandler } from '../../events';
export declare type ChartDataTypes = number | string | Date;
export declare type SeriesType = 'line' | 'bar';
export declare type ScaleType = 'linear' | 'log' | 'pow' | 'time' | 'categorical';
export declare type ScaleRange = [number, number];
export declare type NumericDomain = ReadonlyArray<number>;
export declare type CategoricalDomain = ReadonlyArray<string>;
export declare type DateDomain = ReadonlyArray<Date>;
export declare type ChartDomain = NumericDomain | CategoricalDomain | DateDomain;
export interface InternalChartSeries<T> {
index: number;
color: string;
series: MixedChartProps.ChartSeries<T>;
}
export interface CommonCartesianChartProps<T extends ChartDataTypes> extends BaseComponentProps {
xScaleType?: ScaleType;
yScaleType?: ScaleType;
xDomain?: T extends unknown ? ReadonlyArray<T> : ReadonlyArray<T>;
yDomain?: ReadonlyArray<number>;
xTitle?: string;
yTitle?: string;
legendTitle?: string;
ariaLabel?: string;
ariaLabelledby?: string;
i18nStrings?: MixedChartProps.I18nStrings;
emphasizeBaselineAxis?: boolean;
height?: number;
detailPopoverSize?: 'small' | 'medium' | 'large';
hideLegend?: boolean;
hideFilter?: boolean;
additionalFilters?: React.ReactNode;
highlightedSeries?: MixedChartProps.ChartSeries<T> | null;
visibleSeries?: ReadonlyArray<MixedChartProps.ChartSeries<T>>;
statusType?: 'loading' | 'finished' | 'error';
empty?: React.ReactNode;
noMatch?: React.ReactNode;
loadingText?: string;
errorText?: string;
recoveryText?: string;
onRecoveryClick?: NonCancelableEventHandler;
onFilterChange?: NonCancelableEventHandler<MixedChartProps.FilterChangeDetail<T>>;
onHighlightChange?: NonCancelableEventHandler<MixedChartProps.HighlightChangeDetail<T>>;
}
export interface MixedChartProps<T extends ChartDataTypes> extends Omit<BarChartProps<T>, 'series'> {
series: ReadonlyArray<MixedChartProps.DataSeries<T> | MixedChartProps.ThresholdSeries>;
stackedBars?: boolean;
horizontalBars?: boolean;
}
export declare namespace MixedChartProps {
export interface Datum<T> {
x: T;
y: number;
}
interface IDataSeries<T> {
type: 'line' | 'bar' | 'threshold';
title: string;
data: T extends unknown ? ReadonlyArray<Datum<T>> : ReadonlyArray<Datum<T>>;
color?: string;
}
export interface BarDataSeries<T> extends IDataSeries<T> {
type: 'bar';
}
export interface LineDataSeries<T> extends IDataSeries<T> {
type: 'line';
}
export interface ThresholdSeries extends Omit<IDataSeries<never>, 'data'> {
type: 'threshold';
y: number;
}
export type DataSeries<T> = LineDataSeries<T> | BarDataSeries<T>;
export type ChartSeries<T> = DataSeries<T> | ThresholdSeries;
export interface FilterChangeDetail<T> {
visibleSeries: ReadonlyArray<ChartSeries<T>>;
}
export interface HighlightChangeDetail<T> {
highlightedSeries: ChartSeries<T> | null;
}
export interface TickFormatter<T> {
(value: T): string;
}
export interface I18nStrings {
filterLabel?: string;
filterPlaceholder?: string;
filterSelectedAriaLabel?: string;
legendAriaLabel?: string;
detailPopoverDismissAriaLabel?: string;
chartAriaRoleDescription?: string;
xTickFormatter?: TickFormatter<string> | TickFormatter<number> | TickFormatter<Date>;
yTickFormatter?: TickFormatter<number>;
}
export {};
}