@xq-labs/data-ui-v2 0.1.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.
@@ -0,0 +1,57 @@
1
+ # BarLineChart 示例说明(对齐 Playground Demo 库)
2
+
3
+ ## 1. 路由与分组
4
+
5
+ Playground 中 `BarLineChart` 按分组路由组织:
6
+
7
+ - 基础用法:`/bar-line-chart/basic`
8
+ - 圆柱样式:`/bar-line-chart/cylinder`
9
+ - 方柱样式:`/bar-line-chart/cube`
10
+ - 进阶配置:`/bar-line-chart/advanced`
11
+ - customOption 与自定义:`/bar-line-chart/custom`
12
+ - 实验室:`/bar-line-chart/lab`
13
+
14
+ > 实验室边界:仅用于调试/验证,不作为推荐业务写法。
15
+
16
+ ## 2. 外部配置怎么传
17
+
18
+ 业务侧通过公开 props(推荐 `v-bind`)传入:
19
+
20
+ ```vue
21
+ <BarLineChart
22
+ v-bind="{
23
+ data,
24
+ xAxisKey,
25
+ series,
26
+ variant,
27
+ preset,
28
+ barWidth,
29
+ barGap,
30
+ customOption
31
+ }"
32
+ />
33
+ ```
34
+
35
+ 关键字段:
36
+
37
+ - `data`:原始业务数据。
38
+ - `xAxisKey`:横轴字段名。
39
+ - `series`:系列定义(字段映射、图形类型、轴、堆叠)。
40
+ - `variant`:`flat` / `cylinder` / `cube`。
41
+ - `preset`:展示预设。
42
+ - `barWidth`、`barGap`:柱体宽度与间距。
43
+ - `customOption`:ECharts 展示细节覆盖。
44
+
45
+ ## 3. 如何自定义(推荐顺序)
46
+
47
+ 1. **优先 `series` 表达业务语义**:先确定字段、柱线类型、双轴和堆叠关系。
48
+ 2. **用 `series.colors` 控制系列配色**:把业务色板放在系列层。
49
+ 3. **`customOption` 补充细节**:用于 tooltip、legend、grid、坐标轴样式等展示项。
50
+
51
+ 不建议用 `customOption` 直接整体替换关键业务结构。
52
+
53
+ ## 4. 可执行验收要点
54
+
55
+ - 页面分组名称与路由一致:基础用法、圆柱样式、方柱样式、进阶配置、customOption 与自定义、实验室。
56
+ - 文档示例包含 `series.colors` 与 `customOption`。
57
+ - 文档明确实验室边界与推荐自定义顺序。
@@ -0,0 +1,72 @@
1
+ # PieChart 示例说明(对齐 Playground Demo 库)
2
+
3
+ ## 1. 路由与分组
4
+
5
+ Playground 中 `PieChart` 采用分组路由组织,按能力查阅:
6
+
7
+ - 基础用法:`/pie-chart/basic`
8
+ - 2D 形态:`/pie-chart/shape-2d`
9
+ - 3D 能力:`/pie-chart/three-d`
10
+ - 标签与引导线:`/pie-chart/label`
11
+ - customOption 与自定义:`/pie-chart/custom`
12
+ - 实验室:`/pie-chart/lab`
13
+
14
+ > 实验室边界:仅用于调试/验证,不作为推荐业务写法。
15
+
16
+ ## 2. 外部配置怎么传
17
+
18
+ 业务侧统一通过公开 props(推荐 `v-bind`)传入配置,不直接拼内部实现细节。
19
+
20
+ ```vue
21
+ <PieChart
22
+ v-bind="{
23
+ data,
24
+ variant,
25
+ dimension,
26
+ preset,
27
+ heightMode,
28
+ minHeight,
29
+ maxHeight,
30
+ hideZeroValueSlices,
31
+ labelOptions,
32
+ customOption
33
+ }"
34
+ />
35
+ ```
36
+
37
+ 常用字段说明:
38
+
39
+ - `data`:图表数据源。
40
+ - `variant`:`pie` / `ring` / `rose-pie` / `rose-ring`。
41
+ - `dimension`:`2d` / `3d`。
42
+ - `preset`:预设展示策略。
43
+ - `heightMode`、`minHeight`、`maxHeight`:3D 高度映射策略。
44
+ - `hideZeroValueSlices`:3D 下是否隐藏 0 值扇区。
45
+ - `labelOptions`:标签与引导线细节(格式、线长、颜色等)。
46
+ - `customOption`:ECharts 细节覆盖(标题、提示、图例等)。
47
+
48
+ ## 2.1 3D 依赖说明
49
+
50
+ 3D 饼图需要安装 echarts-gl,依赖包名为 `echarts-gl`。
51
+
52
+ 只使用 2D 饼图、环图、玫瑰图时不需要安装 `echarts-gl`。
53
+
54
+ 如果业务侧需要启用 3D 饼图,请额外安装:
55
+
56
+ ```bash
57
+ npm install echarts-gl
58
+ ```
59
+
60
+ ## 3. 如何自定义(推荐顺序)
61
+
62
+ 1. **优先公开 props**:先用 `variant`、`dimension`、`preset`、高度参数表达业务语义。
63
+ 2. **其次 `labelOptions`**:标签文案、引导线样式优先在这里完成。
64
+ 3. **最后 `customOption`**:仅用于补充 ECharts 展示细节。
65
+
66
+ 不建议业务侧直接拼接或重写内部 `series`,避免覆盖组件内置能力与升级兼容性。
67
+
68
+ ## 4. 可执行验收要点
69
+
70
+ - 页面分组名称与路由一致:基础用法、2D 形态、3D 能力、标签与引导线、customOption 与自定义、实验室。
71
+ - 文档示例包含 `hideZeroValueSlices` 与 `customOption`。
72
+ - 文档明确实验室边界与推荐自定义顺序。
@@ -0,0 +1,13 @@
1
+ import '../../theme-chalk/index.css';
2
+ import { B as BarLineChart } from '../index-6128787e.js';
3
+ import { w as withInstall } from '../with-install-befebea5.js';
4
+ import 'echarts/core';
5
+ import 'echarts/charts';
6
+ import 'echarts/components';
7
+ import 'echarts/renderers';
8
+ import '../colors-ca059479.js';
9
+
10
+ var BarLineChartComponent = withInstall(BarLineChart);
11
+ var install = BarLineChartComponent.install;
12
+
13
+ export { BarLineChartComponent as BarLineChart, BarLineChartComponent as default, install };
@@ -0,0 +1,8 @@
1
+ import '../../theme-chalk/index.css';
2
+ import { w as withInstall, B as BaseChart } from '../with-install-befebea5.js';
3
+ import 'echarts/core';
4
+
5
+ var BaseChartComponent = withInstall(BaseChart);
6
+ var install = BaseChartComponent.install;
7
+
8
+ export { BaseChartComponent as BaseChart, BaseChartComponent as default, install };
@@ -0,0 +1,115 @@
1
+ function isEmptyData(data) {
2
+ return !Array.isArray(data) || data.length === 0;
3
+ }
4
+
5
+ function _arrayLikeToArray(r, a) {
6
+ (null == a || a > r.length) && (a = r.length);
7
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
8
+ return n;
9
+ }
10
+ function _arrayWithoutHoles(r) {
11
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
12
+ }
13
+ function _defineProperty(e, r, t) {
14
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
15
+ value: t,
16
+ enumerable: !0,
17
+ configurable: !0,
18
+ writable: !0
19
+ }) : e[r] = t, e;
20
+ }
21
+ function _iterableToArray(r) {
22
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
23
+ }
24
+ function _nonIterableSpread() {
25
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
26
+ }
27
+ function ownKeys(e, r) {
28
+ var t = Object.keys(e);
29
+ if (Object.getOwnPropertySymbols) {
30
+ var o = Object.getOwnPropertySymbols(e);
31
+ r && (o = o.filter(function (r) {
32
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
33
+ })), t.push.apply(t, o);
34
+ }
35
+ return t;
36
+ }
37
+ function _objectSpread2(e) {
38
+ for (var r = 1; r < arguments.length; r++) {
39
+ var t = null != arguments[r] ? arguments[r] : {};
40
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
41
+ _defineProperty(e, r, t[r]);
42
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
43
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
44
+ });
45
+ }
46
+ return e;
47
+ }
48
+ function _toConsumableArray(r) {
49
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
50
+ }
51
+ function _toPrimitive(t, r) {
52
+ if ("object" != typeof t || !t) return t;
53
+ var e = t[Symbol.toPrimitive];
54
+ if (void 0 !== e) {
55
+ var i = e.call(t, r || "default");
56
+ if ("object" != typeof i) return i;
57
+ throw new TypeError("@@toPrimitive must return a primitive value.");
58
+ }
59
+ return ("string" === r ? String : Number)(t);
60
+ }
61
+ function _toPropertyKey(t) {
62
+ var i = _toPrimitive(t, "string");
63
+ return "symbol" == typeof i ? i : i + "";
64
+ }
65
+ function _unsupportedIterableToArray(r, a) {
66
+ if (r) {
67
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
68
+ var t = {}.toString.call(r).slice(8, -1);
69
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
70
+ }
71
+ }
72
+
73
+ function isPlainObject(value) {
74
+ return Object.prototype.toString.call(value) === '[object Object]';
75
+ }
76
+ function cloneValue(value) {
77
+ if (Array.isArray(value)) {
78
+ return value.map(function (item) {
79
+ return cloneValue(item);
80
+ });
81
+ }
82
+ if (isPlainObject(value)) {
83
+ return Object.keys(value).reduce(function (result, key) {
84
+ result[key] = cloneValue(value[key]);
85
+ return result;
86
+ }, {});
87
+ }
88
+ return value;
89
+ }
90
+ function mergeValue(targetValue, sourceValue) {
91
+ if (Array.isArray(sourceValue)) {
92
+ return cloneValue(sourceValue);
93
+ }
94
+ if (!isPlainObject(sourceValue)) {
95
+ return cloneValue(sourceValue);
96
+ }
97
+ var baseObject = isPlainObject(targetValue) ? targetValue : {};
98
+ var mergedObject = _objectSpread2({}, baseObject);
99
+ Object.keys(sourceValue).forEach(function (key) {
100
+ mergedObject[key] = mergeValue(baseObject[key], sourceValue[key]);
101
+ });
102
+ return mergedObject;
103
+ }
104
+ function mergeChartOption(baseOption, presetOption, customOption) {
105
+ return [baseOption, presetOption, customOption].reduce(function (result, option) {
106
+ if (!isPlainObject(option)) {
107
+ return result;
108
+ }
109
+ return mergeValue(result, option);
110
+ }, {});
111
+ }
112
+
113
+ var DEFAULT_COLORS = ['#8979ff', '#ff928a', '#3cc3df', '#ffae4c', '#5c7cfa', '#5dd39e', '#8064d8', '#26b7d8', '#238ff2', '#f6c93d', '#59c5b5', '#5a7cc4', '#f2953f', '#82c65b', '#cf7a78', '#63c5d2', '#cfb291', '#2fa0bf', '#50a579', '#7869bd'];
114
+
115
+ export { DEFAULT_COLORS as D, _objectSpread2 as _, _toConsumableArray as a, isEmptyData as i, mergeChartOption as m };