@visactor/vseed 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/builder/builder/builder.d.ts +36 -0
  2. package/dist/index.cjs +350 -103
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.js +197 -66
  6. package/dist/index.js.map +1 -1
  7. package/dist/pipeline/spec/chart/pipes/tooltip/index.d.ts +2 -0
  8. package/dist/pipeline/spec/chart/pipes/tooltip/tooltipAreaRange.d.ts +2 -0
  9. package/dist/pipeline/spec/chart/pipes/tooltip/tooltipDisable.d.ts +2 -0
  10. package/dist/types/advancedVSeed.d.ts +12 -0
  11. package/dist/types/chartType/area/area.d.ts +16 -4
  12. package/dist/types/chartType/areaPercent/areaPercent.d.ts +16 -4
  13. package/dist/types/chartType/areaRange/areaRange.d.ts +16 -4
  14. package/dist/types/chartType/bar/bar.d.ts +16 -4
  15. package/dist/types/chartType/barParallel/barParallel.d.ts +16 -4
  16. package/dist/types/chartType/barPercent/barPercent.d.ts +16 -4
  17. package/dist/types/chartType/column/column.d.ts +16 -4
  18. package/dist/types/chartType/columnParallel/columnParallel.d.ts +16 -4
  19. package/dist/types/chartType/columnPercent/columnPercent.d.ts +16 -4
  20. package/dist/types/chartType/line/line.d.ts +17 -5
  21. package/dist/types/chartType/scatter/scatter.d.ts +12 -0
  22. package/dist/types/properties/analysis/analysis.d.ts +1 -1
  23. package/dist/types/properties/analysis/index.d.ts +1 -1
  24. package/dist/types/properties/analysis/{sortAxis.d.ts → sort.d.ts} +2 -2
  25. package/dist/types/properties/annotation/annotation.d.ts +12 -0
  26. package/dist/types/properties/annotation/annotationArea.d.ts +14 -17
  27. package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +27 -46
  28. package/dist/types/properties/annotation/annotationPoint.d.ts +0 -14
  29. package/dist/types/properties/annotation/annotationVerticalLine.d.ts +28 -50
  30. package/dist/types/properties/config/axes/axis.d.ts +1 -1
  31. package/dist/types/properties/config/legend/legend.d.ts +9 -10
  32. package/dist/types/properties/measures/measures.d.ts +6 -1
  33. package/dist/types/vseed.d.ts +133 -1
  34. package/dist/umd/index.js +273 -7958
  35. package/dist/umd/index.js.map +1 -1
  36. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  import { type Selector, type Selectors } from '../../dataSelector';
2
2
  import { z } from 'zod';
