1 | import { ComponentAnimateOption, AxisGridCfg } from '@antv/g2/lib/interface';
|
2 | import { AxisTitleCfg, AxisLineCfg, AxisTickLineCfg, AxisSubTickLineCfg, AxisLabelCfg } from '@antv/g2/lib/dependents';
|
3 | import { Chart } from '../Chart';
|
4 | import { View } from '../View';
|
5 | /** 坐标轴配置属性,<Axis name="" /> */
|
6 | export interface IAxis {
|
7 | /** Axis 对应的数据字段名,如果不配置则对所有轴生效,但只支持配置visible */
|
8 | name?: string;
|
9 | visible?: boolean;
|
10 | /** 来自父级的 chart 或者 view实例 */
|
11 | view?: Chart | View;
|
12 | /**
|
13 | * 标题的配置项,null | false 表示不展示。
|
14 | * 属性结构如下:
|
15 | *
|
16 | * ```ts
|
17 | * {
|
18 | * offset?: number; // 标题距离坐标轴的距离
|
19 | * style?: ShapeAttrs; // 标题文本配置项
|
20 | * autoRotate?: boolean; // 是否自动旋转
|
21 | * }
|
22 | * ```
|
23 | *
|
24 | */
|
25 | title?: boolean | AxisTitleCfg | null;
|
26 | /**
|
27 | * 适用于直角坐标系,设置坐标轴的位置。
|
28 | */
|
29 | position?: 'top' | 'bottom' | 'right' | 'left';
|
30 | /**
|
31 | * 坐标轴线的配置项,null | false 表示不展示。
|
32 | * 属性结构如下:
|
33 | *
|
34 | * ```ts
|
35 | * {
|
36 | * style?: ShapeAttrs; // 坐标轴线的样式配置项
|
37 | * }
|
38 | * ```
|
39 | */
|
40 | line?: AxisLineCfg | null | boolean;
|
41 | /**
|
42 | * 坐标轴刻度线线的配置项,null | false 表示不展示。
|
43 | * 属性结构如下:
|
44 | *
|
45 | * ```ts
|
46 | * {
|
47 | * style?: ShapeAttrs; // 坐标轴刻度线的样式配置项
|
48 | * alignTick?: boolean; // 是否同 tick 对齐
|
49 | * length?: number; // 长度
|
50 | * }
|
51 | * ```
|
52 | */
|
53 | tickLine?: AxisTickLineCfg | null | boolean;
|
54 | /**
|
55 | * 坐标轴子刻度线的配置项,false | null 表示不展示。
|
56 | * 属性结构如下:
|
57 | *
|
58 | * ```ts
|
59 | * {
|
60 | * style?: ShapeAttrs; // 坐标轴刻度线的样式配置项
|
61 | * count?: number; // 子刻度个数
|
62 | * length?: number; // 子刻度线长度
|
63 | * }
|
64 | * ```
|
65 | */
|
66 | subTickLine?: AxisSubTickLineCfg | null | boolean;
|
67 | /**
|
68 | * 文本标签的配置项,false | null 表示不展示。
|
69 | * 属性结构如下:
|
70 | *
|
71 | * ```ts
|
72 | * {
|
73 | * // 坐标轴文本的样式
|
74 | * style?: ShapeAttrs;
|
75 | * // label 的偏移量
|
76 | * offset?: number;
|
77 | * // 文本旋转角度
|
78 | * rotate?: number;
|
79 | * // 格式化函数
|
80 | * formatter?: (text: string, item: ListItem, index: number) => any;
|
81 | * // 是否自动旋转,默认 true
|
82 | * autoRotate?: boolean | (isVertical: boolean, labelGroup: IGroup, limitLength?: number) => boolean; | string;
|
83 | * // 是否自动隐藏,默认 false
|
84 | * autoHide?: boolean | (isVertical: boolean, labelGroup: IGroup, limitLength?: number) => boolean; | string;
|
85 | * // 是否自动省略,默认 false
|
86 | * autoEllipsis?: boolean | (isVertical: boolean, labelGroup: IGroup, limitLength?: number) => boolean; | string;
|
87 | * }
|
88 | * ```
|
89 | */
|
90 | label?: AxisLabelCfg | null | boolean;
|
91 | /** 坐标轴网格线的配置项,false 表示不展示。 */
|
92 | grid?: AxisGridCfg | null | boolean;
|
93 | /** 动画开关,默认开启。 */
|
94 | animate?: boolean;
|
95 | /** 动画参数配置。 */
|
96 | animateOption?: ComponentAnimateOption;
|
97 | /** 标记坐标轴 label 的方向,左侧为 1,右侧为 -1。 */
|
98 | verticalFactor?: number;
|
99 | }
|
100 | export default function Axis(props: IAxis): any;
|