x-next 1.13.0 → 1.15.0
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_CODING.md +6 -5
- package/AI_USAGE/catalog.md +108 -105
- package/AI_USAGE/components/alert-api.md +48 -0
- package/AI_USAGE/components/alert.md +222 -3
- package/AI_USAGE/components/bar-chart-api.md +177 -0
- package/AI_USAGE/components/bar-chart.md +297 -3
- package/AI_USAGE/components/boxicons.md +147 -0
- package/AI_USAGE/components/button-api.md +144 -0
- package/AI_USAGE/components/button.md +447 -3
- package/AI_USAGE/components/charts.md +81 -0
- package/AI_USAGE/components/checkbox-api.md +145 -0
- package/AI_USAGE/components/checkbox.md +365 -3
- package/AI_USAGE/components/color-picker-api.md +52 -0
- package/AI_USAGE/components/color-picker.md +211 -3
- package/AI_USAGE/components/config-provider-api.md +38 -0
- package/AI_USAGE/components/config-provider.md +250 -3
- package/AI_USAGE/components/date-picker-api.md +1114 -0
- package/AI_USAGE/components/date-picker.md +378 -3
- package/AI_USAGE/components/dialog-api.md +142 -0
- package/AI_USAGE/components/dialog.md +284 -3
- package/AI_USAGE/components/draggable-api.md +146 -0
- package/AI_USAGE/components/draggable.md +259 -0
- package/AI_USAGE/components/drawer-api.md +78 -0
- package/AI_USAGE/components/drawer.md +256 -0
- package/AI_USAGE/components/dropdown-api.md +529 -0
- package/AI_USAGE/components/dropdown.md +392 -3
- package/AI_USAGE/components/empty-api.md +36 -0
- package/AI_USAGE/components/empty.md +227 -3
- package/AI_USAGE/components/finicon.md +88 -0
- package/AI_USAGE/components/form-api.md +524 -0
- package/AI_USAGE/components/form.md +454 -0
- package/AI_USAGE/components/grid-api.md +527 -0
- package/AI_USAGE/components/grid.md +224 -0
- package/AI_USAGE/components/heatmap-api.md +122 -0
- package/AI_USAGE/components/heatmap.md +220 -0
- package/AI_USAGE/components/icon-api.md +4707 -0
- package/AI_USAGE/components/icon.md +257 -0
- package/AI_USAGE/components/image-api.md +440 -0
- package/AI_USAGE/components/image.md +465 -0
- package/AI_USAGE/components/input-api.md +184 -0
- package/AI_USAGE/components/input-number-api.md +66 -0
- package/AI_USAGE/components/input-number.md +294 -0
- package/AI_USAGE/components/input-tag-api.md +114 -0
- package/AI_USAGE/components/input-tag.md +482 -0
- package/AI_USAGE/components/input.md +293 -3
- package/AI_USAGE/components/layout-api.md +147 -0
- package/AI_USAGE/components/layout.md +230 -0
- package/AI_USAGE/components/line-chart-api.md +197 -0
- package/AI_USAGE/components/line-chart.md +306 -3
- package/AI_USAGE/components/link-api.md +42 -0
- package/AI_USAGE/components/link.md +197 -0
- package/AI_USAGE/components/menu-api.md +516 -0
- package/AI_USAGE/components/menu.md +268 -0
- package/AI_USAGE/components/message-api.md +215 -0
- package/AI_USAGE/components/message-box-api.md +108 -0
- package/AI_USAGE/components/message-box.md +268 -3
- package/AI_USAGE/components/message.md +231 -3
- package/AI_USAGE/components/network-api.md +91 -0
- package/AI_USAGE/components/network.md +378 -0
- package/AI_USAGE/components/notification-api.md +236 -0
- package/AI_USAGE/components/notification.md +275 -3
- package/AI_USAGE/components/pagination-api.md +62 -0
- package/AI_USAGE/components/pagination.md +380 -3
- package/AI_USAGE/components/pie-chart-api.md +109 -0
- package/AI_USAGE/components/pie-chart.md +245 -3
- package/AI_USAGE/components/popconfirm-api.md +75 -0
- package/AI_USAGE/components/popconfirm.md +231 -3
- package/AI_USAGE/components/popover-api.md +75 -0
- package/AI_USAGE/components/popover.md +208 -3
- package/AI_USAGE/components/popup-api.md +75 -0
- package/AI_USAGE/components/popup.md +52 -0
- package/AI_USAGE/components/progress-api.md +44 -0
- package/AI_USAGE/components/progress.md +248 -3
- package/AI_USAGE/components/radio-api.md +165 -0
- package/AI_USAGE/components/radio.md +259 -3
- package/AI_USAGE/components/rate-api.md +54 -0
- package/AI_USAGE/components/rate.md +233 -3
- package/AI_USAGE/components/resize-box-api.md +56 -0
- package/AI_USAGE/components/resize-box.md +231 -0
- package/AI_USAGE/components/scrollbar-api.md +77 -0
- package/AI_USAGE/components/scrollbar.md +218 -0
- package/AI_USAGE/components/select-api.md +758 -0
- package/AI_USAGE/components/select.md +640 -3
- package/AI_USAGE/components/skeleton-api.md +85 -0
- package/AI_USAGE/components/skeleton.md +150 -0
- package/AI_USAGE/components/slider-api.md +51 -0
- package/AI_USAGE/components/slider.md +233 -3
- package/AI_USAGE/components/space-api.md +38 -0
- package/AI_USAGE/components/space.md +145 -0
- package/AI_USAGE/components/spin-api.md +43 -0
- package/AI_USAGE/components/spin.md +205 -0
- package/AI_USAGE/components/steps-api.md +111 -0
- package/AI_USAGE/components/steps.md +201 -3
- package/AI_USAGE/components/switch-api.md +58 -0
- package/AI_USAGE/components/switch.md +290 -3
- package/AI_USAGE/components/table-api.md +2919 -0
- package/AI_USAGE/components/table.md +1457 -0
- package/AI_USAGE/components/tabs-api.md +135 -0
- package/AI_USAGE/components/tabs.md +308 -3
- package/AI_USAGE/components/tag-api.md +124 -0
- package/AI_USAGE/components/tag.md +292 -0
- package/AI_USAGE/components/textarea-api.md +55 -0
- package/AI_USAGE/components/textarea.md +326 -3
- package/AI_USAGE/components/time-picker-api.md +137 -0
- package/AI_USAGE/components/time-picker.md +271 -3
- package/AI_USAGE/components/time-range-selector-api.md +44 -0
- package/AI_USAGE/components/time-range-selector.md +355 -0
- package/AI_USAGE/components/timeline-api.md +93 -0
- package/AI_USAGE/components/timeline.md +312 -0
- package/AI_USAGE/components/tooltip-api.md +77 -0
- package/AI_USAGE/components/tooltip.md +182 -0
- package/AI_USAGE/components/tree-select-api.md +498 -0
- package/AI_USAGE/components/tree-select.md +744 -0
- package/AI_USAGE/components/trend-chart-api.md +119 -0
- package/AI_USAGE/components/trend-chart.md +335 -0
- package/AI_USAGE/components/trigger-api.md +124 -0
- package/AI_USAGE/components/trigger.md +185 -0
- package/AI_USAGE/components/upload-api.md +200 -0
- package/AI_USAGE/components/upload.md +711 -3
- package/AI_USAGE/components/watermark-api.md +87 -0
- package/AI_USAGE/components/watermark.md +200 -0
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +36 -7
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +34972 -5
- package/CHANGELOG.md +39 -0
- package/dist/_props/css.d.ts +2 -1
- package/dist/_utils/inherit-component-type.d.ts +11 -0
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/index.d.ts +3 -3
- package/dist/components/date-picker/index.d.ts +420 -5
- package/dist/components/form-input/index.d.ts +617 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts +689 -1
- package/dist/components/line-chart/LineChart.d.ts +1 -1
- package/dist/components/line-chart/index.d.ts +3 -3
- package/dist/components/line-chart/interface.d.ts +2 -2
- package/dist/components/menu/index.d.ts +786 -1
- package/dist/components/tree-select/TreeNode.vue.d.ts +478 -0
- package/dist/components/tree-select/TreeSelect.d.ts +1549 -0
- package/dist/components/tree-select/TreeSelectDropdown.vue.d.ts +569 -0
- package/dist/components/tree-select/hooks/use-tree-select.d.ts +92 -0
- package/dist/components/tree-select/index.d.ts +3321 -0
- package/dist/components/tree-select/interface.d.ts +203 -0
- package/dist/components/tree-select/utils.d.ts +64 -0
- package/dist/es/_styles/palette-aliases.js +3 -0
- package/dist/es/_utils/inherit-component-type.js +6 -0
- package/dist/es/components/_components/feedback-icon/index.vue2.js +10 -10
- package/dist/es/components/button/Button.js +9 -9
- package/dist/es/components/date-picker/index.js +18 -17
- package/dist/es/components/drawer/src/Drawer.vue.js +6 -6
- package/dist/es/components/form-input/index.js +12 -11
- package/dist/es/components/form-switch/Switch.vue2.js +18 -18
- package/dist/es/components/image/Image.vue2.js +13 -13
- package/dist/es/components/image/ImagePreview.vue2.js +33 -33
- package/dist/es/components/index.js +55 -52
- package/dist/es/components/layout/index.js +10 -9
- package/dist/es/components/link/Link.vue2.js +12 -12
- package/dist/es/components/menu/hooks/use-level.js +5 -5
- package/dist/es/components/menu/index.js +13 -10
- package/dist/es/components/message/message.vue2.js +13 -13
- package/dist/es/components/spin/Spin.js +28 -28
- package/dist/es/components/tag/Tag.vue2.js +22 -22
- package/dist/es/components/timeline/src/Timeline.js +7 -7
- package/dist/es/components/tree-select/TreeNode.vue.js +91 -0
- package/dist/es/components/tree-select/TreeNode.vue2.js +162 -0
- package/dist/es/components/tree-select/TreeSelect.js +865 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue.js +57 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue2.js +79 -0
- package/dist/es/components/tree-select/hooks/use-tree-select.js +376 -0
- package/dist/es/components/tree-select/index.js +13 -0
- package/dist/es/components/tree-select/utils.js +181 -0
- package/dist/es/icons/animation/animation-loading.js +2 -2
- package/dist/es/index.js +71 -68
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/base.css +1 -1
- package/dist/style/dependencies.json +10 -0
- package/dist/style/drawer.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style/tree-select.css +1 -0
- package/dist/style/tree-select.js +8 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +11 -5
- package/volar.d.ts +2 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# LineChart 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## LineChart API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/line-chart/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| categories | 类目轴标签,与各系列 data 下标对应 | undefined | (string | number)[] | 否 | [] |
|
|
17
|
+
| series | 数据系列,必填 | undefined | LineChartSeries[] | 是 | [] |
|
|
18
|
+
| stack | 是否堆叠;面积时变为堆叠面积 | undefined | false | true | 否 | false |
|
|
19
|
+
| area | 是否绘制面积填充 | undefined | false | true | 否 | false |
|
|
20
|
+
| smooth | 平滑曲线 | undefined | false | true | 否 | true |
|
|
21
|
+
| connectNulls | 缺测是否跨过连接 | undefined | false | true | 否 | false |
|
|
22
|
+
| showPoints | 数据点显示策略 | undefined | false | true | "auto" | 否 | "auto" |
|
|
23
|
+
| height | 图表高度,数字按 px | undefined | string | number | 否 | 280 |
|
|
24
|
+
| width | 图表宽度,数字按 px | undefined | string | number | 否 | "100%" |
|
|
25
|
+
| max | 数值轴上界;传入后锁定刻度 | undefined | number | 否 | 未声明 |
|
|
26
|
+
| min | 数值轴下界;负值数据自动扩展 | undefined | number | 否 | 未声明 |
|
|
27
|
+
| padding | 绘制边距,1-4 个非负数字字符串或单个数字 | undefined | string | number | 否 | "8" |
|
|
28
|
+
| grid | 网格线配置 | undefined | LineChartGridOptions | 否 | null |
|
|
29
|
+
| labels | 轴标签配置 | undefined | LineChartLabelsOptions | 否 | null |
|
|
30
|
+
| tooltip | 悬浮提示 | undefined | false | true | 否 | true |
|
|
31
|
+
| legend | 图例,点击可隐藏/显示系列 | undefined | false | true | 否 | false |
|
|
32
|
+
| valueFormatter | 数值格式化,用于提示、图例与数值轴 | undefined | (value: number) => string | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
|
|
33
|
+
| loading | 加载中 | undefined | false | true | { [x: string]: unknown; } | 否 | false |
|
|
34
|
+
| ariaLabel | 无障碍名称;设置后画布带 role="img" | undefined | string | 否 | 未声明 |
|
|
35
|
+
|
|
36
|
+
### Events
|
|
37
|
+
|
|
38
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| line-click | 见场景用法与类型 | undefined | (data: LineChartClickData) => any |
|
|
41
|
+
| legend-change | 见场景用法与类型 | undefined | (visibleIndexes: number[]) => any |
|
|
42
|
+
|
|
43
|
+
### Slots
|
|
44
|
+
|
|
45
|
+
| 名称 | 用途 | 公开类型 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| tooltip | 自定义悬浮提示内容 | undefined | (props: LineChartTooltipSlotProps) => unknown |
|
|
48
|
+
| legend | 自定义图例 | undefined | (props: { series: LineChartSeries[]; hiddenIndexes: number[]; }) => unknown |
|
|
49
|
+
| point | 自定义数据点渲染 | undefined | (props: { seriesIndex: number; index: number; value: number; x: number; y: number; color: string; }) => unknown |
|
|
50
|
+
| empty | 自定义空态内容 | undefined | () => unknown |
|
|
51
|
+
|
|
52
|
+
### 实例方法
|
|
53
|
+
|
|
54
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
55
|
+
|
|
56
|
+
### 关联类型定义
|
|
57
|
+
|
|
58
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
59
|
+
|
|
60
|
+
```typescript-reference
|
|
61
|
+
interface LineChartSeries {
|
|
62
|
+
/** 系列名,用于悬浮提示与图例 */
|
|
63
|
+
name?: string;
|
|
64
|
+
/** 该系列按 categories 顺序排列的值 */
|
|
65
|
+
data: Array<number | null | undefined>;
|
|
66
|
+
/** 该系列的颜色,支持 CSS 变量及 fallback;默认取内置分类色板(按系列下标循环) */
|
|
67
|
+
color?: CSSColor;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface LineChartGridOptions {
|
|
71
|
+
/** 是否显示横向网格线,默认 true */
|
|
72
|
+
horizontalLines?: boolean;
|
|
73
|
+
/** 横向网格线数量(含基线),默认 4 */
|
|
74
|
+
horizontalLinesNumber?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface LineChartLabelsOptions {
|
|
78
|
+
/** 是否显示类目标签,默认 true */
|
|
79
|
+
xVisible?: boolean;
|
|
80
|
+
/** 是否显示数值轴标签,默认 true */
|
|
81
|
+
yVisible?: boolean;
|
|
82
|
+
/** 类目标签格式化 */
|
|
83
|
+
xFormatter?: (label: string, index: number) => string;
|
|
84
|
+
/** 数值轴刻度格式化 */
|
|
85
|
+
yFormatter?: (value: number) => string;
|
|
86
|
+
/** 轴标签字号,默认 12 */
|
|
87
|
+
fontSize?: number;
|
|
88
|
+
/** 轴标签颜色,支持 CSS 变量及 fallback;默认取组件文字 token */
|
|
89
|
+
color?: CSSColor;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface LineChartTooltipItem {
|
|
93
|
+
/** 系列下标 */
|
|
94
|
+
seriesIndex: number;
|
|
95
|
+
/** 系列名,未提供时为 undefined */
|
|
96
|
+
name?: string;
|
|
97
|
+
/**
|
|
98
|
+
* 该系列在当前类目的值;缺测时为 null
|
|
99
|
+
*/
|
|
100
|
+
value: number | null;
|
|
101
|
+
/**
|
|
102
|
+
* 该系列生效的颜色:业务传入值原样返回,未传入时是内置色板的
|
|
103
|
+
* `var(--x-chart-color-series-N)` 引用,可直接用于 style 背景色。
|
|
104
|
+
*/
|
|
105
|
+
color: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface LineChartActiveData {
|
|
109
|
+
/** 类目下标 */
|
|
110
|
+
index: number;
|
|
111
|
+
/** 类目标签(已应用 labels.xFormatter) */
|
|
112
|
+
label: string;
|
|
113
|
+
/** 各类目的系列值 */
|
|
114
|
+
items: LineChartTooltipItem[];
|
|
115
|
+
/** 所有系列的合计值;stack 时为堆叠总值 */
|
|
116
|
+
total: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface LineChartClickData extends LineChartActiveData {
|
|
120
|
+
/** 命中的系列下标;点击落在空白或该点缺测时为 null */
|
|
121
|
+
seriesIndex: number | null;
|
|
122
|
+
/** 命中的数据点值;未命中时为 null */
|
|
123
|
+
value: number | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface LineChartTooltipSlotProps extends LineChartActiveData {
|
|
127
|
+
/** 组件当前的数值格式化函数,供自定义内容保持一致 */
|
|
128
|
+
formatValue: (value: number) => string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface LineChartPlot {
|
|
132
|
+
left: number;
|
|
133
|
+
top: number;
|
|
134
|
+
right: number;
|
|
135
|
+
bottom: number;
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface LineChartPointGeometry {
|
|
141
|
+
/** 类目下标 */
|
|
142
|
+
index: number;
|
|
143
|
+
/** 系列下标 */
|
|
144
|
+
seriesIndex: number;
|
|
145
|
+
/** 数据点的值 */
|
|
146
|
+
value: number;
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface LineChartSeriesPath {
|
|
152
|
+
/** 系列下标 */
|
|
153
|
+
seriesIndex: number;
|
|
154
|
+
/** 折线路径(平滑时为三次贝塞尔);缺测断点会切成多段 */
|
|
155
|
+
d: string;
|
|
156
|
+
/** 面积填充路径;未开启 area 时为空串 */
|
|
157
|
+
areaD: string;
|
|
158
|
+
/** 该系列的数据点,供数据点渲染与交互命中 */
|
|
159
|
+
points: LineChartPointGeometry[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
interface BuildLineChartSeriesParams {
|
|
163
|
+
/** values[seriesIndex][categoryIndex];缺测为 null */
|
|
164
|
+
values: Array<Array<number | null>>;
|
|
165
|
+
/**
|
|
166
|
+
* 面积填充的下边界(堆叠面积用):
|
|
167
|
+
* 逐系列给出,形状与 values 相同;省略时填充到 baseline 水平线。
|
|
168
|
+
*/
|
|
169
|
+
lower?: Array<Array<number | null>>;
|
|
170
|
+
plot: LineChartPlot;
|
|
171
|
+
/** 数值域下界(负值场景下为负数) */
|
|
172
|
+
domainMin: number;
|
|
173
|
+
/** 数值域上界 */
|
|
174
|
+
domainMax: number;
|
|
175
|
+
/** 是否平滑 */
|
|
176
|
+
smooth: boolean;
|
|
177
|
+
/** 缺测点是否跨过(连到下一个有效点) */
|
|
178
|
+
connectNulls: boolean;
|
|
179
|
+
/** 是否绘制面积填充 */
|
|
180
|
+
area: boolean;
|
|
181
|
+
/** 面积基线的 y(未给 lower 时使用) */
|
|
182
|
+
baseline: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface StackedLineChartLayer {
|
|
186
|
+
seriesIndex: number;
|
|
187
|
+
/** 本层的值(缺测为 0) */
|
|
188
|
+
values: number[];
|
|
189
|
+
/** 本层下界(下方所有层的累加) */
|
|
190
|
+
base: number[];
|
|
191
|
+
/** 本层上界(base + values) */
|
|
192
|
+
top: number[];
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
返回 [LineChart 用法](./line-chart.md)。
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
2
|
# LineChart AI 使用
|
|
3
3
|
|
|
4
|
-
适用版本:x-next@1.
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
5
|
|
|
6
|
-
先读 [通用接入](../core.md)。公开导出:`LineChart
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`LineChart`;主要模型:无。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./line-chart-api.md),包含本组件族全部子组件和别名。
|
|
7
7
|
|
|
8
8
|
按需样式:`x-next/style/line-chart`(包含 base.css、line-chart.css、spin.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
9
|
|
|
10
|
+
## 已核验行为与示例
|
|
11
|
+
|
|
10
12
|
[组件文档与 live demo](https://x-next.yjmf.com/components/line-chart)。随时间看趋势就用它:`categories` 是时间轴标签,`series` 是数据系列(`{ name, data, color }`),按下标对应。多系列默认叠放,加 `area` 填充、再加 `stack` 变堆叠面积。按类目比大小用 BarChart,看占比用 PieChart,卡片角落的迷你走势用 TrendChart——完整选择指引见[图表总览](https://x-next.yjmf.com/components/charts)。
|
|
11
13
|
|
|
12
14
|
**缺测要显式表达**:把没有数据的点写成 `null`,默认会在该处**断开**折线(不会画成跌到 0);确需连线时传 `:connect-nulls="true"`。数值轴对纯正数数据保持 0 基线,出现负值才向下扩展;`min` / `max` 可锁定区间。`smooth` 默认开启,`show-points` 默认 `'auto'`(点数少时常显)。
|
|
@@ -44,4 +46,305 @@ function onLineClick(data: { label: string; value: number | null }) {
|
|
|
44
46
|
</template>
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
## 场景用法
|
|
50
|
+
|
|
51
|
+
以下示例从本地 `src/docs/components/line-chart.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./line-chart-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
52
|
+
|
|
53
|
+
### 用途与选型
|
|
54
|
+
|
|
55
|
+
用于展示指标随时间的变化趋势:支持多系列对比、面积填充、堆叠面积、平滑与缺测断点。
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### 完整日期与窄容器
|
|
59
|
+
|
|
60
|
+
调整宽度或切换长类目名称。首末文字保持在绘图区内,收边后再次检查间距;超长文字以省略号显示,悬停可读完整内容。
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
<script setup lang="ts">
|
|
64
|
+
import 'x-next/style.css';
|
|
65
|
+
import { ref } from 'vue';
|
|
66
|
+
import { LineChart } from 'x-next';
|
|
67
|
+
|
|
68
|
+
const width = ref(320);
|
|
69
|
+
const categories = Array.from({ length: 30 }, (_, index) =>
|
|
70
|
+
new Date(Date.UTC(2026, 8, 6 + index)).toISOString().slice(0, 10),
|
|
71
|
+
);
|
|
72
|
+
const series = [{ name: '浏览量', data: Array.from({ length: 30 }, (_, index) => 8 + index % 19) }];
|
|
73
|
+
</script>
|
|
74
|
+
<template>
|
|
75
|
+
<label>宽度 <input v-model.number="width" type="range" min="240" max="966" /></label>
|
|
76
|
+
<div :style="{ width: `${width}px`, maxWidth: '100%' }">
|
|
77
|
+
<LineChart :categories="categories" :series="series" />
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 何时使用
|
|
83
|
+
|
|
84
|
+
- 时间轴上比较多个指标的走势(各模型的 Token 消耗、不同环境的请求量)。
|
|
85
|
+
- 关注变化速率与拐点,而不是单个时间点的精确读数。
|
|
86
|
+
- 需要在线性趋势里叠加一条对照线(如实际值 vs 目标值)。
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### 与其它图表的分工
|
|
90
|
+
|
|
91
|
+
| 场景 | 选择 |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| 随时间看变化趋势 | LineChart(本页) |
|
|
94
|
+
| 按类目比较大小 | [BarChart 柱状趋势图](./bar-chart.md) |
|
|
95
|
+
| 看占比构成 | [PieChart 饼图](./pie-chart.md) |
|
|
96
|
+
| 卡片角落的迷你走势 | [TrendChart 趋势图](./trend-chart.md) |
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### 基础用法
|
|
100
|
+
|
|
101
|
+
`categories` 与每个系列 `data` 按下标一一对应;类目轴标签会按当前宽度自动抽稀,末位总是保留。
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<script setup lang="ts">
|
|
105
|
+
import 'x-next/style.css';
|
|
106
|
+
import { LineChart } from 'x-next';
|
|
107
|
+
import { ref } from 'vue';
|
|
108
|
+
|
|
109
|
+
const categories = ref(['09-28', '09-29', '09-30', '10-01', '10-02']);
|
|
110
|
+
const values = ref([820, 932, 901, 934, 1290]);
|
|
111
|
+
</script>
|
|
112
|
+
<template>
|
|
113
|
+
<LineChart
|
|
114
|
+
:categories="categories"
|
|
115
|
+
:series="[{ name: '请求量', data: values }]"
|
|
116
|
+
ariaLabel="近 30 天请求量"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 多系列与平滑
|
|
122
|
+
|
|
123
|
+
多系列默认叠放(不堆叠),颜色取自内置分类色板;`smooth` 默认为 `true`,关闭后是折线段。
|
|
124
|
+
|
|
125
|
+
```vue
|
|
126
|
+
<script setup lang="ts">
|
|
127
|
+
import 'x-next/style.css';
|
|
128
|
+
import { LineChart } from 'x-next';
|
|
129
|
+
import { ref } from 'vue';
|
|
130
|
+
|
|
131
|
+
const categories = ref(['09-28', '09-29', '09-30', '10-01', '10-02']);
|
|
132
|
+
const series = ref([
|
|
133
|
+
{ name: '输入 Token', data: [820, 932, 901, 934, 1290] },
|
|
134
|
+
{ name: '输出 Token', data: [420, 512, 401, 634, 890] },
|
|
135
|
+
]);
|
|
136
|
+
</script>
|
|
137
|
+
<template>
|
|
138
|
+
<LineChart :categories="categories" :series="series" legend />
|
|
139
|
+
</template>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### CSS 变量与系列颜色
|
|
143
|
+
|
|
144
|
+
`series[].color` 和 `labels.color` 支持 CSS 自定义属性引用(含 fallback),以及具名颜色、hex、rgb/rgba、hsl/hsla。传入值原样用于折线、面积、数据点、图例和提示色块,变量在图表所在节点解析;变量值变化无需替换系列数据。未传颜色时使用内置主题色板。
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import 'x-next/style.css';
|
|
149
|
+
const area = ref(true);
|
|
150
|
+
|
|
151
|
+
import { ref } from 'vue';
|
|
152
|
+
import { Button, LineChart } from 'x-next';
|
|
153
|
+
import type { LineChartSeries } from 'x-next';
|
|
154
|
+
|
|
155
|
+
const alternateColor = ref(false);
|
|
156
|
+
const series: LineChartSeries[] = [
|
|
157
|
+
{ name: '访问量(PV)', data: [20, 45, 30], color: 'var(--demo-line-color, var(--x-color-primary-6))' },
|
|
158
|
+
];
|
|
159
|
+
</script>
|
|
160
|
+
<template>
|
|
161
|
+
<div :style="{ '--demo-line-color': alternateColor ? 'var(--x-color-success-6)' : 'var(--x-color-primary-6)' }">
|
|
162
|
+
<Button @click="alternateColor = !alternateColor">切换系列颜色</Button>
|
|
163
|
+
<LineChart :categories="['10-07', '10-08', '10-09']" :series="series"
|
|
164
|
+
:labels="{ color: 'var(--x-color-text-primary)' }" area legend ariaLabel="CSS 变量颜色示例" />
|
|
165
|
+
</div>
|
|
166
|
+
</template>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 面积图与堆叠面积
|
|
170
|
+
|
|
171
|
+
`area` 打开填充;配合 `stack` 变为堆叠面积。堆叠面积适合看「总量 + 构成」——每层填充在下界与上界之间。
|
|
172
|
+
|
|
173
|
+
```vue
|
|
174
|
+
<script setup lang="ts">
|
|
175
|
+
import 'x-next/style.css';
|
|
176
|
+
import { LineChart } from 'x-next';
|
|
177
|
+
const area = ref(true);
|
|
178
|
+
const stack = ref(false);
|
|
179
|
+
|
|
180
|
+
import { ref } from 'vue';
|
|
181
|
+
|
|
182
|
+
const categories = ref(['09-28', '09-29', '09-30', '10-01', '10-02']);
|
|
183
|
+
const series = ref([
|
|
184
|
+
{ name: 'deepseek-flash', data: [43.38, 52.4, 38.05, 61.2, 55.8] },
|
|
185
|
+
{ name: 'gpt-4o-mini', data: [18.29, 26.1, 12.6, 30.4, 22.1] },
|
|
186
|
+
]);
|
|
187
|
+
const formatMoney = (value: number) => `¥${value.toFixed(2)}`;
|
|
188
|
+
</script>
|
|
189
|
+
<template>
|
|
190
|
+
<LineChart
|
|
191
|
+
:categories="categories"
|
|
192
|
+
:series="series"
|
|
193
|
+
area
|
|
194
|
+
stack
|
|
195
|
+
:value-formatter="formatMoney"
|
|
196
|
+
legend
|
|
197
|
+
/>
|
|
198
|
+
</template>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 缺测处理
|
|
202
|
+
|
|
203
|
+
`null` 表示该时间点没有数据。默认**断开**折线(避免把「没有调用」画成跌到 0);`connectNulls` 打开后跨过缺测连到下一点。两者都不会在缺测处产生数据点。
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<script setup lang="ts">
|
|
207
|
+
import 'x-next/style.css';
|
|
208
|
+
import { LineChart } from 'x-next';
|
|
209
|
+
import { ref } from 'vue';
|
|
210
|
+
|
|
211
|
+
const connectNulls = ref(false);
|
|
212
|
+
const categories = ref(['09-28', '09-29', '09-30', '10-01', '10-02']);
|
|
213
|
+
// 周末为 null:默认在该处断开折线
|
|
214
|
+
const values = ref([820, null, null, 934, 1290]);
|
|
215
|
+
</script>
|
|
216
|
+
<template>
|
|
217
|
+
<LineChart
|
|
218
|
+
:categories="categories"
|
|
219
|
+
:series="[{ name: '工作日请求量', data: values }]"
|
|
220
|
+
:connect-nulls="connectNulls"
|
|
221
|
+
/>
|
|
222
|
+
</template>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### 数值轴与负值
|
|
226
|
+
|
|
227
|
+
正数数据保持 0 基线(不会用非零基线夸大波动);出现负值时才向下扩展出负向刻度,零线会被强调。`min` / `max` 可锁定区间。
|
|
228
|
+
|
|
229
|
+
```vue
|
|
230
|
+
<script setup lang="ts">
|
|
231
|
+
import 'x-next/style.css';
|
|
232
|
+
import { LineChart } from 'x-next';
|
|
233
|
+
import { ref } from 'vue';
|
|
234
|
+
|
|
235
|
+
const categories = ref(['9/1', '9/5', '9/10', '9/15', '9/20', '9/25', '9/30']);
|
|
236
|
+
const series = ref([
|
|
237
|
+
{ name: 'p50', data: [180, 210, 195, 230, 205, 240, 220] },
|
|
238
|
+
{ name: 'p95', data: [420, 680, 510, 940, 720, 1180, 860] },
|
|
239
|
+
]);
|
|
240
|
+
</script>
|
|
241
|
+
<template>
|
|
242
|
+
<LineChart
|
|
243
|
+
:categories="categories"
|
|
244
|
+
:series="series"
|
|
245
|
+
:max="1200"
|
|
246
|
+
:grid="{ horizontalLinesNumber: 5 }"
|
|
247
|
+
legend
|
|
248
|
+
/>
|
|
249
|
+
</template>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 自定义提示与点击事件
|
|
253
|
+
|
|
254
|
+
`tooltip` 插槽可完全接管浮层内容;点击触发 `line-click`,命中具体数据点时带 `seriesIndex` 与 `value`。
|
|
255
|
+
|
|
256
|
+
```vue
|
|
257
|
+
<script setup lang="ts">
|
|
258
|
+
import 'x-next/style.css';
|
|
259
|
+
import { LineChart } from 'x-next';
|
|
260
|
+
import { ref } from 'vue';
|
|
261
|
+
|
|
262
|
+
const categories = ref(['09-28', '09-29', '09-30']);
|
|
263
|
+
const series = ref([
|
|
264
|
+
{ name: '请求量', data: [820, 932, 901] },
|
|
265
|
+
{ name: '错误数', data: [120, 132, 101] },
|
|
266
|
+
]);
|
|
267
|
+
const clickLog = ref('尚未点击数据点');
|
|
268
|
+
const onLineClick = (data: { label: string; value: number | null }) => {
|
|
269
|
+
clickLog.value = `${data.label}:${data.value ?? '缺测'}`;
|
|
270
|
+
};
|
|
271
|
+
</script>
|
|
272
|
+
<template>
|
|
273
|
+
<LineChart
|
|
274
|
+
:categories="categories"
|
|
275
|
+
:series="series"
|
|
276
|
+
legend
|
|
277
|
+
@line-click="onLineClick"
|
|
278
|
+
>
|
|
279
|
+
<template #tooltip="{ label, items, formatValue }">
|
|
280
|
+
<div style="font-weight: 500">{{ label }}</div>
|
|
281
|
+
<div v-for="item in items" :key="item.seriesIndex">
|
|
282
|
+
<span>{{ item.name }}</span>
|
|
283
|
+
<span>{{ item.value === null ? '-' : formatValue(item.value) }}</span>
|
|
284
|
+
</div>
|
|
285
|
+
</template>
|
|
286
|
+
</LineChart>
|
|
287
|
+
<p>{{ clickLog }}</p>
|
|
288
|
+
</template>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 数据点与轴格式化
|
|
292
|
+
|
|
293
|
+
`showPoints` 控制数据点:`true` 常显、`false` 不显示、`'auto'`(默认)在点数较少时常显。`labels.yFormatter` 只影响数值轴,`valueFormatter` 同时影响提示与图例。
|
|
294
|
+
|
|
295
|
+
```vue
|
|
296
|
+
<script setup lang="ts">
|
|
297
|
+
import 'x-next/style.css';
|
|
298
|
+
import { LineChart } from 'x-next';
|
|
299
|
+
import { ref } from 'vue';
|
|
300
|
+
|
|
301
|
+
const smooth = ref(true);
|
|
302
|
+
const categories = ref(['09-28', '09-29', '09-30']);
|
|
303
|
+
const series = ref([{ name: '请求量', data: [820, 932, 901] }]);
|
|
304
|
+
const formatCompact = (value: number) => (value >= 1000 ? `${value / 1000}k` : `${value}`);
|
|
305
|
+
</script>
|
|
306
|
+
<template>
|
|
307
|
+
<LineChart
|
|
308
|
+
:categories="categories"
|
|
309
|
+
:series="series"
|
|
310
|
+
:show-points="true"
|
|
311
|
+
:smooth="smooth"
|
|
312
|
+
:value-formatter="formatCompact"
|
|
313
|
+
/>
|
|
314
|
+
</template>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### 加载与空数据
|
|
318
|
+
|
|
319
|
+
`loading` 覆盖加载遮罩;全部为 `null` 或没有系列时显示空态,可用 `empty` 插槽替换。
|
|
320
|
+
|
|
321
|
+
```vue
|
|
322
|
+
<script setup lang="ts">
|
|
323
|
+
import 'x-next/style.css';
|
|
324
|
+
import { LineChart } from 'x-next';
|
|
325
|
+
import { ref } from 'vue';
|
|
326
|
+
|
|
327
|
+
const loading = ref(true);
|
|
328
|
+
const categories = ref(['09-28', '09-29', '09-30']);
|
|
329
|
+
const series = ref([{ name: '请求量', data: [820, 932, 901] }]);
|
|
330
|
+
</script>
|
|
331
|
+
<template>
|
|
332
|
+
<LineChart :categories="categories" :series="series" :loading="loading">
|
|
333
|
+
<template #empty>该时段没有调用记录</template>
|
|
334
|
+
</LineChart>
|
|
335
|
+
</template>
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### 交互说明
|
|
339
|
+
|
|
340
|
+
- **数值轴**:默认按 1 / 2 / 5 步长取整(刻度始终是 `0.5`、`80` 这类可读值),因此实际刻度行数可能少于 `horizontalLinesNumber`;传 `min` / `max` 后按锁定值均分。
|
|
341
|
+
- **零基线**:纯正数数据不会用非零基线;出现负值时才扩展负向刻度。
|
|
342
|
+
- **缺测**:默认断线,`connectNulls` 改为跨过;两种模式都不会在缺测处产生数据点,避免鼠标命中不存在的点。
|
|
343
|
+
- **堆叠**:按可见系列的顺序自下而上累加;缺测按 0 处理,保证堆叠层不出现空洞。命中的系列高亮显示,其余系列由样式淡化。
|
|
344
|
+
- **x 轴标签**:按当前宽度和文字宽度自动抽稀,优先保留末位;收边后再次检查间距。空间不足时省略其他标签,单个超长标签以省略号显示并提供完整文字提示。
|
|
345
|
+
- **键盘导航**:绘图区可聚焦,左右方向键移动读数、Home / End 跳到首尾、Esc 关闭提示;键盘导航时通过 `aria-live` 播报。
|
|
346
|
+
- **性能**:整块画布只挂一个 mousemove 与一个提示节点,不为每个数据点创建浮层或监听器;数据点默认在点数较少时常显,长序列自动隐藏。
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./line-chart-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Link 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## Link API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/link/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| href | 链接地址 | undefined | string | 否 | 未声明 |
|
|
17
|
+
| status | 链接状态 | undefined | "normal" | "success" | "warning" | "strong" | "danger" | 否 | "normal" |
|
|
18
|
+
| hoverable | 鼠标悬浮时是否展示底色 | undefined | false | true | 否 | true |
|
|
19
|
+
| icon | 是否显示默认图标 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
20
|
+
| loading | 是否为加载状态,加载中不会触发点击事件 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
21
|
+
| disabled | 是否禁用,禁用时不会触发点击事件 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
22
|
+
| strong | 是否加粗,x-next 扩展能力 | undefined | false | true | 否 | false(Vue Boolean 转换) |
|
|
23
|
+
|
|
24
|
+
### Events
|
|
25
|
+
|
|
26
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| click | 点击链接或通过键盘触发动作链接时触发,禁用或加载中不会触发 | undefined | (ev: MouseEvent | KeyboardEvent) => any |
|
|
29
|
+
|
|
30
|
+
### Slots
|
|
31
|
+
|
|
32
|
+
| 名称 | 用途 | 公开类型 |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| default | 链接文本 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
35
|
+
| icon | 自定义图标 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
36
|
+
|
|
37
|
+
### 实例方法
|
|
38
|
+
|
|
39
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
返回 [Link 用法](./link.md)。
|