import { DataItem } from './graph/base'; export interface AxisSourceData { value: string; isSampled: boolean; } export type AxisData = { baseAxisData: DataItem[]; valueAxisDatas: DataItem[][]; }; type LineStyleOptions = { color?: string; width?: number; type?: string; }; type AxisLineOptions = { show?: boolean; onZero?: boolean; symbol?: string; lineStyle?: LineStyleOptions; // color?: string, // size?: number }; type AxisTickOptions = { show?: boolean; alignWithLabel?: boolean; length?: number; // 刻度线长度 lineStyle?: LineStyleOptions; // color?: string, // size?: number }; export type AxisLayoutData = { text: string; rotate: number; isSampled?: null | true | false; // true/false表示cat/time轴是否被采样 null表示当前属于value轴 }; export type AxisLabelOptions = { show?: boolean; rotate?: number; // 旋转角度 margin?: number; // 刻度标签与轴线之间的距离 formatter?: string | ((value: any) => string); // 格式化刻度的内容格式器 color?: string; fontStyle?: string; fontWeight?: string; fontSize?: number; align?: 'left' | 'right' | 'center'; verticalAlign?: 'top' | 'bottom' | 'middle'; lineHeight?: number; padding?: number; // ??number是否可以承载四个边距,待确认 width?: number; height?: number; overflow?: 'visible' | 'hidden'; // 文字超出宽度是否截断或者换行。配置width时有效 }; // type AxisGridOptions = { // color?: string, // size?: number // } /** * data: * 含义:类目数据 * 样例: * xAxis: { * type: 'category', * data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], * } * yAxis: { * type: 'value', * data: [1, 2, 3, 4, 5, 6, 7, 8, 9] * } */ interface SplitLineOptions { show?: boolean; } type CriticalValueFunction = (value: { min: number; max: number }) => number | null | undefined; type CriticalValue = number | string | CriticalValueFunction; export interface AxisOptions { id?: string; show?: boolean; type?: 'category' | 'value' | 'time' | 'log'; name?: string; nameLocation?: 'start' | 'middle' | 'end'; nameGap?: number; boundaryGap?: boolean; scale?: boolean; // 是否脱离0值 splitNumber?: number; // 坐标轴分割段数 min?: CriticalValue; max?: CriticalValue; minInterval?: number; // 坐标轴最小间隔 TODO: 单位如何确定? maxInterval?: number; // 坐标轴最大间隔 axisLine?: AxisLineOptions; axisTick?: AxisTickOptions; axisLabel?: AxisLabelOptions; // 坐标轴轴线 axisTextMode?: 'default' | 'classic'; // 文字位置 splitLine?: SplitLineOptions; data?: Array; } export interface CustomAxisOptions { isVertical?: boolean; // 是否纵向排布 } export interface GeneralAxisOptions { x: AxisOptions; y: AxisOptions[]; }