x-next 1.7.0 → 1.8.1
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.
- package/AI_USAGE.md +129 -4
- package/CHANGELOG.md +47 -0
- package/dist/_hooks/use-chart-size.d.ts +25 -0
- package/dist/_utils/chart/index.d.ts +6 -0
- package/dist/_utils/chart/padding.d.ts +15 -0
- package/dist/_utils/chart/path.d.ts +34 -0
- package/dist/_utils/chart/scale.d.ts +55 -0
- package/dist/components/_components/chart/ChartAxis.d.ts +85 -0
- package/dist/components/_components/chart/ChartLegend.d.ts +26 -0
- package/dist/components/_components/chart/ChartTooltip.d.ts +76 -0
- package/dist/components/_components/chart/colors.d.ts +10 -0
- package/dist/components/_components/chart/interface.d.ts +38 -0
- package/dist/components/bar-chart/BarChart.d.ts +278 -0
- package/dist/components/bar-chart/helpers/layout.d.ts +55 -0
- package/dist/components/bar-chart/index.d.ts +600 -0
- package/dist/components/bar-chart/interface.d.ts +74 -0
- package/dist/components/bar-chart/props.d.ts +145 -0
- package/dist/components/heatmap/Heatmap.d.ts +10 -1
- package/dist/components/heatmap/index.d.ts +30 -3
- package/dist/components/index.d.ts +3 -0
- package/dist/components/line-chart/LineChart.d.ts +295 -0
- package/dist/components/line-chart/helpers/layout.d.ts +74 -0
- package/dist/components/line-chart/index.d.ts +614 -0
- package/dist/components/line-chart/interface.d.ts +76 -0
- package/dist/components/line-chart/props.d.ts +173 -0
- package/dist/components/pie-chart/PieChart.d.ts +219 -0
- package/dist/components/pie-chart/index.d.ts +470 -0
- package/dist/components/pie-chart/interface.d.ts +58 -0
- package/dist/components/pie-chart/props.d.ts +107 -0
- package/dist/components/trend-chart/components/TrendChart.d.ts +19 -96
- package/dist/components/trend-chart/index.d.ts +33 -187
- package/dist/components/trend-chart/props.d.ts +9 -78
- package/dist/components/trend-chart/themes.d.ts +0 -1
- package/dist/es/_hooks/use-chart-size.js +25 -0
- package/dist/es/_styles/palette-aliases.js +5 -0
- package/dist/es/_utils/chart/padding.js +22 -0
- package/dist/es/_utils/chart/path.js +69 -0
- package/dist/es/_utils/chart/scale.js +77 -0
- package/dist/es/components/_components/chart/ChartAxis.js +79 -0
- package/dist/es/components/_components/chart/ChartLegend.js +53 -0
- package/dist/es/components/_components/chart/ChartTooltip.js +64 -0
- package/dist/es/components/_components/chart/colors.js +12 -0
- package/dist/es/components/bar-chart/BarChart.js +470 -0
- package/dist/es/components/bar-chart/helpers/layout.js +53 -0
- package/dist/es/components/bar-chart/index.js +8 -0
- package/dist/es/components/bar-chart/props.js +148 -0
- package/dist/es/components/heatmap/Heatmap.js +249 -172
- package/dist/es/components/index.js +132 -126
- package/dist/es/components/line-chart/LineChart.js +532 -0
- package/dist/es/components/line-chart/helpers/layout.js +80 -0
- package/dist/es/components/line-chart/index.js +8 -0
- package/dist/es/components/line-chart/props.js +178 -0
- package/dist/es/components/pie-chart/PieChart.js +397 -0
- package/dist/es/components/pie-chart/index.js +8 -0
- package/dist/es/components/pie-chart/props.js +104 -0
- package/dist/es/components/trend-chart/components/TrendChart.js +143 -183
- package/dist/es/components/trend-chart/components/trend-chart-curve.js +85 -81
- package/dist/es/components/trend-chart/props.js +28 -74
- package/dist/es/components/trend-chart/themes.js +30 -31
- package/dist/es/index.js +193 -187
- package/dist/es/locale/en-US.js +8 -1
- package/dist/es/locale/zh-CN.js +8 -1
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +13 -0
- package/dist/style/bar-chart.css +1 -0
- package/dist/style/bar-chart.js +2 -0
- package/dist/style/base.css +1 -1
- package/dist/style/heatmap.css +1 -1
- package/dist/style/line-chart.css +1 -0
- package/dist/style/line-chart.js +2 -0
- package/dist/style/pie-chart.css +1 -0
- package/dist/style/pie-chart.js +2 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
- package/volar.d.ts +3 -0
- package/dist/components/trend-chart/components/trend-chart-grid.d.ts +0 -55
- package/dist/components/trend-chart/components/trend-chart-labels.d.ts +0 -26
- package/dist/components/trend-chart/helpers/genPath.d.ts +0 -8
- package/dist/components/trend-chart/helpers/getPadding.d.ts +0 -8
- package/dist/components/trend-chart/helpers/validatePadding.d.ts +0 -2
- package/dist/es/components/trend-chart/components/trend-chart-grid.js +0 -62
- package/dist/es/components/trend-chart/components/trend-chart-labels.js +0 -75
- package/dist/es/components/trend-chart/helpers/genPath.js +0 -22
- package/dist/es/components/trend-chart/helpers/getPadding.js +0 -21
- package/dist/es/components/trend-chart/helpers/validatePadding.js +0 -7
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { CSSColor } from '../../_props/css';
|
|
3
|
+
import { BarChartGridOptions, BarChartLabelsOptions, BarChartSeries } from './interface';
|
|
4
|
+
export declare const barChartProps: {
|
|
5
|
+
/**
|
|
6
|
+
* @zh 类目轴标签,与每个系列 data 的下标一一对应;缺省时按 1、2、3… 显示
|
|
7
|
+
* @en Category axis labels, aligned by index with each series data
|
|
8
|
+
*/
|
|
9
|
+
categories: {
|
|
10
|
+
type: PropType<Array<string | number>>;
|
|
11
|
+
default: () => never[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @zh 数据系列;单系列渲染为普通柱状图,多系列可并排或堆叠
|
|
15
|
+
* @en Data series; a single series renders plain bars, multiple series render
|
|
16
|
+
* grouped or stacked
|
|
17
|
+
*/
|
|
18
|
+
series: {
|
|
19
|
+
required: boolean;
|
|
20
|
+
type: PropType<BarChartSeries[]>;
|
|
21
|
+
default: () => never[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @zh 是否堆叠多系列;false 时同组柱体并排
|
|
25
|
+
* @en Whether to stack multiple series; side-by-side when false
|
|
26
|
+
* @defaultValue false
|
|
27
|
+
*/
|
|
28
|
+
stack: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @zh 图表高度,数字按 px 处理
|
|
34
|
+
* @en Chart height; numbers are treated as px
|
|
35
|
+
* @defaultValue 240
|
|
36
|
+
*/
|
|
37
|
+
height: {
|
|
38
|
+
type: PropType<number | string>;
|
|
39
|
+
default: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @zh 图表宽度,数字按 px 处理,默认撑满父容器
|
|
43
|
+
* @en Chart width; numbers are treated as px, defaults to filling the parent
|
|
44
|
+
* @defaultValue '100%'
|
|
45
|
+
*/
|
|
46
|
+
width: {
|
|
47
|
+
type: PropType<number | string>;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @zh 数值轴上界;传入后不再自动计算「好看」的刻度,超出部分被截断
|
|
52
|
+
* @en Upper bound of the value axis; disables nice-tick calculation and clamps
|
|
53
|
+
* larger values
|
|
54
|
+
*/
|
|
55
|
+
max: {
|
|
56
|
+
type: NumberConstructor;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @zh 柱体宽度,默认按类目带自适应(并排时不超过 24px,单柱不超过 32px)
|
|
60
|
+
* @en Bar width; defaults to adapting to the band (max 24px grouped, 32px single)
|
|
61
|
+
*/
|
|
62
|
+
barWidth: {
|
|
63
|
+
type: NumberConstructor;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* @zh 柱顶圆角半径
|
|
67
|
+
* @en Radius of the bar top corners
|
|
68
|
+
* @defaultValue 4
|
|
69
|
+
*/
|
|
70
|
+
barRadius: {
|
|
71
|
+
type: NumberConstructor;
|
|
72
|
+
default: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @zh 绘制边距,支持 1-4 个非负数字字符串或单个非负数字
|
|
76
|
+
* @en Plot padding; supports a single non-negative number or CSS-like 1-4 values
|
|
77
|
+
* @defaultValue '8'
|
|
78
|
+
*/
|
|
79
|
+
padding: {
|
|
80
|
+
default: string;
|
|
81
|
+
type: PropType<string | number>;
|
|
82
|
+
validator(val: string | number): boolean;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @zh 横向网格线配置
|
|
86
|
+
* @en Horizontal grid line options
|
|
87
|
+
*/
|
|
88
|
+
grid: {
|
|
89
|
+
default: null;
|
|
90
|
+
type: PropType<BarChartGridOptions>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* @zh 坐标轴标签配置
|
|
94
|
+
* @en Axis label options
|
|
95
|
+
*/
|
|
96
|
+
labels: {
|
|
97
|
+
default: null;
|
|
98
|
+
type: PropType<BarChartLabelsOptions>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @zh 悬浮提示
|
|
102
|
+
* @en Hover tooltip
|
|
103
|
+
* @defaultValue true
|
|
104
|
+
*/
|
|
105
|
+
tooltip: {
|
|
106
|
+
type: BooleanConstructor;
|
|
107
|
+
default: boolean;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* @zh 图例;多系列时建议开启,点击图例项可临时隐藏/显示对应系列
|
|
111
|
+
* @en Legend; recommended for multiple series, clicking an item toggles the
|
|
112
|
+
* series visibility
|
|
113
|
+
* @defaultValue false
|
|
114
|
+
*/
|
|
115
|
+
legend: {
|
|
116
|
+
type: BooleanConstructor;
|
|
117
|
+
default: boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @zh 数值格式化函数,用于提示、图例与数值轴
|
|
121
|
+
* @en Value formatter used by tooltip, legend and the value axis
|
|
122
|
+
*/
|
|
123
|
+
valueFormatter: {
|
|
124
|
+
type: PropType<(value: number) => string>;
|
|
125
|
+
default: (value: number) => string;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @zh 加载中
|
|
129
|
+
* @en Loading state
|
|
130
|
+
* @defaultValue false
|
|
131
|
+
*/
|
|
132
|
+
loading: {
|
|
133
|
+
type: PropType<boolean | Record<string, unknown>>;
|
|
134
|
+
default: boolean;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* @zh 无障碍名称;设置后根节点带 role="img"
|
|
138
|
+
* @en Accessible name; adds role="img" to the root when set
|
|
139
|
+
*/
|
|
140
|
+
ariaLabel: {
|
|
141
|
+
type: StringConstructor;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
export type BarChartProps = ExtractPropTypes<typeof barChartProps>;
|
|
145
|
+
export type { BarChartGridOptions, BarChartLabelsOptions, BarChartSeries, CSSColor };
|
|
@@ -125,7 +125,6 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
125
125
|
};
|
|
126
126
|
mergedSize: import('vue').ComputedRef<"mini" | "small" | "medium" | "large">;
|
|
127
127
|
cells: import('vue').ComputedRef<HeatmapCell[]>;
|
|
128
|
-
rows: import('vue').ComputedRef<HeatmapCell[][]>;
|
|
129
128
|
range: import('vue').ComputedRef<HeatmapResolvedRange | null>;
|
|
130
129
|
gridStyle: import('vue').ComputedRef<{
|
|
131
130
|
'--x-heatmap-cell-size': string;
|
|
@@ -153,6 +152,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
153
152
|
cancel(): void;
|
|
154
153
|
};
|
|
155
154
|
clearActive: () => void;
|
|
155
|
+
handleKeydown: (ev: KeyboardEvent) => void;
|
|
156
|
+
handleGridFocus: () => void;
|
|
157
|
+
activeDescendant: import('vue').ComputedRef<string | undefined>;
|
|
158
|
+
gridLabel: import('vue').ComputedRef<string>;
|
|
159
|
+
cellIdPrefix: string;
|
|
160
|
+
liveText: import('vue').ComputedRef<string>;
|
|
156
161
|
isInRange: (cell: HeatmapCell) => boolean;
|
|
157
162
|
colorPalette: import('vue').ComputedRef<string[]>;
|
|
158
163
|
slots: Readonly<{
|
|
@@ -165,6 +170,10 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
165
170
|
'indicator-leading-text'?: (() => unknown) | undefined;
|
|
166
171
|
'indicator-trailing-text'?: (() => unknown) | undefined;
|
|
167
172
|
}>;
|
|
173
|
+
refs: {
|
|
174
|
+
tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
175
|
+
};
|
|
176
|
+
setTooltipElement: (el: HTMLDivElement | null) => void;
|
|
168
177
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
169
178
|
/**
|
|
170
179
|
* @zh 点击某个日期格时触发
|
|
@@ -62,7 +62,6 @@ export declare const Heatmap: {
|
|
|
62
62
|
};
|
|
63
63
|
mergedSize: import('vue').ComputedRef<"mini" | "small" | "medium" | "large">;
|
|
64
64
|
cells: import('vue').ComputedRef<import('./interface').HeatmapCell[]>;
|
|
65
|
-
rows: import('vue').ComputedRef<import('./interface').HeatmapCell[][]>;
|
|
66
65
|
range: import('vue').ComputedRef<import('./interface').HeatmapResolvedRange | null>;
|
|
67
66
|
gridStyle: import('vue').ComputedRef<{
|
|
68
67
|
'--x-heatmap-cell-size': string;
|
|
@@ -90,6 +89,12 @@ export declare const Heatmap: {
|
|
|
90
89
|
cancel(): void;
|
|
91
90
|
};
|
|
92
91
|
clearActive: () => void;
|
|
92
|
+
handleKeydown: (ev: KeyboardEvent) => void;
|
|
93
|
+
handleGridFocus: () => void;
|
|
94
|
+
activeDescendant: import('vue').ComputedRef<string | undefined>;
|
|
95
|
+
gridLabel: import('vue').ComputedRef<string>;
|
|
96
|
+
cellIdPrefix: string;
|
|
97
|
+
liveText: import('vue').ComputedRef<string>;
|
|
93
98
|
isInRange: (cell: import('./interface').HeatmapCell) => boolean;
|
|
94
99
|
colorPalette: import('vue').ComputedRef<string[]>;
|
|
95
100
|
slots: Readonly<{
|
|
@@ -102,6 +107,10 @@ export declare const Heatmap: {
|
|
|
102
107
|
'indicator-leading-text'?: (() => unknown) | undefined;
|
|
103
108
|
'indicator-trailing-text'?: (() => unknown) | undefined;
|
|
104
109
|
}>;
|
|
110
|
+
refs: {
|
|
111
|
+
tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
112
|
+
};
|
|
113
|
+
setTooltipElement: (el: HTMLDivElement | null) => void;
|
|
105
114
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
106
115
|
cellClick: (cell: import('./interface').HeatmapCell, ev: MouseEvent) => true;
|
|
107
116
|
}, import('vue').PublicProps, {
|
|
@@ -191,7 +200,6 @@ export declare const Heatmap: {
|
|
|
191
200
|
};
|
|
192
201
|
mergedSize: import('vue').ComputedRef<"mini" | "small" | "medium" | "large">;
|
|
193
202
|
cells: import('vue').ComputedRef<import('./interface').HeatmapCell[]>;
|
|
194
|
-
rows: import('vue').ComputedRef<import('./interface').HeatmapCell[][]>;
|
|
195
203
|
range: import('vue').ComputedRef<import('./interface').HeatmapResolvedRange | null>;
|
|
196
204
|
gridStyle: import('vue').ComputedRef<{
|
|
197
205
|
'--x-heatmap-cell-size': string;
|
|
@@ -219,6 +227,12 @@ export declare const Heatmap: {
|
|
|
219
227
|
cancel(): void;
|
|
220
228
|
};
|
|
221
229
|
clearActive: () => void;
|
|
230
|
+
handleKeydown: (ev: KeyboardEvent) => void;
|
|
231
|
+
handleGridFocus: () => void;
|
|
232
|
+
activeDescendant: import('vue').ComputedRef<string | undefined>;
|
|
233
|
+
gridLabel: import('vue').ComputedRef<string>;
|
|
234
|
+
cellIdPrefix: string;
|
|
235
|
+
liveText: import('vue').ComputedRef<string>;
|
|
222
236
|
isInRange: (cell: import('./interface').HeatmapCell) => boolean;
|
|
223
237
|
colorPalette: import('vue').ComputedRef<string[]>;
|
|
224
238
|
slots: Readonly<{
|
|
@@ -231,6 +245,10 @@ export declare const Heatmap: {
|
|
|
231
245
|
'indicator-leading-text'?: (() => unknown) | undefined;
|
|
232
246
|
'indicator-trailing-text'?: (() => unknown) | undefined;
|
|
233
247
|
}>;
|
|
248
|
+
refs: {
|
|
249
|
+
tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
250
|
+
};
|
|
251
|
+
setTooltipElement: (el: HTMLDivElement | null) => void;
|
|
234
252
|
}, {}, {}, {}, {
|
|
235
253
|
loading: import('./interface').HeatmapLoadingProps;
|
|
236
254
|
data: import('./interface').HeatmapData;
|
|
@@ -306,7 +324,6 @@ export declare const Heatmap: {
|
|
|
306
324
|
};
|
|
307
325
|
mergedSize: import('vue').ComputedRef<"mini" | "small" | "medium" | "large">;
|
|
308
326
|
cells: import('vue').ComputedRef<import('./interface').HeatmapCell[]>;
|
|
309
|
-
rows: import('vue').ComputedRef<import('./interface').HeatmapCell[][]>;
|
|
310
327
|
range: import('vue').ComputedRef<import('./interface').HeatmapResolvedRange | null>;
|
|
311
328
|
gridStyle: import('vue').ComputedRef<{
|
|
312
329
|
'--x-heatmap-cell-size': string;
|
|
@@ -334,6 +351,12 @@ export declare const Heatmap: {
|
|
|
334
351
|
cancel(): void;
|
|
335
352
|
};
|
|
336
353
|
clearActive: () => void;
|
|
354
|
+
handleKeydown: (ev: KeyboardEvent) => void;
|
|
355
|
+
handleGridFocus: () => void;
|
|
356
|
+
activeDescendant: import('vue').ComputedRef<string | undefined>;
|
|
357
|
+
gridLabel: import('vue').ComputedRef<string>;
|
|
358
|
+
cellIdPrefix: string;
|
|
359
|
+
liveText: import('vue').ComputedRef<string>;
|
|
337
360
|
isInRange: (cell: import('./interface').HeatmapCell) => boolean;
|
|
338
361
|
colorPalette: import('vue').ComputedRef<string[]>;
|
|
339
362
|
slots: Readonly<{
|
|
@@ -346,6 +369,10 @@ export declare const Heatmap: {
|
|
|
346
369
|
'indicator-leading-text'?: (() => unknown) | undefined;
|
|
347
370
|
'indicator-trailing-text'?: (() => unknown) | undefined;
|
|
348
371
|
}>;
|
|
372
|
+
refs: {
|
|
373
|
+
tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
374
|
+
};
|
|
375
|
+
setTooltipElement: (el: HTMLDivElement | null) => void;
|
|
349
376
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
350
377
|
cellClick: (cell: import('./interface').HeatmapCell, ev: MouseEvent) => true;
|
|
351
378
|
}, string, {
|
|
@@ -17,17 +17,20 @@ export * from './form-slider';
|
|
|
17
17
|
export * from './form-switch';
|
|
18
18
|
export * from './form-textarea';
|
|
19
19
|
export * from './color-picker';
|
|
20
|
+
export * from './bar-chart';
|
|
20
21
|
export * from './draggable';
|
|
21
22
|
export * from './grid';
|
|
22
23
|
export * from './heatmap';
|
|
23
24
|
export * from './image';
|
|
24
25
|
export * from './layout';
|
|
26
|
+
export * from './line-chart';
|
|
25
27
|
export * from './link';
|
|
26
28
|
export * from './menu';
|
|
27
29
|
export * from './message';
|
|
28
30
|
export * from './network';
|
|
29
31
|
export * from './notification';
|
|
30
32
|
export * from './pagination';
|
|
33
|
+
export * from './pie-chart';
|
|
31
34
|
export * from './popconfirm';
|
|
32
35
|
export * from './popover';
|
|
33
36
|
export * from './popup';
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { SlotsType } from 'vue';
|
|
2
|
+
import { LineChartActiveData, LineChartClickData, LineChartSeries, LineChartTooltipSlotProps } from './interface';
|
|
3
|
+
import { LineChartPlot } from './helpers/layout';
|
|
4
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
5
|
+
categories: {
|
|
6
|
+
type: import('vue').PropType<Array<string | number>>;
|
|
7
|
+
default: () => never[];
|
|
8
|
+
};
|
|
9
|
+
series: {
|
|
10
|
+
required: boolean;
|
|
11
|
+
type: import('vue').PropType<LineChartSeries[]>;
|
|
12
|
+
default: () => never[];
|
|
13
|
+
};
|
|
14
|
+
stack: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
area: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
smooth: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
connectNulls: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
showPoints: {
|
|
31
|
+
type: import('vue').PropType<boolean | "auto">;
|
|
32
|
+
default: string;
|
|
33
|
+
validator: (value: boolean | "auto") => boolean;
|
|
34
|
+
};
|
|
35
|
+
height: {
|
|
36
|
+
type: import('vue').PropType<number | string>;
|
|
37
|
+
default: number;
|
|
38
|
+
};
|
|
39
|
+
width: {
|
|
40
|
+
type: import('vue').PropType<number | string>;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
max: {
|
|
44
|
+
type: NumberConstructor;
|
|
45
|
+
};
|
|
46
|
+
min: {
|
|
47
|
+
type: NumberConstructor;
|
|
48
|
+
};
|
|
49
|
+
padding: {
|
|
50
|
+
default: string;
|
|
51
|
+
type: import('vue').PropType<string | number>;
|
|
52
|
+
validator(val: string | number): boolean;
|
|
53
|
+
};
|
|
54
|
+
grid: {
|
|
55
|
+
default: null;
|
|
56
|
+
type: import('vue').PropType<import('./interface').LineChartGridOptions>;
|
|
57
|
+
};
|
|
58
|
+
labels: {
|
|
59
|
+
default: null;
|
|
60
|
+
type: import('vue').PropType<import('./interface').LineChartLabelsOptions>;
|
|
61
|
+
};
|
|
62
|
+
tooltip: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: boolean;
|
|
65
|
+
};
|
|
66
|
+
legend: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
valueFormatter: {
|
|
71
|
+
type: import('vue').PropType<(value: number) => string>;
|
|
72
|
+
default: (value: number) => string;
|
|
73
|
+
};
|
|
74
|
+
loading: {
|
|
75
|
+
type: import('vue').PropType<boolean | Record<string, unknown>>;
|
|
76
|
+
default: boolean;
|
|
77
|
+
};
|
|
78
|
+
ariaLabel: {
|
|
79
|
+
type: StringConstructor;
|
|
80
|
+
};
|
|
81
|
+
}>, {
|
|
82
|
+
className: {
|
|
83
|
+
block: string;
|
|
84
|
+
element: (className: string) => string;
|
|
85
|
+
modifier: (className: string) => string;
|
|
86
|
+
is: (className: string) => string;
|
|
87
|
+
};
|
|
88
|
+
state: {
|
|
89
|
+
activeIndex: number | null;
|
|
90
|
+
keyboardActive: boolean;
|
|
91
|
+
hiddenIndexes: number[];
|
|
92
|
+
tooltipWidth: number;
|
|
93
|
+
};
|
|
94
|
+
size: {
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
};
|
|
98
|
+
refs: {
|
|
99
|
+
root: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
100
|
+
canvas: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
101
|
+
tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
102
|
+
};
|
|
103
|
+
slots: Readonly<{
|
|
104
|
+
tooltip?: ((props: LineChartTooltipSlotProps) => unknown) | undefined;
|
|
105
|
+
legend?: ((props: {
|
|
106
|
+
series: LineChartSeries[];
|
|
107
|
+
hiddenIndexes: number[];
|
|
108
|
+
}) => unknown) | undefined;
|
|
109
|
+
point?: ((props: {
|
|
110
|
+
seriesIndex: number;
|
|
111
|
+
index: number;
|
|
112
|
+
value: number;
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
color: string;
|
|
116
|
+
}) => unknown) | undefined;
|
|
117
|
+
empty?: (() => unknown) | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
t: (key: import('../..').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
|
|
120
|
+
fontSize: import('vue').ComputedRef<number>;
|
|
121
|
+
labelColor: import('vue').ComputedRef<"var(--x-chart-color-axis-text)" | import('../bar-chart/props').CSSColor>;
|
|
122
|
+
yVisible: import('vue').ComputedRef<boolean>;
|
|
123
|
+
xVisible: import('vue').ComputedRef<boolean>;
|
|
124
|
+
showHorizontalLines: import('vue').ComputedRef<boolean>;
|
|
125
|
+
seriesList: import('vue').ComputedRef<LineChartSeries[]>;
|
|
126
|
+
visibleSeriesIndexes: import('vue').ComputedRef<number[]>;
|
|
127
|
+
categoryCount: import('vue').ComputedRef<number>;
|
|
128
|
+
hasData: import('vue').ComputedRef<boolean>;
|
|
129
|
+
plot: import('vue').ComputedRef<LineChartPlot>;
|
|
130
|
+
domain: import('vue').ComputedRef<import('../../_utils/chart').NiceDomain>;
|
|
131
|
+
seriesPaths: import('vue').ComputedRef<import('./helpers/layout').LineChartSeriesPath[]>;
|
|
132
|
+
pointsAlwaysVisible: import('vue').ComputedRef<boolean>;
|
|
133
|
+
axisTicks: import('vue').ComputedRef<{
|
|
134
|
+
y: number;
|
|
135
|
+
label: string;
|
|
136
|
+
isBaseline: boolean;
|
|
137
|
+
}[]>;
|
|
138
|
+
axisXLabels: import('vue').ComputedRef<{
|
|
139
|
+
x: number;
|
|
140
|
+
text: string;
|
|
141
|
+
}[]>;
|
|
142
|
+
activeCategory: import('vue').ComputedRef<LineChartActiveData | null>;
|
|
143
|
+
tooltipSlotProps: import('vue').ComputedRef<LineChartTooltipSlotProps | null>;
|
|
144
|
+
tooltipEntries: import('vue').ComputedRef<{
|
|
145
|
+
key: number;
|
|
146
|
+
name: string;
|
|
147
|
+
value: string;
|
|
148
|
+
color: string;
|
|
149
|
+
}[]>;
|
|
150
|
+
tooltipTotal: import('vue').ComputedRef<{
|
|
151
|
+
label: string;
|
|
152
|
+
value: string;
|
|
153
|
+
} | null>;
|
|
154
|
+
tooltipStyle: import('vue').ComputedRef<Record<string, string>>;
|
|
155
|
+
legendItems: import('vue').ComputedRef<{
|
|
156
|
+
key: number;
|
|
157
|
+
name: string;
|
|
158
|
+
color: string;
|
|
159
|
+
hidden: boolean;
|
|
160
|
+
}[]>;
|
|
161
|
+
categoryLabel: (index: number) => string;
|
|
162
|
+
formatValue: import('vue').ComputedRef<(value: number) => string>;
|
|
163
|
+
seriesColor: (index: number) => string;
|
|
164
|
+
liveText: import('vue').ComputedRef<string>;
|
|
165
|
+
handleMouseMove: (ev: MouseEvent) => void;
|
|
166
|
+
handleClick: (ev: MouseEvent) => void;
|
|
167
|
+
handleKeydown: (ev: KeyboardEvent) => void;
|
|
168
|
+
clearActive: () => void;
|
|
169
|
+
toggleSeries: (index: number) => void;
|
|
170
|
+
setTooltipElement: (el: HTMLDivElement | null) => void;
|
|
171
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
172
|
+
/**
|
|
173
|
+
* @zh 点击数据点或绘图区时触发
|
|
174
|
+
* @en Emitted when a data point or the plot area is clicked
|
|
175
|
+
*/
|
|
176
|
+
'line-click': (data: LineChartClickData) => boolean;
|
|
177
|
+
/**
|
|
178
|
+
* @zh 图例切换后触发,参数为当前可见的系列下标
|
|
179
|
+
* @en Emitted after a legend toggle, with the visible series indexes
|
|
180
|
+
*/
|
|
181
|
+
'legend-change': (visibleIndexes: number[]) => boolean;
|
|
182
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
183
|
+
categories: {
|
|
184
|
+
type: import('vue').PropType<Array<string | number>>;
|
|
185
|
+
default: () => never[];
|
|
186
|
+
};
|
|
187
|
+
series: {
|
|
188
|
+
required: boolean;
|
|
189
|
+
type: import('vue').PropType<LineChartSeries[]>;
|
|
190
|
+
default: () => never[];
|
|
191
|
+
};
|
|
192
|
+
stack: {
|
|
193
|
+
type: BooleanConstructor;
|
|
194
|
+
default: boolean;
|
|
195
|
+
};
|
|
196
|
+
area: {
|
|
197
|
+
type: BooleanConstructor;
|
|
198
|
+
default: boolean;
|
|
199
|
+
};
|
|
200
|
+
smooth: {
|
|
201
|
+
type: BooleanConstructor;
|
|
202
|
+
default: boolean;
|
|
203
|
+
};
|
|
204
|
+
connectNulls: {
|
|
205
|
+
type: BooleanConstructor;
|
|
206
|
+
default: boolean;
|
|
207
|
+
};
|
|
208
|
+
showPoints: {
|
|
209
|
+
type: import('vue').PropType<boolean | "auto">;
|
|
210
|
+
default: string;
|
|
211
|
+
validator: (value: boolean | "auto") => boolean;
|
|
212
|
+
};
|
|
213
|
+
height: {
|
|
214
|
+
type: import('vue').PropType<number | string>;
|
|
215
|
+
default: number;
|
|
216
|
+
};
|
|
217
|
+
width: {
|
|
218
|
+
type: import('vue').PropType<number | string>;
|
|
219
|
+
default: string;
|
|
220
|
+
};
|
|
221
|
+
max: {
|
|
222
|
+
type: NumberConstructor;
|
|
223
|
+
};
|
|
224
|
+
min: {
|
|
225
|
+
type: NumberConstructor;
|
|
226
|
+
};
|
|
227
|
+
padding: {
|
|
228
|
+
default: string;
|
|
229
|
+
type: import('vue').PropType<string | number>;
|
|
230
|
+
validator(val: string | number): boolean;
|
|
231
|
+
};
|
|
232
|
+
grid: {
|
|
233
|
+
default: null;
|
|
234
|
+
type: import('vue').PropType<import('./interface').LineChartGridOptions>;
|
|
235
|
+
};
|
|
236
|
+
labels: {
|
|
237
|
+
default: null;
|
|
238
|
+
type: import('vue').PropType<import('./interface').LineChartLabelsOptions>;
|
|
239
|
+
};
|
|
240
|
+
tooltip: {
|
|
241
|
+
type: BooleanConstructor;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
244
|
+
legend: {
|
|
245
|
+
type: BooleanConstructor;
|
|
246
|
+
default: boolean;
|
|
247
|
+
};
|
|
248
|
+
valueFormatter: {
|
|
249
|
+
type: import('vue').PropType<(value: number) => string>;
|
|
250
|
+
default: (value: number) => string;
|
|
251
|
+
};
|
|
252
|
+
loading: {
|
|
253
|
+
type: import('vue').PropType<boolean | Record<string, unknown>>;
|
|
254
|
+
default: boolean;
|
|
255
|
+
};
|
|
256
|
+
ariaLabel: {
|
|
257
|
+
type: StringConstructor;
|
|
258
|
+
};
|
|
259
|
+
}>> & Readonly<{
|
|
260
|
+
"onLegend-change"?: ((visibleIndexes: number[]) => any) | undefined;
|
|
261
|
+
"onLine-click"?: ((data: LineChartClickData) => any) | undefined;
|
|
262
|
+
}>, {
|
|
263
|
+
loading: boolean | Record<string, unknown>;
|
|
264
|
+
area: boolean;
|
|
265
|
+
legend: boolean;
|
|
266
|
+
height: string | number;
|
|
267
|
+
width: string | number;
|
|
268
|
+
grid: import('./interface').LineChartGridOptions;
|
|
269
|
+
padding: string | number;
|
|
270
|
+
smooth: boolean;
|
|
271
|
+
tooltip: boolean;
|
|
272
|
+
categories: (string | number)[];
|
|
273
|
+
series: LineChartSeries[];
|
|
274
|
+
stack: boolean;
|
|
275
|
+
labels: import('./interface').LineChartLabelsOptions;
|
|
276
|
+
valueFormatter: (value: number) => string;
|
|
277
|
+
connectNulls: boolean;
|
|
278
|
+
showPoints: boolean | "auto";
|
|
279
|
+
}, SlotsType<{
|
|
280
|
+
tooltip?: (props: LineChartTooltipSlotProps) => unknown;
|
|
281
|
+
legend?: (props: {
|
|
282
|
+
series: LineChartSeries[];
|
|
283
|
+
hiddenIndexes: number[];
|
|
284
|
+
}) => unknown;
|
|
285
|
+
point?: (props: {
|
|
286
|
+
seriesIndex: number;
|
|
287
|
+
index: number;
|
|
288
|
+
value: number;
|
|
289
|
+
x: number;
|
|
290
|
+
y: number;
|
|
291
|
+
color: string;
|
|
292
|
+
}) => unknown;
|
|
293
|
+
empty?: () => unknown;
|
|
294
|
+
}>, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
295
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface LineChartPlot {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface LineChartPointGeometry {
|
|
10
|
+
/** 类目下标 */
|
|
11
|
+
index: number;
|
|
12
|
+
/** 系列下标 */
|
|
13
|
+
seriesIndex: number;
|
|
14
|
+
/** 数据点的值 */
|
|
15
|
+
value: number;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
export interface LineChartSeriesPath {
|
|
20
|
+
/** 系列下标 */
|
|
21
|
+
seriesIndex: number;
|
|
22
|
+
/** 折线路径(平滑时为三次贝塞尔);缺测断点会切成多段 */
|
|
23
|
+
d: string;
|
|
24
|
+
/** 面积填充路径;未开启 area 时为空串 */
|
|
25
|
+
areaD: string;
|
|
26
|
+
/** 该系列的数据点,供数据点渲染与交互命中 */
|
|
27
|
+
points: LineChartPointGeometry[];
|
|
28
|
+
}
|
|
29
|
+
export interface BuildLineChartSeriesParams {
|
|
30
|
+
/** values[seriesIndex][categoryIndex];缺测为 null */
|
|
31
|
+
values: Array<Array<number | null>>;
|
|
32
|
+
/**
|
|
33
|
+
* 面积填充的下边界(堆叠面积用):
|
|
34
|
+
* 逐系列给出,形状与 values 相同;省略时填充到 baseline 水平线。
|
|
35
|
+
*/
|
|
36
|
+
lower?: Array<Array<number | null>>;
|
|
37
|
+
plot: LineChartPlot;
|
|
38
|
+
/** 数值域下界(负值场景下为负数) */
|
|
39
|
+
domainMin: number;
|
|
40
|
+
/** 数值域上界 */
|
|
41
|
+
domainMax: number;
|
|
42
|
+
/** 是否平滑 */
|
|
43
|
+
smooth: boolean;
|
|
44
|
+
/** 缺测点是否跨过(连到下一个有效点) */
|
|
45
|
+
connectNulls: boolean;
|
|
46
|
+
/** 是否绘制面积填充 */
|
|
47
|
+
area: boolean;
|
|
48
|
+
/** 面积基线的 y(未给 lower 时使用) */
|
|
49
|
+
baseline: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 计算每个系列的折线 / 面积路径与数据点坐标。
|
|
53
|
+
*
|
|
54
|
+
* 类目排在带中心:n 个类目把绘图区均分为 n 段,第 i 个数据点落在第 i 段中心,
|
|
55
|
+
* 与柱状图的类目带一致,两个图表的类目轴可以对齐比较。
|
|
56
|
+
*
|
|
57
|
+
* 缺测(null / undefined)默认断线;`connectNulls` 为真时跨过缺测连到下一点,
|
|
58
|
+
* 但缺测处不产生数据点(不存在的点不应被鼠标命中)。
|
|
59
|
+
*/
|
|
60
|
+
export declare const buildLineChartSeries: (params: BuildLineChartSeriesParams) => LineChartSeriesPath[];
|
|
61
|
+
export interface StackedLineChartLayer {
|
|
62
|
+
seriesIndex: number;
|
|
63
|
+
/** 本层的值(缺测为 0) */
|
|
64
|
+
values: number[];
|
|
65
|
+
/** 本层下界(下方所有层的累加) */
|
|
66
|
+
base: number[];
|
|
67
|
+
/** 本层上界(base + values) */
|
|
68
|
+
top: number[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 堆叠分层:把每个系列的下界累加为上一层的上界。
|
|
72
|
+
* 缺测按 0 处理,保证各层类目数一致、堆叠带不出现空洞。
|
|
73
|
+
*/
|
|
74
|
+
export declare const buildStackedLayers: (values: Array<Array<number | null>>) => StackedLineChartLayer[];
|