// Type definitions for @dyna-grid/core v1.1.4 // Project: // Definitions by: zhangkun <> declare type FontStyle = 'normal' | 'italic' | 'oblique'; declare type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; export declare type DyChartThemeName = 'dy-default' | 'dy-default-dark' | 'dy-pastel' | 'dy-pastel-dark' | 'dy-solar' | 'dy-solar-dark' | 'dy-vivid' | 'dy-vivid-dark'; export interface DyChartThemePalette { fills: string[]; strokes: string[]; } export interface DyChartThemeOptions { palette?: DyChartThemePalette; overrides?: DyChartThemeOverrides; } export interface DyChartTheme extends DyChartThemeOptions { baseTheme?: DyChartThemeName; } export interface DyChartThemeOverrides { cartesian?: DyCartesianChartOptions; column?: DyCartesianChartOptions; bar?: DyCartesianChartOptions; line?: DyCartesianChartOptions; area?: DyCartesianChartOptions; scatter?: DyCartesianChartOptions; histogram?: DyCartesianChartOptions; polar?: DyPolarChartOptions; pie?: DyPolarChartOptions; common?: any; } export interface DyCartesianAxesTheme { number?: Omit; category?: Omit; groupedCategory?: Omit; time?: Omit; } export interface DyCartesianSeriesTheme { line?: DyLineSeriesOptions; scatter?: DyScatterSeriesOptions; area?: DyAreaSeriesOptions; bar?: DyBarSeriesOptions; histogram?: DyHistogramSeriesOptions; } export interface DyPolarAxesTheme { } export interface DyPolarSeriesTheme { pie?: DyPieSeriesOptions; } export interface DyChartPaddingOptions { top?: number; right?: number; bottom?: number; left?: number; } interface DyChartLabelOptions { enabled?: boolean; fontStyle?: FontStyle; fontWeight?: FontWeight; fontSize?: number; fontFamily?: string; color?: string; } interface DyDropShadowOptions { enabled?: boolean; color?: string; xOffset?: number; yOffset?: number; blue?: number; } export interface DyChartCaptionOptions { enabled?: boolean; padding?: DyChartPaddingOptions; text?: string; fontStyle?: FontStyle; fontWeight?: FontWeight; fontSize?: number; fontFamily?: string; color?: string; } interface DyNavigatorMaskOptions { fill?: string; stroke?: string; strokeWidth?: number; fillOpacity?: number; } interface DyNavigatorHandleOptions { fill?: string; stroke?: string; strokeWidth?: number; width?: number; height?: number; gripLineGap?: number; gripLineLength?: number; } export interface DyNavigatorOptions { enabled?: boolean; height?: number; margin?: number; min?: number; max?: number; mask?: DyNavigatorMaskOptions; minHandle?: DyNavigatorHandleOptions; maxHandle?: DyNavigatorHandleOptions; } declare type DyChartLegendPosition = 'top' | 'right' | 'bottom' | 'left'; interface DyChartLegendMarkerOptions { size?: number; shape?: string | (new () => any); padding?: number; strokeWidth?: number; } interface DyChartLegendLabelOptions { color?: string; fontStyle?: FontStyle; fontWeight?: FontWeight; fontSize?: number; fontFamily?: string; } interface DyChartLegendItemOptions { marker?: DyChartLegendMarkerOptions; label?: DyChartLegendLabelOptions; paddingX?: number; paddingY?: number; } export interface DyChartLegendOptions { enabled?: boolean; position?: DyChartLegendPosition; spacing?: number; item?: DyChartLegendItemOptions; } interface DyBaseChartOptions { container?: HTMLElement; data?: any[]; width?: number; height?: number; autoSize?: boolean; padding?: DyChartPaddingOptions; background?: { visible?: boolean; fill?: string; }; title?: DyChartCaptionOptions; subtitle?: DyChartCaptionOptions; tooltipClass?: string; tooltipTracking?: boolean; navigator?: DyNavigatorOptions; legend?: DyChartLegendOptions; listeners?: { [key in string]: Function; }; theme?: string | DyChartTheme; } interface DyBaseAxisOptions { keys?: string[]; } declare type DyCartesianAxisPosition = 'top' | 'right' | 'bottom' | 'left'; interface DyAxisLineOptions { width?: number; color?: string; } interface DyAxisTickOptions { width?: number; size?: number; color?: string; count?: any; } interface DyAxisLabelFormatterParams { readonly value: any; readonly index: number; readonly fractionDigits?: number; readonly formatter?: (x: any) => string; } interface DyAxisLabelOptions { fontStyle?: FontStyle; fontWeight?: FontWeight; fontSize?: number; fontFamily?: string; padding?: number; color?: string; rotation?: number; format?: string; formatter?: (params: DyAxisLabelFormatterParams) => string; } interface DyAxisGridStyle { stroke?: string; lineDash?: number[]; } interface DyBaseCartesianAxisOptions extends DyBaseAxisOptions { position?: DyCartesianAxisPosition; title?: DyChartCaptionOptions; line?: DyAxisLineOptions; tick?: DyAxisTickOptions; label?: DyAxisLabelOptions; gridStyle?: DyAxisGridStyle[]; } interface DyNumberAxisOptions extends DyBaseCartesianAxisOptions { type: 'number'; nice?: boolean; min?: number; max?: number; } interface DyCategoryAxisOptions extends DyBaseCartesianAxisOptions { type: 'category'; paddingInner?: number; paddingOuter?: number; } interface DyGroupedCategoryAxisOptions extends DyBaseCartesianAxisOptions { type: 'groupedCategory'; } interface DyTimeAxisOptions extends DyBaseCartesianAxisOptions { type: 'time'; nice?: boolean; } export declare type DyCartesianAxisOptions = DyNumberAxisOptions | DyCategoryAxisOptions | DyGroupedCategoryAxisOptions | DyTimeAxisOptions; declare type DyPolarAxisOptions = any; interface DyBaseSeriesOptions { tooltipEnabled?: boolean; data?: any[]; visible?: boolean; showInLegend?: boolean; listeners?: { [key in string]: Function; }; } export interface DyTooltipRendererResult { title?: string; content?: string; } interface DySeriesTooltipRendererParams { readonly datum: any; readonly title?: string; readonly color?: string; } interface DyCartesianSeriesTooltipRendererParams extends DySeriesTooltipRendererParams { readonly xKey: string; readonly xValue?: any; readonly xName?: string; readonly yKey: string; readonly yValue?: any; readonly yName?: string; } export interface DyPolarSeriesTooltipRendererParams extends DySeriesTooltipRendererParams { readonly angleKey: string; readonly angleValue?: any; readonly angleName?: string; readonly radiusKey?: string; readonly radiusValue?: any; readonly radiusName?: string; } interface DyScatterSeriesTooltipRendererParams extends DyCartesianSeriesTooltipRendererParams { readonly sizeKey?: string; readonly sizeName?: string; readonly labelKey?: string; readonly labelName?: string; } interface DySeriesMarker { enabled?: boolean; shape?: string; size?: number; maxSize?: number; fill?: string; stroke?: string; strokeWidth?: number; } interface DyCartesianSeriesMarkerFormatterParams { xKey: string; yKey: string; } interface DyCartesianSeriesMarkerFormat { fill?: string; stroke?: string; strokeWidth?: number; size?: number; } interface DyCartesianSeriesMarker extends DySeriesMarker { formatter?: (params: DyCartesianSeriesMarkerFormatterParams) => DyCartesianSeriesMarkerFormat; } export interface DySeriesTooltip { enabled?: boolean; } export interface DyLineSeriesTooltip extends DySeriesTooltip { renderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyLineSeriesOptions extends DyBaseSeriesOptions { type?: 'line'; marker?: DyCartesianSeriesMarker; xKey?: string; yKey?: string; xName?: string; yName?: string; title?: string; stroke?: string; strokeWidth?: number; strokeOpacity?: number; lineDash?: number[]; lineDashOffset?: number; highlightStyle?: { fill?: string; stroke?: string; }; tooltip?: DyLineSeriesTooltip; tooltipRenderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyScatterSeriesTooltip extends DySeriesTooltip { renderer?: (params: DyScatterSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyScatterSeriesOptions extends DyBaseSeriesOptions { type?: 'scatter'; marker?: DyCartesianSeriesMarker; xKey?: string; yKey?: string; xName?: string; yName?: string; title?: string; fill?: string; stroke?: string; strokeWidth?: number; fillOpacity?: number; strokeOpacity?: number; highlightStyle?: { fill?: string; stroke?: string; }; tooltip?: DyScatterSeriesTooltip; tooltipRenderer?: (params: DyScatterSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyAreaSeriesTooltip extends DySeriesTooltip { renderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; format?: string; } export interface DyAreaSeriesOptions extends DyBaseSeriesOptions { type?: 'area'; marker?: DyCartesianSeriesMarker; xKey?: string; yKeys?: string[]; xName?: string; yNames?: string[]; fills?: string[]; strokes?: string[]; strokeWidth?: number; fillOpacity?: number; strokeOpacity?: number; lineDash?: number[]; lineDashOffset?: number; shadow?: DyDropShadowOptions; highlightStyle?: { fill?: string; stroke?: string; }; tooltip?: DyAreaSeriesTooltip; tooltipRenderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } interface DyBarSeriesLabelOptions extends DyChartLabelOptions { formatter?: (params: { value: number; }) => string; } export interface DyBarSeriesFormatterParams { readonly datum: any; readonly fill?: string; readonly stroke?: string; readonly strokeWidth: number; readonly highlighted: boolean; readonly xKey: string; readonly yKey: string; } export interface DyBarSeriesFormat { fill?: string; stroke?: string; strokeWidth?: number; } export interface DyBarSeriesTooltip extends DySeriesTooltip { renderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyBarSeriesOptions extends DyBaseSeriesOptions { type?: 'bar' | 'column'; grouped?: boolean; normalizedTo?: number; xKey?: string; yKeys?: string[] | string[][]; xName?: string; yNames?: string[] | { [key in string]: string; }; fills?: string[]; strokes?: string[]; strokeWidth?: number; fillOpacity?: number; strokeOpacity?: number; lineDash?: number[]; lineDashOffset?: number; shadow?: DyDropShadowOptions; highlightStyle?: { fill?: string; stroke?: string; }; label?: DyBarSeriesLabelOptions; tooltip?: DyBarSeriesTooltip; tooltipRenderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; formatter?: (params: DyBarSeriesFormatterParams) => DyBarSeriesFormat; } interface DyHistogramSeriesLabelOptions extends DyChartLabelOptions { formatter?: (params: { value: number; }) => string; } export interface DyHistogramSeriesTooltip extends DySeriesTooltip { renderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyHistogramSeriesOptions extends DyBaseSeriesOptions { type?: 'histogram'; fill?: string; stroke?: string; fillOpacity?: number; strokeOpacity?: number; strokeWidth?: number; lineDash?: number[]; lineDashOffset?: number; xKey?: string; xName?: string; yKey?: string; yName?: string; areaPlot?: boolean; bins?: [number, number][]; binCount?: number; aggregation?: 'count' | 'sum' | 'mean'; shadow?: DyDropShadowOptions; highlightStyle?: { fill?: string; stroke?: string; }; label?: DyHistogramSeriesLabelOptions; tooltip?: DyHistogramSeriesTooltip; tooltipRenderer?: (params: DyCartesianSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } interface DyPieSeriesLabelOptions extends DyChartLabelOptions { offset?: number; minAngle?: number; } export interface DyPieSeriesFormatterParams { readonly datum: any; readonly fill?: string; readonly stroke?: string; readonly strokeWidth: number; readonly highlighted: boolean; readonly angleKey: string; readonly radiusKey?: string; } export interface DyPieSeriesFormat { fill?: string; stroke?: string; strokeWidth?: number; } export interface DyPieSeriesTooltip extends DySeriesTooltip { renderer?: (params: DyPieSeriesTooltipRendererParams) => string | DyTooltipRendererResult; } export interface DyPieSeriesOptions extends DyBaseSeriesOptions { type?: 'pie'; title?: DyChartCaptionOptions; label?: DyPieSeriesLabelOptions; callout?: { colors?: string[]; length?: number; strokeWidth?: number; }; angleKey?: string; angleName?: string; radiusKey?: string; radiusName?: string; labelKey?: string; labelName?: string; fills?: string[]; strokes?: string[]; fillOpacity?: number; strokeOpacity?: number; strokeWidth?: number; lineDash?: number[]; lineDashOffset?: number; rotation?: number; outerRadiusOffset?: number; innerRadiusOffset?: number; shadow?: DyDropShadowOptions; highlightStyle?: { fill?: string; stroke?: string; }; tooltip?: DyPieSeriesTooltip; tooltipRenderer?: (params: DyPieSeriesTooltipRendererParams) => string | DyTooltipRendererResult; formatter?: (params: DyPieSeriesFormatterParams) => DyPieSeriesFormat; } interface DyPieSeriesTooltipRendererParams extends DyPolarSeriesTooltipRendererParams { labelKey?: string; labelName?: string; } declare type DyCartesianSeriesOptions = DyLineSeriesOptions | DyScatterSeriesOptions | DyAreaSeriesOptions | DyBarSeriesOptions | DyHistogramSeriesOptions; declare type DyPolarSeriesOptions = DyPieSeriesOptions; export interface DyCartesianChartOptions extends DyBaseChartOptions { type?: 'cartesian' | 'groupedCategory' | 'line' | 'bar' | 'column' | 'area' | 'scatter'; axes?: TAxisOptions; series?: TSeriesOptions; } export interface DyPolarChartOptions extends DyBaseChartOptions { type?: 'polar' | 'pie'; axes?: TAxisOptions; series?: TSeriesOptions; } export declare type DyChartOptions = DyCartesianChartOptions | DyPolarChartOptions; export {};