3
+ /**
4
+ * @description 水平标注线, 根据用户设置的selector 或 yValue, 从左向右绘制一条末尾有箭头的线, 标签默认在标注线的终点正下方
5
+ */
3
6
  export type AnnotationHorizontalLine = {
4
7
  /**
5
- * 依赖选择的数据, 进行数据标记.
8
+ * @description 依赖选择的数据, 进行数据标记.
6
9
  */
7
10
  selector?: Selector | Selectors;
8
11
  /**
9
- * 固定的y值, 用于标注水平线
10
- * @description 类目轴在y方向, 则可输入维值, 数值轴在y方向, 则可输入具体的数值
11
- * @default []
12
+ * @description 固定的y值, 用于标注水平线, 类目轴在y方向, 则可输入维值, 数值轴在y方向, 则可输入具体的数值
12
13
  */
13
14
  yValue?: (number | string) | (number | string)[];
14
15
  /**
15
- * 标注的文本
16
16
  * @description 标注的文本
17
17
  * @default ''
18
18
  * @example '标注文本'
@@ -21,126 +21,105 @@ export type AnnotationHorizontalLine = {
21
21
  /**
22
22
  * 文本位置
23
23
  * @description 标注线的标签位置(标签相对线的相对位置)。
24
- * @default 'insideEnd'
25
24
  * @example 'outsideEnd'
26
25
  */
27
26
  textPosition?: 'outsideStart' | 'outsideEnd' | 'outsideMiddle' | 'insideStart' | 'insideMiddle' | 'insideEnd';
28
27
  /**
29
- * 文本颜色
30
28
  * @description 文本颜色
31
- * @default '#ffffff'
32
29
  * @example 'red'
33
30
  */
34
31
  textColor?: string;
35
32
  /**
36
- * 文本字体大小
37
33
  * @description 文本字体大小
38
- * @default 12
39
34
  * @example 12
40
35
  */
41
36
  textFontSize?: number;
42
37
  /**
43
- * 文本字体重量
44
38
  * @description 文本字体重量
45
- * @default 400
46
39
  * @example 400
47
40
  */
48
41
  textFontWeight?: number;
49
42
  /**
50
- * 文本对齐方式
51
- * @description 文本对齐方式
52
- * @default 'left'
53
- * @example 'center'
43
+ * @description 文本对齐方式, 一般情况下, 无需设置
44
+ * 建议设置为'right', 这样可以确保文本在标注线的左侧
45
+ * right: 文本在参考线的左侧, 文本的右侧边缘对齐(水平)标注线的终点
46
+ * left: 文本在参考线的右侧, 文本的左侧边缘对齐(水平)标注线的终点
47
+ * center: 文本在参考线的中心, 文本的中心对齐(水平)标注线的终点
48
+ * @example 'right'
54
49
  */
55
50
  textAlign?: 'left' | 'right' | 'center';
56
51
  /**
57
- * 文本垂直对齐方式
58
- * @description 文本垂直对齐方式
59
- * @default 'bottom'
60
- * @example 'middle'
52
+ * @description 文本垂直对齐方式, 一般情况下, 无需设置
53
+ * 建议设置为'top', 这样可以确保文本完整的显示在图表的可见区域
54
+ * top: 文本在参考线的底部, 文本的顶部边缘对齐(水平)标注线
55
+ * middle: 文本在参考线的中心, 文本的中心对齐(水平)标注线
56
+ * bottom: 文本在参考线的顶部, 文本的底部边缘对齐(水平)标注线
57
+ * @example 'top'
61
58
  */
62
59
  textBaseline?: 'top' | 'middle' | 'bottom';
63
60
  /**
64
- * 文本Y方向的, 偏移量
65
- * @description 文本Y方向的, 偏移量, 支持正负
66
- * @default 0
67
- * @example offsetY: 10
61
+ * @description (水平)标注线整体在Y方向的偏移像素距离, 一般情况下, 无需设置
62
+ * 负值则整体向上偏移, 例如设置为-10, 则整个(水平)标注线组件包括文本、箭头、线段, 一起向上偏移10像素
63
+ * 正值则整体向下偏移, 例如设置为10, 则整个(水平)标注线组件包括文本、箭头、线段, 一起向下偏移10像素
64
+ * @example offsetY: 0
68
65
  */
69
66
  offsetY?: number;
70
67
  /**
71
- * 文本X方向的, 偏移量
72
- * @description 文本X方向的, 偏移量, 支持正负
73
- * @default 0
74
- * @example offsetX: -10
68
+ * @description (水平)标注线整体在X方向的偏移像素距离, 一般情况下, 无需设置
69
+ * 负值则整体向左偏移, 例如设置为-10, 则整个(水平)标注线组件包括文本、箭头、线段, 一起向左偏移10像素
70
+ * 正值则整体向右偏移, 例如设置为10, 则整个(水平)标注线组件包括文本、箭头、线段, 一起向右偏移10像素
71
+ * @example offsetX: 0
75
72
  */
76
73
  offsetX?: number;
77
74
  /**
78
75
  * 线可见
79
76
  * @description 线可见
80
- * @default true
81
77
  * @example true
82
78
  */
83
79
  lineVisible?: boolean;
84
80
  /**
85
- * 线颜色
86
81
  * @description 线颜色
87
- * @default 'red'
88
82
  * @example 'red'
89
83
  */
90
84
  lineColor?: string;
91
85
  /**
92
- * 线宽度
93
86
  * @description 线宽度
94
- * @default 2
95
87
  * @example 2
96
88
  */
97
89
  lineWidth?: number;
98
90
  /**
99
- * 线样式
100
91
  * @description 线样式
101
- * @default 'solid'
102
92
  * @example 'solid'
103
93
  */
104
94
  lineStyle?: 'solid' | 'dashed' | 'dotted';
105
95
  /**
106
- * 背景可见
107
96
  * @description 背景可见
108
- * @default true
109
97
  * @example true
110
98
  */
111
99
  backgroundVisible?: boolean;
112
100
  /**
113
- * 背景颜色
114
101
  * @description 背景颜色
115
- * @default '#212121'
116
102
  * @example 'red'
117
103
  */
118
104
  backgroundColor?: string;
119
105
  /**
120
- * 背景边框颜色
121
106
  * @description 背景边框颜色
122
- * @default 'red'
123
107
  * @example 'red'
124
108
  */
125
109
  backgroundBorderColor?: string;
126
110
  /**
127
111
  * 背景边框宽度
128
112
  * @description 背景边框宽度
129
- * @default 1
130
113
  * @example 2
131
114
  */
132
115
  backgroundBorderWidth?: number;
133
116
  /**
134
- * 背景边框圆角
135
117
  * @description 背景边框圆角
136
- * @default 4
137
118
  * @example 4
138
119
  */
139
120
  backgroundBorderRadius?: number;
140
121
  /**
141
- * 背景内边距
142
122
  * @description 背景内边距
143
- * @default 4
144
123
  * @example 4
145
124
  */
146
125
  backgroundPadding?: number;
@@ -248,4 +227,6 @@ export declare const zAnnotationHorizontalLine: z.ZodObject<{
248
227
  backgroundBorderWidth: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
249
228
  backgroundBorderRadius: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
250
229
  backgroundPadding: z.ZodOptional<z.ZodNumber>;
230
+ offsetX: z.ZodDefault<z.ZodNumber>;
231
+ offsetY: z.ZodDefault<z.ZodNumber>;
251
232
  }, z.core.$strip>;
@@ -15,91 +15,77 @@ export type AnnotationPoint = {
15
15
  /**
16
16
  * 文本颜色
17
17
  * @description 文本颜色
18
- * @default '#ffffff'
19
18
  * @example 'red'
20
19
  */
21
20
  textColor?: string;
22
21
  /**
23
22
  * 文本字体大小
24
23
  * @description 文本字体大小
25
- * @default 12
26
24
  * @example 12
27
25
  */
28
26
  textFontSize?: number;
29
27
  /**
30
28
  * 文本字体重量
31
29
  * @description 文本字体重量
32
- * @default 400
33
30
  * @example 400
34
31
  */
35
32
  textFontWeight?: number;
36
33
  /**
37
34
  * 文本对齐方式
38
35
  * @description 文本对齐方式
39
- * @default 'left'
40
36
  * @example 'left'
41
37
  */
42
38
  textAlign?: 'left' | 'right' | 'center';
43
39
  /**
44
40
  * 文本垂直对齐方式
45
41
  * @description 文本垂直对齐方式
46
- * @default 'middle'
47
42
  * @example 'middle'
48
43
  */
49
44
  textBaseline?: 'top' | 'middle' | 'bottom';
50
45
  /**
51
46
  * 文本Y方向的, 偏移量
52
- * @description 文本Y方向的, 偏移量, 支持正负
53
- * @default 0
54
47
  * @example offsetY: 10
55
48
  */
56
49
  offsetY?: number;
57
50
  /**
58
51
  * 文本X方向的, 偏移量
59
52
  * @description 文本X方向的, 偏移量, 支持正负
60
- * @default 0
61
53
  * @example offsetX: -10
62
54
  */
63
55
  offsetX?: number;
64
56
  /**
65
57
  * 背景可见
66
58
  * @description 背景可见
67
- * @default true
68
59
  * @example true
69
60
  */
70
61
  backgroundVisible?: boolean;
71
62
  /**
72
63
  * 背景颜色
73
64
  * @description 背景颜色
74
- * @default '#212121'
75
65
  * @example 'red'
76
66
  */
77
67
  backgroundColor?: string;
78
68
  /**
79
69
  * 背景边框颜色
80
70
  * @description 背景边框颜色
81
- * @default 'red'
82
71
  * @example 'red'
83
72
  */
84
73
  backgroundBorderColor?: string;
85
74
  /**
86
75
  * 背景边框宽度
87
76
  * @description 背景边框宽度
88
- * @default 1
89
77
  * @example 2
90
78
  */
91
79
  backgroundBorderWidth?: number;
92
80
  /**
93
81
  * 背景边框圆角
94
82
  * @description 背景边框圆角
95
- * @default 4
96
83
  * @example 4
97
84
  */
98
85
  backgroundBorderRadius?: number;
99
86
  /**
100
87
  * 背景内边距
101
88
  * @description 背景内边距
102
- * @default 4
103
89
  * @example 4
104
90
  */
105
91
  backgroundPadding?: number;
@@ -1,146 +1,122 @@
1
1
  import { type Selector, type Selectors } from '../../dataSelector';
2
2
  import { z } from 'zod';
3
+ /**
4
+ * @description 垂直标注线, 根据用户设置的selector 或 xValue, 从下向上绘制一条末尾有箭头的线, 标签默认在标注线终点的正左侧
5
+ */
3
6
  export type AnnotationVerticalLine = {
4
7
  /**
5
- * 依赖选择的数据, 进行数据标记.
8
+ * @description 依赖选择的数据, 进行数据标记.
6
9
  */
7
10
  selector?: Selector | Selectors;
8
11
  /**
9
- * 固定的x值, 用于标注垂直线
10
- * @description 类目轴在x方向, 则可输入维值, 数值轴在x方向, 则可输入具体的数值
11
- * @default []
12
+ * @description 固定的x值, 用于标注垂直线, 类目轴在x方向, 则可输入维值, 数值轴在x方向, 则可输入具体的数值
12
13
  */
13
14
  xValue?: (number | string) | (number | string)[];
14
15
  /**
15
- * 标注的文本
16
16
  * @description 标注的文本
17
17
  * @default ''
18
18
  * @example '标注文本'
19
19
  */
20
20
  text?: string | string[];
21
21
  /**
22
- * 文本位置
23
- * @description 标注线的标签位置(标签相对线的相对位置)。
24
- * @default 'insideEnd'
22
+ * @description 文本位置, 标注线的标签位置(标签相对线的相对位置)。
25
23
  * @example 'outsideEnd'
26
24
  */
27
25
  textPosition?: 'outsideStart' | 'outsideEnd' | 'outsideMiddle' | 'insideStart' | 'insideMiddle' | 'insideEnd';
28
26
  /**
29
- * 文本颜色
30
27
  * @description 文本颜色
31
- * @default '#ffffff'
32
28
  * @example 'red'
33
29
  */
34
30
  textColor?: string;
35
31
  /**
36
- * 文本字体大小
37
32
  * @description 文本字体大小
38
- * @default 12
39
33
  * @example 12
40
34
  */
41
35
  textFontSize?: number;
42
36
  /**
43
- * 文本字体重量
44
37
  * @description 文本字体重量
45
- * @default 400
46
38
  * @example 400
47
39
  */
48
40
  textFontWeight?: number;
49
41
  /**
50
- * 文本对齐方式
51
- * @description 文本对齐方式
52
- * @default 'right'
53
- * @example 'left'
42
+ * @description 文本对齐方式, 一般情况下, 无需设置
43
+ * 建议设置为'right', 这样可以确保文本在标注线的左侧
44
+ * right: 文本在参考线的左侧, 文本的右侧边缘对齐(垂直)标注线
45
+ * left: 文本在参考线的右侧, 文本的左侧边缘对齐(垂直)标注线
46
+ * center: 文本在参考线的中心, 文本的中心对齐(垂直)标注线
47
+ * @example 'right'
54
48
  */
55
49
  textAlign?: 'left' | 'right' | 'center';
56
50
  /**
57
- * 文本垂直对齐方式
58
- * @description 文本垂直对齐方式
59
- * @default 'top'
60
- * @example 'middle'
51
+ * @description 文本垂直对齐方式, 一般情况下, 无需设置
52
+ * 建议设置为'top', 这样可以确保文本完整的显示在图表的可见区域
53
+ * top: 文本在参考线的底部, 文本的顶部边缘对齐(垂直)标注线的终点
54
+ * middle: 文本在参考线的中心, 文本的中心对齐(垂直)标注线的终点
55
+ * bottom: 文本在参考线的顶部, 文本的底部边缘对齐(垂直)标注线的终点
56
+ * @example 'top'
61
57
  */
62
58
  textBaseline?: 'top' | 'middle' | 'bottom';
63
59
  /**
64
- * 文本Y方向的, 偏移量
65
- * @description 文本Y方向的, 偏移量, 支持正负
66
- * @default 0
67
- * @example offsetY: 10
60
+ * @description (垂直)标注线整体在Y方向的偏移像素距离, 一般情况下, 无需设置
61
+ * 负值则整体向上偏移, 例如设置为-10, 则整个标注线组件包括文本、箭头、线段, 一起向上偏移10像素
62
+ * 正值则整体向下偏移, 例如设置为10, 则整个标注线组件包括文本、箭头、线段, 一起向下偏移10像素
63
+ * @example offsetY: 0
68
64
  */
69
65
  offsetY?: number;
70
66
  /**
71
- * 文本X方向的, 偏移量
72
- * @description 文本X方向的, 偏移量, 支持正负
73
- * @default 0
74
- * @example offsetX: -10
67
+ * @description (垂直)标注线整体在X方向的偏移像素距离, 一般情况下, 无需设置
68
+ * 负值则整体向左偏移, 例如设置为-10, 则整个标注线组件包括文本、箭头、线段, 一起向左偏移10像素
69
+ * 正值则整体向右偏移, 例如设置为10, 则整个标注线组件包括文本、箭头、线段, 一起向右偏移10像素
70
+ * @example offsetX: 0
75
71
  */
76
72
  offsetX?: number;
77
73
  /**
78
- * 线可见
79
74
  * @description 线可见
80
- * @default true
81
75
  * @example true
82
76
  */
83
77
  lineVisible?: boolean;
84
78
  /**
85
- * 线颜色
86
79
  * @description 线颜色
87
- * @default 'red'
88
80
  * @example 'red'
89
81
  */
90
82
  lineColor?: string;
91
83
  /**
92
- * 线宽度
93
84
  * @description 线宽度
94
- * @default 2
95
85
  * @example 2
96
86
  */
97
87
  lineWidth?: number;
98
88
  /**
99
- * 线样式
100
89
  * @description 线样式
101
- * @default 'solid'
102
90
  * @example 'solid'
103
91
  */
104
92
  lineStyle?: 'solid' | 'dashed' | 'dotted';
105
93
  /**
106
- * 背景可见
107
94
  * @description 背景可见
108
- * @default true
109
95
  * @example true
110
96
  */
111
97
  backgroundVisible?: boolean;
112
98
  /**
113
- * 背景颜色
114
99
  * @description 背景颜色
115
- * @default '#212121'
116
100
  * @example 'red'
117
101
  */
118
102
  backgroundColor?: string;
119
103
  /**
120
- * 背景边框颜色
121
104
  * @description 背景边框颜色
122
- * @default 'red'
123
105
  * @example 'red'
124
106
  */
125
107
  backgroundBorderColor?: string;
126
108
  /**
127
- * 背景边框宽度
128
109
  * @description 背景边框宽度
129
- * @default 1
130
110
  * @example 2
131
111
  */
132
112
  backgroundBorderWidth?: number;
133
113
  /**
134
- * 背景边框圆角
135
114
  * @description 背景边框圆角
136
- * @default 4
137
115
  * @example 4
138
116
  */
139
117
  backgroundBorderRadius?: number;
140
118
  /**
141
- * 背景内边距
142
119
  * @description 背景内边距
143
- * @default 4
144
120
  * @example 4
145
121
  */
146
122
  backgroundPadding?: number;
@@ -248,4 +224,6 @@ export declare const zAnnotationVerticalLine: z.ZodObject<{
248
224
  backgroundBorderWidth: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
249
225
  backgroundBorderRadius: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
250
226
  backgroundPadding: z.ZodOptional<z.ZodNumber>;
227
+ offsetX: z.ZodDefault<z.ZodNumber>;
228
+ offsetY: z.ZodDefault<z.ZodNumber>;
251
229
  }, z.core.$strip>;
@@ -86,7 +86,7 @@ export type Axis = {
86
86
  /**
87
87
  * 轴标签, 自动限制长度的最大长度
88
88
  * @description 当标签文本长度超过最大长度时, 超出部分省略号表示, 鼠标悬浮后可见标签. 仅对类目轴生效.
89
- * @default 100
89
+ * @default 80
90
90
  */
91
91
  labelAutoLimitLength?: number;
92
92
  /**
@@ -12,15 +12,6 @@ export type Legend = {
12
12
  * @example border: true
13
13
  */
14
14
  border?: boolean;
15
- /**
16
- * 图例最大列数 或 图例最大行数
17
- * @default 1
18
- * @description
19
- * 如果图例在水平方向上, maxSize控制显示的列数
20
- * 如果图例在垂直方向上, maxSize控制显示的行数
21
- * @example maxSize: 2
22
- */
23
- maxSize?: number;
24
15
  /**
25
16
  * 图例字体大小
26
17
  * @default 12
@@ -47,10 +38,18 @@ export type Legend = {
47
38
  shapeType?: 'circle' | 'cross' | 'diamond' | 'square' | 'arrow' | 'arrow2Left' | 'arrow2Right' | 'wedge' | 'thinTriangle' | 'triangle' | 'triangleUp' | 'triangleDown' | 'triangleRight' | 'triangleLeft' | 'stroke' | 'star' | 'wye' | 'rect' | 'arrowLeft' | 'arrowRight' | 'rectRound' | 'roundLine';
48
39
  /**
49
40
  * 图例位置
50
- * @default 'top'
41
+ * @default 'right'
51
42
  * @example position: 'rightTop'
52
43
  */
53
44
  position?: 'left' | 'leftTop' | 'leftBottom' | 'lt' | 'lb' | 'top' | 'topLeft' | 'topRight' | 'tl' | 'tr' | 'right' | 'rightTop' | 'rightBottom' | 'rt' | 'rb' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'bl' | 'br';
45
+ /**
46
+ * @description 存在大量图例时, 最大列数 或 图例最大行数
47
+ * 如果position为水平方向(bottom, bottomLeft, bottomRight, bl, br, top, topLeft, topRight, tl, tr), maxSize控制显示的列数
48
+ * 如果position为垂直方向(left, leftTop, leftBottom, lt, lb, right, rightTop, rightBottom, rt, rb), maxSize控制显示的行数
49
+ * @example maxSize: 2
50
+ * @default 1
51
+ */
52
+ maxSize?: number;
54
53
  };
55
54
  export declare const zLegend: z.ZodObject<{
56
55
  enable: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -11,7 +11,12 @@ export type Measure = {
11
11
  */
12
12
  alias?: string;
13
13
  /**
14
- * @description 是否自动格式化
14
+ * @description 自动数值格式化
15
+ * 开启后, 图表的数据标签、提示信息, 会根据指标的数值, 自动根据语言环境, 选择合适的格式化方式
16
+ * 格式化规则为设置为十进制数值, 开启compact notation, 最小0位小数, 最大2位小数, 自动四舍五入, 使用浏览器提供的 Intl.NumberFormatOptions 实现该逻辑.
17
+ * 例如:
18
+ * 当locale为zh-CN: 749740.264会被自动格式化为74.45万
19
+ * 当locale为en-US: 749740.264会被自动格式化为744.5K
15
20
  * @default true
16
21
  */
17
22
  autoFormat?: boolean;