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,278 @@
|
|
|
1
|
+
import { SlotsType } from 'vue';
|
|
2
|
+
import { BarChartActiveData, BarChartClickData, BarChartSeries, BarChartTooltipSlotProps } from './interface';
|
|
3
|
+
import { BarChartLayout, BarChartPlot } 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<BarChartSeries[]>;
|
|
12
|
+
default: () => never[];
|
|
13
|
+
};
|
|
14
|
+
stack: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
height: {
|
|
19
|
+
type: import('vue').PropType<number | string>;
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
22
|
+
width: {
|
|
23
|
+
type: import('vue').PropType<number | string>;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
max: {
|
|
27
|
+
type: NumberConstructor;
|
|
28
|
+
};
|
|
29
|
+
barWidth: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
};
|
|
32
|
+
barRadius: {
|
|
33
|
+
type: NumberConstructor;
|
|
34
|
+
default: number;
|
|
35
|
+
};
|
|
36
|
+
padding: {
|
|
37
|
+
default: string;
|
|
38
|
+
type: import('vue').PropType<string | number>;
|
|
39
|
+
validator(val: string | number): boolean;
|
|
40
|
+
};
|
|
41
|
+
grid: {
|
|
42
|
+
default: null;
|
|
43
|
+
type: import('vue').PropType<import('./interface').BarChartGridOptions>;
|
|
44
|
+
};
|
|
45
|
+
labels: {
|
|
46
|
+
default: null;
|
|
47
|
+
type: import('vue').PropType<import('./interface').BarChartLabelsOptions>;
|
|
48
|
+
};
|
|
49
|
+
tooltip: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: boolean;
|
|
52
|
+
};
|
|
53
|
+
legend: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
valueFormatter: {
|
|
58
|
+
type: import('vue').PropType<(value: number) => string>;
|
|
59
|
+
default: (value: number) => string;
|
|
60
|
+
};
|
|
61
|
+
loading: {
|
|
62
|
+
type: import('vue').PropType<boolean | Record<string, unknown>>;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
65
|
+
ariaLabel: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
};
|
|
68
|
+
}>, {
|
|
69
|
+
className: {
|
|
70
|
+
block: string;
|
|
71
|
+
element: (className: string) => string;
|
|
72
|
+
modifier: (className: string) => string;
|
|
73
|
+
is: (className: string) => string;
|
|
74
|
+
};
|
|
75
|
+
state: {
|
|
76
|
+
activeIndex: number | null;
|
|
77
|
+
keyboardActive: boolean;
|
|
78
|
+
hiddenIndexes: number[];
|
|
79
|
+
tooltipWidth: number;
|
|
80
|
+
};
|
|
81
|
+
size: {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
};
|
|
85
|
+
refs: {
|
|
86
|
+
root: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
87
|
+
canvas: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
88
|
+
tooltip: import('vue').Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
89
|
+
};
|
|
90
|
+
slots: Readonly<{
|
|
91
|
+
tooltip?: ((props: BarChartTooltipSlotProps) => unknown) | undefined;
|
|
92
|
+
legend?: ((props: {
|
|
93
|
+
series: BarChartSeries[];
|
|
94
|
+
hiddenIndexes: number[];
|
|
95
|
+
}) => unknown) | undefined;
|
|
96
|
+
bar?: ((props: {
|
|
97
|
+
seriesIndex: number;
|
|
98
|
+
index: number;
|
|
99
|
+
value: number;
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
color: string;
|
|
105
|
+
}) => unknown) | undefined;
|
|
106
|
+
empty?: (() => unknown) | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
t: (key: import('../..').LocaleKey | (string & {}), params?: Record<string, string | number>) => string;
|
|
109
|
+
fontSize: import('vue').ComputedRef<number>;
|
|
110
|
+
labelColor: import('vue').ComputedRef<"var(--x-chart-color-axis-text)" | import('./props').CSSColor>;
|
|
111
|
+
yVisible: import('vue').ComputedRef<boolean>;
|
|
112
|
+
xVisible: import('vue').ComputedRef<boolean>;
|
|
113
|
+
showHorizontalLines: import('vue').ComputedRef<boolean>;
|
|
114
|
+
seriesList: import('vue').ComputedRef<BarChartSeries[]>;
|
|
115
|
+
visibleSeriesIndexes: import('vue').ComputedRef<number[]>;
|
|
116
|
+
categoryCount: import('vue').ComputedRef<number>;
|
|
117
|
+
hasData: import('vue').ComputedRef<boolean>;
|
|
118
|
+
plot: import('vue').ComputedRef<BarChartPlot>;
|
|
119
|
+
layout: import('vue').ComputedRef<BarChartLayout>;
|
|
120
|
+
axisTicks: import('vue').ComputedRef<{
|
|
121
|
+
y: number;
|
|
122
|
+
label: string;
|
|
123
|
+
isBaseline: boolean;
|
|
124
|
+
}[]>;
|
|
125
|
+
axisXLabels: import('vue').ComputedRef<{
|
|
126
|
+
x: number;
|
|
127
|
+
text: string;
|
|
128
|
+
}[]>;
|
|
129
|
+
visibleBarEntries: import('vue').ComputedRef<{
|
|
130
|
+
color: string;
|
|
131
|
+
index: number;
|
|
132
|
+
seriesIndex: number;
|
|
133
|
+
value: number;
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
path: string;
|
|
139
|
+
}[]>;
|
|
140
|
+
activeCategory: import('vue').ComputedRef<BarChartActiveData | null>;
|
|
141
|
+
tooltipSlotProps: import('vue').ComputedRef<BarChartTooltipSlotProps | null>;
|
|
142
|
+
tooltipEntries: import('vue').ComputedRef<{
|
|
143
|
+
key: number;
|
|
144
|
+
name: string;
|
|
145
|
+
value: string;
|
|
146
|
+
color: string;
|
|
147
|
+
}[]>;
|
|
148
|
+
tooltipTotal: import('vue').ComputedRef<{
|
|
149
|
+
label: string;
|
|
150
|
+
value: string;
|
|
151
|
+
} | null>;
|
|
152
|
+
tooltipStyle: import('vue').ComputedRef<Record<string, string>>;
|
|
153
|
+
legendItems: import('vue').ComputedRef<{
|
|
154
|
+
key: number;
|
|
155
|
+
name: string;
|
|
156
|
+
color: string;
|
|
157
|
+
hidden: boolean;
|
|
158
|
+
}[]>;
|
|
159
|
+
categoryLabel: (index: number) => string;
|
|
160
|
+
formatValue: import('vue').ComputedRef<(value: number) => string>;
|
|
161
|
+
liveText: import('vue').ComputedRef<string>;
|
|
162
|
+
handleMouseMove: (ev: MouseEvent) => void;
|
|
163
|
+
handleClick: (ev: MouseEvent) => void;
|
|
164
|
+
handleKeydown: (ev: KeyboardEvent) => void;
|
|
165
|
+
clearActive: () => void;
|
|
166
|
+
toggleSeries: (index: number) => void;
|
|
167
|
+
setTooltipElement: (el: HTMLDivElement | null) => void;
|
|
168
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
169
|
+
/**
|
|
170
|
+
* @zh 点击柱体或绘图区时触发
|
|
171
|
+
* @en Emitted when a bar or the plot area is clicked
|
|
172
|
+
*/
|
|
173
|
+
'bar-click': (data: BarChartClickData) => boolean;
|
|
174
|
+
/**
|
|
175
|
+
* @zh 图例切换后触发,参数为当前可见的系列下标
|
|
176
|
+
* @en Emitted after a legend toggle, with the visible series indexes
|
|
177
|
+
*/
|
|
178
|
+
'legend-change': (visibleIndexes: number[]) => boolean;
|
|
179
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
180
|
+
categories: {
|
|
181
|
+
type: import('vue').PropType<Array<string | number>>;
|
|
182
|
+
default: () => never[];
|
|
183
|
+
};
|
|
184
|
+
series: {
|
|
185
|
+
required: boolean;
|
|
186
|
+
type: import('vue').PropType<BarChartSeries[]>;
|
|
187
|
+
default: () => never[];
|
|
188
|
+
};
|
|
189
|
+
stack: {
|
|
190
|
+
type: BooleanConstructor;
|
|
191
|
+
default: boolean;
|
|
192
|
+
};
|
|
193
|
+
height: {
|
|
194
|
+
type: import('vue').PropType<number | string>;
|
|
195
|
+
default: number;
|
|
196
|
+
};
|
|
197
|
+
width: {
|
|
198
|
+
type: import('vue').PropType<number | string>;
|
|
199
|
+
default: string;
|
|
200
|
+
};
|
|
201
|
+
max: {
|
|
202
|
+
type: NumberConstructor;
|
|
203
|
+
};
|
|
204
|
+
barWidth: {
|
|
205
|
+
type: NumberConstructor;
|
|
206
|
+
};
|
|
207
|
+
barRadius: {
|
|
208
|
+
type: NumberConstructor;
|
|
209
|
+
default: number;
|
|
210
|
+
};
|
|
211
|
+
padding: {
|
|
212
|
+
default: string;
|
|
213
|
+
type: import('vue').PropType<string | number>;
|
|
214
|
+
validator(val: string | number): boolean;
|
|
215
|
+
};
|
|
216
|
+
grid: {
|
|
217
|
+
default: null;
|
|
218
|
+
type: import('vue').PropType<import('./interface').BarChartGridOptions>;
|
|
219
|
+
};
|
|
220
|
+
labels: {
|
|
221
|
+
default: null;
|
|
222
|
+
type: import('vue').PropType<import('./interface').BarChartLabelsOptions>;
|
|
223
|
+
};
|
|
224
|
+
tooltip: {
|
|
225
|
+
type: BooleanConstructor;
|
|
226
|
+
default: boolean;
|
|
227
|
+
};
|
|
228
|
+
legend: {
|
|
229
|
+
type: BooleanConstructor;
|
|
230
|
+
default: boolean;
|
|
231
|
+
};
|
|
232
|
+
valueFormatter: {
|
|
233
|
+
type: import('vue').PropType<(value: number) => string>;
|
|
234
|
+
default: (value: number) => string;
|
|
235
|
+
};
|
|
236
|
+
loading: {
|
|
237
|
+
type: import('vue').PropType<boolean | Record<string, unknown>>;
|
|
238
|
+
default: boolean;
|
|
239
|
+
};
|
|
240
|
+
ariaLabel: {
|
|
241
|
+
type: StringConstructor;
|
|
242
|
+
};
|
|
243
|
+
}>> & Readonly<{
|
|
244
|
+
"onBar-click"?: ((data: BarChartClickData) => any) | undefined;
|
|
245
|
+
"onLegend-change"?: ((visibleIndexes: number[]) => any) | undefined;
|
|
246
|
+
}>, {
|
|
247
|
+
loading: boolean | Record<string, unknown>;
|
|
248
|
+
legend: boolean;
|
|
249
|
+
height: string | number;
|
|
250
|
+
width: string | number;
|
|
251
|
+
grid: import('./interface').BarChartGridOptions;
|
|
252
|
+
padding: string | number;
|
|
253
|
+
tooltip: boolean;
|
|
254
|
+
categories: (string | number)[];
|
|
255
|
+
series: BarChartSeries[];
|
|
256
|
+
stack: boolean;
|
|
257
|
+
barRadius: number;
|
|
258
|
+
labels: import('./interface').BarChartLabelsOptions;
|
|
259
|
+
valueFormatter: (value: number) => string;
|
|
260
|
+
}, SlotsType<{
|
|
261
|
+
tooltip?: (props: BarChartTooltipSlotProps) => unknown;
|
|
262
|
+
legend?: (props: {
|
|
263
|
+
series: BarChartSeries[];
|
|
264
|
+
hiddenIndexes: number[];
|
|
265
|
+
}) => unknown;
|
|
266
|
+
bar?: (props: {
|
|
267
|
+
seriesIndex: number;
|
|
268
|
+
index: number;
|
|
269
|
+
value: number;
|
|
270
|
+
x: number;
|
|
271
|
+
y: number;
|
|
272
|
+
width: number;
|
|
273
|
+
height: number;
|
|
274
|
+
color: string;
|
|
275
|
+
}) => unknown;
|
|
276
|
+
empty?: () => unknown;
|
|
277
|
+
}>, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
278
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { roundedTopRectPath } from '../../../_utils/chart';
|
|
2
|
+
export { roundedTopRectPath };
|
|
3
|
+
export interface BarChartPlot {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export interface BarChartBarGeometry {
|
|
12
|
+
/** 类目下标 */
|
|
13
|
+
index: number;
|
|
14
|
+
/** 系列下标 */
|
|
15
|
+
seriesIndex: number;
|
|
16
|
+
/** 该柱体代表的值 */
|
|
17
|
+
value: number;
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
/** path 绘制指令(仅顶部圆角) */
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ComputeBarLayoutParams {
|
|
26
|
+
count: number;
|
|
27
|
+
/** values[seriesIndex][categoryIndex],调用方需已把 null / 负数归一化为 0 */
|
|
28
|
+
values: number[][];
|
|
29
|
+
stack: boolean;
|
|
30
|
+
plot: BarChartPlot;
|
|
31
|
+
domainMax: number;
|
|
32
|
+
barWidth?: number;
|
|
33
|
+
barRadius: number;
|
|
34
|
+
/** 堆叠分段之间的间隙,默认 1px */
|
|
35
|
+
stackGap?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface BarChartLayout {
|
|
38
|
+
band: number;
|
|
39
|
+
barWidth: number;
|
|
40
|
+
bars: BarChartBarGeometry[];
|
|
41
|
+
/** 每个类目中心 x,供标签、激活线与悬浮锚点使用 */
|
|
42
|
+
categoryCenters: number[];
|
|
43
|
+
/** 每个类目最高柱体顶部的 y;无数据时为绘图区底部 */
|
|
44
|
+
categoryTops: number[];
|
|
45
|
+
}
|
|
46
|
+
/** 单个柱体允许的最大宽度,避免稀疏数据下柱体过宽 */
|
|
47
|
+
export declare const MAX_BAR_WIDTH = 32;
|
|
48
|
+
/**
|
|
49
|
+
* 计算全部柱体几何。
|
|
50
|
+
*
|
|
51
|
+
* - 非堆叠:同组柱体在类目带内并排排列;
|
|
52
|
+
* - 堆叠:自下而上累加,分段之间留 1px 缝隙,基线不缩,避免柱体「浮起」;
|
|
53
|
+
* - 负数与缺测由调用方归一化为 0,超过 domainMax 的值在绘图区内截断。
|
|
54
|
+
*/
|
|
55
|
+
export declare const computeBarLayout: (params: ComputeBarLayoutParams) => BarChartLayout;
|