@worm-print-platform/echarts 1.5.3 → 1.6.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/README.md +41 -1
- package/dist/bind.d.ts +1 -1
- package/dist/browser/executor.iife.d.ts +1 -1
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/constants.d.ts +5 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/echarts.d.ts +1 -1
- package/dist/echarts.js +38 -14
- package/dist/executor.iife.global.d.ts +1 -1
- package/dist/executor.iife.global.js +29 -17
- package/dist/i18n/en-US.json +153 -0
- package/dist/i18n/th-TH.json +153 -0
- package/dist/i18n/zh-CN.json +153 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -12
- package/dist/kinds.d.ts +6 -2
- package/dist/kit.cjs +2 -2
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +45 -148
- package/dist/label.d.ts +65 -0
- package/dist/marketplace.d.ts +1 -1
- package/dist/marketplace.js +1361 -126
- package/dist/node.cjs +93 -39
- package/dist/node.d.ts +1 -1
- package/dist/node.js +93 -39
- package/dist/normalize.d.ts +1 -1
- package/dist/option-utils.d.ts +1 -1
- package/dist/plugin-8R67OtBD.cjs +6 -0
- package/dist/plugin-CKyaiHYF.js +960 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/test-setup.d.ts +7 -0
- package/dist/type-augmentation.d.ts +1 -1
- package/dist/ui.cjs +1973 -87
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1953 -86
- package/dist/units.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +29 -3
- package/dist/plugin-Bf6QDbHO.cjs +0 -6
- package/dist/plugin-CUoE2jMs.js +0 -573
package/dist/ui.js
CHANGED
|
@@ -1,38 +1,1611 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/echarts v1.
|
|
2
|
+
* @worm-print-platform/echarts v1.6.1
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
// src/ui.ts
|
|
9
|
+
import { t as globalT } from "@worm-print-platform/core/i18n";
|
|
10
|
+
|
|
11
|
+
// src/i18n/zh-CN.json
|
|
12
|
+
var zh_CN_default = {
|
|
13
|
+
echarts: {
|
|
14
|
+
"echarts.panel.chart": "\u56FE\u8868",
|
|
15
|
+
"echarts.panel.config": "\u914D\u7F6E",
|
|
16
|
+
"echarts.panel.dataSource": "\u6570\u636E\u6E90",
|
|
17
|
+
"echarts.panel.category": "\u7C7B\u76EE",
|
|
18
|
+
"echarts.panel.value": "\u6570\u503C",
|
|
19
|
+
"echarts.panel.series": "\u7CFB\u5217",
|
|
20
|
+
"echarts.panel.chartType.bar": "\u67F1\u72B6",
|
|
21
|
+
"echarts.panel.chartType.barH": "\u6761\u5F62",
|
|
22
|
+
"echarts.panel.chartType.line": "\u6298\u7EBF",
|
|
23
|
+
"echarts.panel.chartType.area": "\u9762\u79EF",
|
|
24
|
+
"echarts.panel.chartType.pie": "\u997C",
|
|
25
|
+
"echarts.panel.chartType.doughnut": "\u73AF\u5F62",
|
|
26
|
+
"echarts.panel.chartType.scatter": "\u6563\u70B9",
|
|
27
|
+
"echarts.panel.chartType.radar": "\u96F7\u8FBE",
|
|
28
|
+
"echarts.panel.chartType.funnel": "\u6F0F\u6597",
|
|
29
|
+
"echarts.panel.chartType.gauge": "\u4EEA\u8868",
|
|
30
|
+
"echarts.panel.dataLabel": "\u6570\u636E\u6807\u7B7E",
|
|
31
|
+
"echarts.panel.valueLabel": "\u6570\u503C\u6807\u7B7E",
|
|
32
|
+
"echarts.panel.hint.dataBinding": "\u6570\u636E\u7531\u6A21\u677F\u7ED1\u5B9A\u9636\u6BB5\u6CE8\u5165\uFF1Aseries/xAxis \u7684 data \u4FDD\u7559 `$data` \u5360\u4F4D\u5373\u53EF\uFF1B\u590D\u6742\u6837\u5F0F\u53EF\u5728\u6A21\u677F JSON \u4E2D\u624B\u5199 chartOption\u3002",
|
|
33
|
+
"echarts.panel.field.dimension": "\u7EF4\u5EA6\u5B57\u6BB5\uFF08\u6BCF\u4E2A\u5B57\u6BB5\u4E00\u4E2A\u7EF4\u5EA6\uFF09",
|
|
34
|
+
"echarts.panel.field.value": "\u6570\u503C\u5B57\u6BB5",
|
|
35
|
+
"echarts.panel.field.valueMulti": "\u6570\u503C\u5B57\u6BB5\uFF08\u591A\u503C\u591A\u7CFB\u5217\uFF09",
|
|
36
|
+
"echarts.panel.default": "\uFF08\u9ED8\u8BA4\uFF09",
|
|
37
|
+
"echarts.panel.current": "\uFF08\u5F53\u524D\uFF09",
|
|
38
|
+
"echarts.panel.defaultFirstArray": "\uFF08\u9ED8\u8BA4\uFF1A\u9876\u5C42\u7B2C\u4E00\u4E2A\u6570\u7EC4\uFF09",
|
|
39
|
+
"echarts.panel.error.invalidOption": "\u56FE\u8868 option \u975E\u6CD5\uFF1A\u9700\u8981\u5BF9\u8C61",
|
|
40
|
+
"echarts.panel.chartFallback": "\u56FE\u8868",
|
|
41
|
+
"echarts.panel.optionDefault": "\uFF08\u9ED8\u8BA4\uFF09",
|
|
42
|
+
"echarts.panel.overflow.default": "\u9ED8\u8BA4",
|
|
43
|
+
"echarts.panel.overflow.none": "\u4E0D\u5904\u7406\uFF08\u663E\u793A\u5B8C\u6574\uFF09",
|
|
44
|
+
"echarts.panel.overflow.truncate": "\u622A\u65AD",
|
|
45
|
+
"echarts.panel.overflow.break": "\u6362\u884C",
|
|
46
|
+
"echarts.panel.fontWeight.default": "\u9ED8\u8BA4",
|
|
47
|
+
"echarts.panel.fontWeight.normal": "\u5E38\u89C4",
|
|
48
|
+
"echarts.panel.fontWeight.bold": "\u52A0\u7C97",
|
|
49
|
+
"echarts.panel.label.distance": "\u8DDD\u79BB",
|
|
50
|
+
"echarts.panel.label.rotate": "\u65CB\u8F6C\uFF08\u5EA6\uFF09",
|
|
51
|
+
"echarts.panel.label.fontSize": "\u5B57\u53F7",
|
|
52
|
+
"echarts.panel.label.fontWeight": "\u5B57\u91CD",
|
|
53
|
+
"echarts.panel.label.color": "\u6587\u5B57\u989C\u8272",
|
|
54
|
+
"echarts.panel.label.backgroundColor": "\u80CC\u666F\u8272",
|
|
55
|
+
"echarts.panel.label.borderColor": "\u8FB9\u6846\u8272",
|
|
56
|
+
"echarts.panel.label.borderWidth": "\u8FB9\u6846\u5BBD\u5EA6",
|
|
57
|
+
"echarts.panel.label.borderRadius": "\u5706\u89D2",
|
|
58
|
+
"echarts.panel.label.padding": "\u5185\u8FB9\u8DDD",
|
|
59
|
+
"echarts.panel.label.show": "\u663E\u793A\u6570\u636E\u6807\u7B7E",
|
|
60
|
+
"echarts.panel.label.content": "\u5185\u5BB9",
|
|
61
|
+
"echarts.panel.label.formatterTitle": "\u6570\u636E\u6807\u7B7E\u5185\u5BB9",
|
|
62
|
+
"echarts.panel.label.formatterCustom": "\u81EA\u5B9A\u4E49 / \u9ED8\u8BA4",
|
|
63
|
+
"echarts.panel.label.formatterPlaceholder": "\u5982 {b}: {c}",
|
|
64
|
+
"echarts.panel.label.overflow": "\u6EA2\u51FA\u5904\u7406",
|
|
65
|
+
"echarts.panel.label.position": "\u4F4D\u7F6E",
|
|
66
|
+
"echarts.panel.label.positionTitle": "\u6807\u7B7E\u4F4D\u7F6E",
|
|
67
|
+
"echarts.panel.label.positionDefault": "\u9ED8\u8BA4",
|
|
68
|
+
"echarts.panel.label.offset": "\u504F\u79FB X / Y",
|
|
69
|
+
"echarts.panel.label.style": "\u6837\u5F0F",
|
|
70
|
+
"echarts.panel.labelLine.fontWeight": "\u5B57\u91CD",
|
|
71
|
+
"echarts.panel.labelLine": "\u5F15\u5BFC\u7EBF",
|
|
72
|
+
"echarts.panel.labelLine.show": "\u663E\u793A\u5F15\u5BFC\u7EBF",
|
|
73
|
+
"echarts.panel.labelLine.length": "\u5F15\u5BFC\u7EBF\u957F\u5EA6",
|
|
74
|
+
"echarts.panel.labelLine.length2": "\u7B2C\u4E8C\u6BB5\u957F\u5EA6",
|
|
75
|
+
"echarts.panel.labelLine.smooth": "\u5E73\u6ED1\u5F15\u5BFC\u7EBF",
|
|
76
|
+
"echarts.panel.dataSourceTitle": "\u6570\u636E\u6E90",
|
|
77
|
+
"echarts.panel.categoryField": "\u7C7B\u76EE\u5B57\u6BB5",
|
|
78
|
+
"echarts.panel.removeField": "\u5220\u9664\u8BE5\u5B57\u6BB5",
|
|
79
|
+
"echarts.panel.addField": "+ \u6DFB\u52A0\u5B57\u6BB5",
|
|
80
|
+
"echarts.panel.seriesField": "\u7CFB\u5217\u62C6\u5206\u5B57\u6BB5",
|
|
81
|
+
"echarts.panel.seriesFieldHint": "\u53EF\u9009\uFF0C\u5982 region\uFF08\u6309\u503C\u62C6\u6210\u591A\u7CFB\u5217\uFF09",
|
|
82
|
+
"echarts.panel.bubbleSize": "\u6C14\u6CE1\u5927\u5C0F",
|
|
83
|
+
"echarts.panel.title": "\u56FE\u8868\u6807\u9898",
|
|
84
|
+
"echarts.panel.titleHint": "\u7559\u7A7A\u4E0D\u663E\u793A\u6807\u9898",
|
|
85
|
+
"echarts.panel.legend": "\u663E\u793A\u56FE\u4F8B",
|
|
86
|
+
"echarts.panel.palette": "\u914D\u8272",
|
|
87
|
+
"echarts.palette.default": "\u9ED8\u8BA4\u84DD",
|
|
88
|
+
"echarts.palette.fresh": "\u6E05\u65B0\u7EFF",
|
|
89
|
+
"echarts.palette.warm": "\u6696\u6A59\u7EA2",
|
|
90
|
+
"echarts.palette.purple": "\u7D2B\u7070",
|
|
91
|
+
"echarts.panel.stack": "\u5806\u53E0\u663E\u793A",
|
|
92
|
+
"echarts.panel.innerRadius": "\u5185\u5F84\uFF08%\uFF09",
|
|
93
|
+
"echarts.panel.paddingTRBL": "\u5185\u8FB9\u8DDD \u4E0A/\u53F3/\u4E0B/\u5DE6 (%)",
|
|
94
|
+
"echarts.panel.paddingTop": "\u4E0A\u8FB9\u8DDD",
|
|
95
|
+
"echarts.panel.paddingRight": "\u53F3\u8FB9\u8DDD\uFF08\u7559\u5916\u7F6E\u6807\u7B7E\uFF09",
|
|
96
|
+
"echarts.panel.paddingBottom": "\u4E0B\u8FB9\u8DDD",
|
|
97
|
+
"echarts.panel.paddingLeft": "\u5DE6\u8FB9\u8DDD",
|
|
98
|
+
"echarts.panel.radius": "\u534A\u5F84\uFF08%\uFF09",
|
|
99
|
+
"echarts.panel.minMax": "\u6700\u5C0F / \u6700\u5927\u503C",
|
|
100
|
+
"echarts.panel.group": "\u56FE\u8868",
|
|
101
|
+
"echarts.series.typeNames.bar": "\u67F1\u72B6\u56FE",
|
|
102
|
+
"echarts.series.typeNames.barH": "\u6761\u5F62\u56FE",
|
|
103
|
+
"echarts.series.typeNames.line": "\u6298\u7EBF\u56FE",
|
|
104
|
+
"echarts.series.typeNames.area": "\u9762\u79EF\u56FE",
|
|
105
|
+
"echarts.series.typeNames.pie": "\u997C\u56FE",
|
|
106
|
+
"echarts.series.typeNames.doughnut": "\u73AF\u5F62\u56FE",
|
|
107
|
+
"echarts.series.typeNames.scatter": "\u6563\u70B9\u56FE",
|
|
108
|
+
"echarts.series.typeNames.radar": "\u96F7\u8FBE\u56FE",
|
|
109
|
+
"echarts.series.typeNames.funnel": "\u6F0F\u6597\u56FE",
|
|
110
|
+
"echarts.series.typeNames.gauge": "\u4EEA\u8868\u76D8",
|
|
111
|
+
"echarts.label.formatter.value": "\u6570\u503C",
|
|
112
|
+
"echarts.label.formatter.nameValue": "\u540D\u79F0: \u6570\u503C",
|
|
113
|
+
"echarts.label.formatter.name": "\u540D\u79F0",
|
|
114
|
+
"echarts.label.formatter.percent": "\u767E\u5206\u6BD4",
|
|
115
|
+
"echarts.label.position.bar.top": "\u9876\u90E8",
|
|
116
|
+
"echarts.label.position.bar.inside": "\u5185\u90E8",
|
|
117
|
+
"echarts.label.position.bar.insideTop": "\u5185\u90E8\u9876\u7AEF",
|
|
118
|
+
"echarts.label.position.bar.bottom": "\u5E95\u90E8",
|
|
119
|
+
"echarts.label.position.bar.insideBottom": "\u5185\u90E8\u5E95\u7AEF",
|
|
120
|
+
"echarts.label.position.bar.right": "\u53F3\u4FA7",
|
|
121
|
+
"echarts.label.position.bar.left": "\u5DE6\u4FA7",
|
|
122
|
+
"echarts.label.position.bar.middle": "\u5C45\u4E2D",
|
|
123
|
+
"echarts.label.position.line.top": "\u9876\u90E8",
|
|
124
|
+
"echarts.label.position.line.bottom": "\u5E95\u90E8",
|
|
125
|
+
"echarts.label.position.line.inside": "\u5185\u90E8",
|
|
126
|
+
"echarts.label.position.line.left": "\u5DE6\u4FA7",
|
|
127
|
+
"echarts.label.position.line.right": "\u53F3\u4FA7",
|
|
128
|
+
"echarts.label.position.pie.outside": "\u5916\u4FA7",
|
|
129
|
+
"echarts.label.position.pie.inside": "\u5185\u90E8",
|
|
130
|
+
"echarts.label.position.pie.center": "\u4E2D\u5FC3",
|
|
131
|
+
"echarts.label.position.scatter.top": "\u9876\u90E8",
|
|
132
|
+
"echarts.label.position.scatter.bottom": "\u5E95\u90E8",
|
|
133
|
+
"echarts.label.position.scatter.left": "\u5DE6\u4FA7",
|
|
134
|
+
"echarts.label.position.scatter.right": "\u53F3\u4FA7",
|
|
135
|
+
"echarts.label.position.scatter.inside": "\u5185\u90E8",
|
|
136
|
+
"echarts.label.position.radar.top": "\u9876\u90E8",
|
|
137
|
+
"echarts.label.position.radar.bottom": "\u5E95\u90E8",
|
|
138
|
+
"echarts.label.position.radar.left": "\u5DE6\u4FA7",
|
|
139
|
+
"echarts.label.position.radar.right": "\u53F3\u4FA7",
|
|
140
|
+
"echarts.label.position.radar.inside": "\u5185\u90E8",
|
|
141
|
+
"echarts.label.position.funnel.outer": "\u5916\u4FA7",
|
|
142
|
+
"echarts.label.position.funnel.inner": "\u5185\u90E8",
|
|
143
|
+
"echarts.label.position.funnel.left": "\u5DE6\u4FA7",
|
|
144
|
+
"echarts.label.position.funnel.right": "\u53F3\u4FA7",
|
|
145
|
+
"echarts.label.position.funnel.top": "\u9876\u90E8",
|
|
146
|
+
"echarts.label.position.funnel.bottom": "\u5E95\u90E8",
|
|
147
|
+
"echarts.meta.chartOption": "\u56FE\u8868 option",
|
|
148
|
+
"echarts.meta.dataSource": "\u6570\u636E\u6E90",
|
|
149
|
+
"echarts.meta.categoryField": "\u7C7B\u76EE\u5B57\u6BB5",
|
|
150
|
+
"echarts.meta.valueFields": "\u6570\u503C\u5B57\u6BB5",
|
|
151
|
+
"echarts.meta.seriesField": "\u7CFB\u5217\u62C6\u5206\u5B57\u6BB5",
|
|
152
|
+
"echarts.meta.bubbleSize": "\u6C14\u6CE1\u5927\u5C0F",
|
|
153
|
+
"echarts.notes.bar": "\u67F1\u72B6\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6BCF\u5B57\u6BB5\u4E00\u4E2A series\uFF1Bseries[].data \u5199 $data \u5360\u4F4D\uFF1B\u56FA\u5B9A\u9AD8\uFF0C\u7981\u6B62 autoHeight",
|
|
154
|
+
"echarts.notes.barH": "\u6A2A\u5411\u6761\u5F62\u56FE\uFF1AxAxis \u4E3A\u6570\u503C\u3001yAxis \u4E3A\u7C7B\u76EE\uFF1B\u7C7B\u76EE\u5199 yAxis.data \u7684 $data \u5360\u4F4D",
|
|
155
|
+
"echarts.notes.line": "\u6298\u7EBF\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF1B\u4E0D\u5199 areaStyle",
|
|
156
|
+
"echarts.notes.area": "\u9762\u79EF\u56FE\uFF1A\u6298\u7EBF + series[].areaStyle\uFF1B\u5176\u4F59\u540C\u6298\u7EBF\u56FE",
|
|
157
|
+
"echarts.notes.pie": "\u997C\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u751F\u6210 { name, value }\uFF1B\u53EA\u9700\u4E00\u4E2A\u6570\u503C\u5B57\u6BB5",
|
|
158
|
+
"echarts.notes.doughnut": "\u73AF\u5F62\u56FE\uFF1A\u997C\u56FE + radius:[\u5185\u5F84,\u5916\u5F84]\uFF1B\u5185\u5F84\u7531\u9762\u677F\u914D\u7F6E",
|
|
159
|
+
"echarts.notes.scatter": "\u6563\u70B9\u56FE\uFF1A\u7C7B\u76EE\u5B57\u6BB5\u4F5C x\u3001\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C y\uFF1BchartBubble \u5F00\u542F\u65F6\u7528\u7B2C\u4E8C\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u70B9\u5927\u5C0F",
|
|
160
|
+
"echarts.notes.radar": "\u96F7\u8FBE\u56FE\uFF1A\u6BCF\u4E2A\u6570\u503C\u5B57\u6BB5\u662F\u4E00\u4E2A\u7EF4\u5EA6\uFF08radar.indicator\uFF09\uFF0C\u6BCF\u884C\u6570\u636E\u662F\u4E00\u4E2A\u7CFB\u5217\uFF08\u7C7B\u76EE\u5B57\u6BB5\u4F5C\u7CFB\u5217\u540D\uFF09\uFF1B\u534A\u5F84\u7531\u9762\u677F\u5199 radar.radius\uFF08%\uFF0C\u9ED8\u8BA4 75\uFF09",
|
|
161
|
+
"echarts.notes.funnel": "\u6F0F\u6597\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6309\u6570\u503C\u964D\u5E8F\uFF1B\u56DB\u8FB9\u5185\u8FB9\u8DDD\u7531\u9762\u677F\u5199 series.left/right/top/bottom\uFF08%\uFF0C\u53F3\u4FA7\u9700\u7559\u5916\u7F6E\u6807\u7B7E\u7A7A\u95F4\uFF09",
|
|
162
|
+
"echarts.notes.gauge": "\u4EEA\u8868\u76D8\uFF1A\u53D6\u9996\u884C\u6570\u636E\u7684\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u6307\u9488\u503C\uFF1Bmin/max \u7531\u9762\u677F\u5199\u5165 series[0].min/max"
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/i18n/en-US.json
|
|
167
|
+
var en_US_default = {
|
|
168
|
+
echarts: {
|
|
169
|
+
"echarts.panel.chart": "Chart",
|
|
170
|
+
"echarts.panel.config": "Config",
|
|
171
|
+
"echarts.panel.dataSource": "Data source",
|
|
172
|
+
"echarts.panel.category": "Category",
|
|
173
|
+
"echarts.panel.value": "Value",
|
|
174
|
+
"echarts.panel.series": "Series",
|
|
175
|
+
"echarts.panel.chartType.bar": "Bar",
|
|
176
|
+
"echarts.panel.chartType.barH": "Horizontal bar",
|
|
177
|
+
"echarts.panel.chartType.line": "Line",
|
|
178
|
+
"echarts.panel.chartType.area": "Area",
|
|
179
|
+
"echarts.panel.chartType.pie": "Pie",
|
|
180
|
+
"echarts.panel.chartType.doughnut": "Doughnut",
|
|
181
|
+
"echarts.panel.chartType.scatter": "Scatter",
|
|
182
|
+
"echarts.panel.chartType.radar": "Radar",
|
|
183
|
+
"echarts.panel.chartType.funnel": "Funnel",
|
|
184
|
+
"echarts.panel.chartType.gauge": "Gauge",
|
|
185
|
+
"echarts.panel.dataLabel": "Data label",
|
|
186
|
+
"echarts.panel.valueLabel": "Value label",
|
|
187
|
+
"echarts.panel.hint.dataBinding": "Data is injected at template binding; keep the `$data` placeholder in series/xAxis data; advanced styles can be written in chartOption in the template JSON.",
|
|
188
|
+
"echarts.panel.field.dimension": "Dimension fields (one per dimension)",
|
|
189
|
+
"echarts.panel.field.value": "Value fields",
|
|
190
|
+
"echarts.panel.field.valueMulti": "Value fields (multiple values, multiple series)",
|
|
191
|
+
"echarts.panel.default": "(default)",
|
|
192
|
+
"echarts.panel.current": "(current)",
|
|
193
|
+
"echarts.panel.defaultFirstArray": "(default: first top-level array)",
|
|
194
|
+
"echarts.panel.error.invalidOption": "Invalid chart option: expected an object",
|
|
195
|
+
"echarts.panel.chartFallback": "Chart",
|
|
196
|
+
"echarts.panel.optionDefault": "(default)",
|
|
197
|
+
"echarts.panel.overflow.default": "Default",
|
|
198
|
+
"echarts.panel.overflow.none": "None (show full)",
|
|
199
|
+
"echarts.panel.overflow.truncate": "Truncate",
|
|
200
|
+
"echarts.panel.overflow.break": "Wrap",
|
|
201
|
+
"echarts.panel.fontWeight.default": "Default",
|
|
202
|
+
"echarts.panel.fontWeight.normal": "Regular",
|
|
203
|
+
"echarts.panel.fontWeight.bold": "Bold",
|
|
204
|
+
"echarts.panel.label.distance": "Distance",
|
|
205
|
+
"echarts.panel.label.rotate": "Rotation (deg)",
|
|
206
|
+
"echarts.panel.label.fontSize": "Font size",
|
|
207
|
+
"echarts.panel.label.fontWeight": "Font weight",
|
|
208
|
+
"echarts.panel.label.color": "Text color",
|
|
209
|
+
"echarts.panel.label.backgroundColor": "Background color",
|
|
210
|
+
"echarts.panel.label.borderColor": "Border color",
|
|
211
|
+
"echarts.panel.label.borderWidth": "Border width",
|
|
212
|
+
"echarts.panel.label.borderRadius": "Radius",
|
|
213
|
+
"echarts.panel.label.padding": "Padding",
|
|
214
|
+
"echarts.panel.label.show": "Show data labels",
|
|
215
|
+
"echarts.panel.label.content": "Content",
|
|
216
|
+
"echarts.panel.label.formatterTitle": "Data label content",
|
|
217
|
+
"echarts.panel.label.formatterCustom": "Custom / Default",
|
|
218
|
+
"echarts.panel.label.formatterPlaceholder": "e.g. {b}: {c}",
|
|
219
|
+
"echarts.panel.label.overflow": "Overflow",
|
|
220
|
+
"echarts.panel.label.position": "Position",
|
|
221
|
+
"echarts.panel.label.positionTitle": "Label position",
|
|
222
|
+
"echarts.panel.label.positionDefault": "Default",
|
|
223
|
+
"echarts.panel.label.offset": "Offset X / Y",
|
|
224
|
+
"echarts.panel.label.style": "Style",
|
|
225
|
+
"echarts.panel.labelLine.fontWeight": "Font weight",
|
|
226
|
+
"echarts.panel.labelLine": "Label line",
|
|
227
|
+
"echarts.panel.labelLine.show": "Show label line",
|
|
228
|
+
"echarts.panel.labelLine.length": "Label line length",
|
|
229
|
+
"echarts.panel.labelLine.length2": "Second segment length",
|
|
230
|
+
"echarts.panel.labelLine.smooth": "Smooth label line",
|
|
231
|
+
"echarts.panel.dataSourceTitle": "Data source",
|
|
232
|
+
"echarts.panel.categoryField": "Category field",
|
|
233
|
+
"echarts.panel.removeField": "Remove this field",
|
|
234
|
+
"echarts.panel.addField": "+ Add field",
|
|
235
|
+
"echarts.panel.seriesField": "Series split field",
|
|
236
|
+
"echarts.panel.seriesFieldHint": "Optional, e.g. region (splits into series by value)",
|
|
237
|
+
"echarts.panel.bubbleSize": "Bubble size",
|
|
238
|
+
"echarts.panel.title": "Chart title",
|
|
239
|
+
"echarts.panel.titleHint": "Leave empty to hide the title",
|
|
240
|
+
"echarts.panel.legend": "Show legend",
|
|
241
|
+
"echarts.panel.palette": "Color palette",
|
|
242
|
+
"echarts.palette.default": "Default blue",
|
|
243
|
+
"echarts.palette.fresh": "Fresh green",
|
|
244
|
+
"echarts.palette.warm": "Warm orange-red",
|
|
245
|
+
"echarts.palette.purple": "Purple grey",
|
|
246
|
+
"echarts.panel.stack": "Stacked",
|
|
247
|
+
"echarts.panel.innerRadius": "Inner radius (%)",
|
|
248
|
+
"echarts.panel.paddingTRBL": "Padding top/right/bottom/left (%)",
|
|
249
|
+
"echarts.panel.paddingTop": "Top padding",
|
|
250
|
+
"echarts.panel.paddingRight": "Right padding (for outer labels)",
|
|
251
|
+
"echarts.panel.paddingBottom": "Bottom padding",
|
|
252
|
+
"echarts.panel.paddingLeft": "Left padding",
|
|
253
|
+
"echarts.panel.radius": "Radius (%)",
|
|
254
|
+
"echarts.panel.minMax": "Min / max",
|
|
255
|
+
"echarts.panel.group": "Chart",
|
|
256
|
+
"echarts.series.typeNames.bar": "Bar chart",
|
|
257
|
+
"echarts.series.typeNames.barH": "Horizontal bar chart",
|
|
258
|
+
"echarts.series.typeNames.line": "Line chart",
|
|
259
|
+
"echarts.series.typeNames.area": "Area chart",
|
|
260
|
+
"echarts.series.typeNames.pie": "Pie chart",
|
|
261
|
+
"echarts.series.typeNames.doughnut": "Doughnut chart",
|
|
262
|
+
"echarts.series.typeNames.scatter": "Scatter chart",
|
|
263
|
+
"echarts.series.typeNames.radar": "Radar chart",
|
|
264
|
+
"echarts.series.typeNames.funnel": "Funnel chart",
|
|
265
|
+
"echarts.series.typeNames.gauge": "Gauge chart",
|
|
266
|
+
"echarts.label.formatter.value": "Value",
|
|
267
|
+
"echarts.label.formatter.nameValue": "Name: Value",
|
|
268
|
+
"echarts.label.formatter.name": "Name",
|
|
269
|
+
"echarts.label.formatter.percent": "Percentage",
|
|
270
|
+
"echarts.label.position.bar.top": "Top",
|
|
271
|
+
"echarts.label.position.bar.inside": "Inside",
|
|
272
|
+
"echarts.label.position.bar.insideTop": "Inside top",
|
|
273
|
+
"echarts.label.position.bar.bottom": "Bottom",
|
|
274
|
+
"echarts.label.position.bar.insideBottom": "Inside bottom",
|
|
275
|
+
"echarts.label.position.bar.right": "Right",
|
|
276
|
+
"echarts.label.position.bar.left": "Left",
|
|
277
|
+
"echarts.label.position.bar.middle": "Center",
|
|
278
|
+
"echarts.label.position.line.top": "Top",
|
|
279
|
+
"echarts.label.position.line.bottom": "Bottom",
|
|
280
|
+
"echarts.label.position.line.inside": "Inside",
|
|
281
|
+
"echarts.label.position.line.left": "Left",
|
|
282
|
+
"echarts.label.position.line.right": "Right",
|
|
283
|
+
"echarts.label.position.pie.outside": "Outside",
|
|
284
|
+
"echarts.label.position.pie.inside": "Inside",
|
|
285
|
+
"echarts.label.position.pie.center": "Center",
|
|
286
|
+
"echarts.label.position.scatter.top": "Top",
|
|
287
|
+
"echarts.label.position.scatter.bottom": "Bottom",
|
|
288
|
+
"echarts.label.position.scatter.left": "Left",
|
|
289
|
+
"echarts.label.position.scatter.right": "Right",
|
|
290
|
+
"echarts.label.position.scatter.inside": "Inside",
|
|
291
|
+
"echarts.label.position.radar.top": "Top",
|
|
292
|
+
"echarts.label.position.radar.bottom": "Bottom",
|
|
293
|
+
"echarts.label.position.radar.left": "Left",
|
|
294
|
+
"echarts.label.position.radar.right": "Right",
|
|
295
|
+
"echarts.label.position.radar.inside": "Inside",
|
|
296
|
+
"echarts.label.position.funnel.outer": "Outside",
|
|
297
|
+
"echarts.label.position.funnel.inner": "Inside",
|
|
298
|
+
"echarts.label.position.funnel.left": "Left",
|
|
299
|
+
"echarts.label.position.funnel.right": "Right",
|
|
300
|
+
"echarts.label.position.funnel.top": "Top",
|
|
301
|
+
"echarts.label.position.funnel.bottom": "Bottom",
|
|
302
|
+
"echarts.meta.chartOption": "Chart option",
|
|
303
|
+
"echarts.meta.dataSource": "Data source",
|
|
304
|
+
"echarts.meta.categoryField": "Category field",
|
|
305
|
+
"echarts.meta.valueFields": "Value fields",
|
|
306
|
+
"echarts.meta.seriesField": "Series split field",
|
|
307
|
+
"echarts.meta.bubbleSize": "Bubble size",
|
|
308
|
+
"echarts.notes.bar": "Bar chart: category + multiple value fields, one series per field; write the $data placeholder in series[].data; fixed height, autoHeight is forbidden",
|
|
309
|
+
"echarts.notes.barH": "Horizontal bar: xAxis is the value axis, yAxis is the category axis; write the $data placeholder in yAxis.data for categories",
|
|
310
|
+
"echarts.notes.line": "Line chart: category + multiple value fields; do not write areaStyle",
|
|
311
|
+
"echarts.notes.area": "Area chart: line + series[].areaStyle; otherwise same as the line chart",
|
|
312
|
+
"echarts.notes.pie": "Pie chart: category + the first value field produce { name, value }; only one value field is needed",
|
|
313
|
+
"echarts.notes.doughnut": "Doughnut: pie + radius:[inner, outer]; the inner radius is configured in the panel",
|
|
314
|
+
"echarts.notes.scatter": "Scatter: the category field is x, the first value field is y; when chartBubble is on, the second value field is the point size",
|
|
315
|
+
"echarts.notes.radar": "Radar: each value field is a dimension (radar.indicator), each data row is a series (the category field is the series name); the radius is written by the panel to radar.radius (%, default 75)",
|
|
316
|
+
"echarts.notes.funnel": "Funnel: category + the first value field, sorted descending; the four insets are written by the panel to series.left/right/top/bottom (%, reserve room on the right for outer labels)",
|
|
317
|
+
"echarts.notes.gauge": "Gauge: the first value field of the first data row is the pointer value; min/max are written by the panel to series[0].min/max"
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// src/i18n/th-TH.json
|
|
322
|
+
var th_TH_default = {
|
|
323
|
+
echarts: {
|
|
324
|
+
"echarts.panel.chart": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34",
|
|
325
|
+
"echarts.panel.config": "\u0E01\u0E32\u0E23\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E04\u0E48\u0E32",
|
|
326
|
+
"echarts.panel.dataSource": "\u0E41\u0E2B\u0E25\u0E48\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
327
|
+
"echarts.panel.category": "\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48",
|
|
328
|
+
"echarts.panel.value": "\u0E04\u0E48\u0E32",
|
|
329
|
+
"echarts.panel.series": "\u0E0A\u0E38\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
330
|
+
"echarts.panel.chartType.bar": "\u0E41\u0E17\u0E48\u0E07",
|
|
331
|
+
"echarts.panel.chartType.barH": "\u0E41\u0E17\u0E48\u0E07\u0E41\u0E19\u0E27\u0E19\u0E2D\u0E19",
|
|
332
|
+
"echarts.panel.chartType.line": "\u0E40\u0E2A\u0E49\u0E19",
|
|
333
|
+
"echarts.panel.chartType.area": "\u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48",
|
|
334
|
+
"echarts.panel.chartType.pie": "\u0E27\u0E07\u0E01\u0E25\u0E21",
|
|
335
|
+
"echarts.panel.chartType.doughnut": "\u0E27\u0E07\u0E01\u0E25\u0E21\u0E27\u0E07\u0E41\u0E2B\u0E27\u0E19",
|
|
336
|
+
"echarts.panel.chartType.scatter": "\u0E08\u0E38\u0E14\u0E01\u0E23\u0E30\u0E08\u0E32\u0E22",
|
|
337
|
+
"echarts.panel.chartType.radar": "\u0E40\u0E23\u0E14\u0E32\u0E23\u0E4C",
|
|
338
|
+
"echarts.panel.chartType.funnel": "\u0E0A\u0E48\u0E2D\u0E07\u0E17\u0E32\u0E07",
|
|
339
|
+
"echarts.panel.chartType.gauge": "\u0E40\u0E01\u0E08\u0E27\u0E31\u0E14",
|
|
340
|
+
"echarts.panel.dataLabel": "\u0E1B\u0E49\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
341
|
+
"echarts.panel.valueLabel": "\u0E1B\u0E49\u0E32\u0E22\u0E04\u0E48\u0E32",
|
|
342
|
+
"echarts.panel.hint.dataBinding": "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E16\u0E39\u0E01\u0E41\u0E17\u0E23\u0E01\u0E15\u0E2D\u0E19\u0E1C\u0E39\u0E01\u0E40\u0E17\u0E21\u0E40\u0E1E\u0E25\u0E15; \u0E04\u0E07\u0E15\u0E31\u0E27\u0E41\u0E17\u0E19 `$data` \u0E44\u0E27\u0E49\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25 series/xAxis; \u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E02\u0E35\u0E22\u0E19\u0E2A\u0E44\u0E15\u0E25\u0E4C\u0E02\u0E31\u0E49\u0E19\u0E2A\u0E39\u0E07\u0E43\u0E19 chartOption \u0E02\u0E2D\u0E07 JSON \u0E40\u0E17\u0E21\u0E40\u0E1E\u0E25\u0E15\u0E44\u0E14\u0E49",
|
|
343
|
+
"echarts.panel.field.dimension": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E21\u0E34\u0E15\u0E34 (\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E15\u0E48\u0E2D\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E21\u0E34\u0E15\u0E34)",
|
|
344
|
+
"echarts.panel.field.value": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32",
|
|
345
|
+
"echarts.panel.field.valueMulti": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32 (\u0E2B\u0E25\u0E32\u0E22\u0E04\u0E48\u0E32 \u0E2B\u0E25\u0E32\u0E22\u0E0A\u0E38\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25)",
|
|
346
|
+
"echarts.panel.default": "(\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19)",
|
|
347
|
+
"echarts.panel.current": "(\u0E1B\u0E31\u0E08\u0E08\u0E38\u0E1A\u0E31\u0E19)",
|
|
348
|
+
"echarts.panel.defaultFirstArray": "(\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19: \u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C\u0E23\u0E30\u0E14\u0E31\u0E1A\u0E1A\u0E19\u0E15\u0E31\u0E27\u0E41\u0E23\u0E01)",
|
|
349
|
+
"echarts.panel.error.invalidOption": "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E32\u0E14\u0E27\u0E48\u0E32\u0E40\u0E1B\u0E47\u0E19\u0E2D\u0E47\u0E2D\u0E1A\u0E40\u0E08\u0E01\u0E15\u0E4C",
|
|
350
|
+
"echarts.panel.chartFallback": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34",
|
|
351
|
+
"echarts.panel.optionDefault": "(\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19)",
|
|
352
|
+
"echarts.panel.overflow.default": "\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
353
|
+
"echarts.panel.overflow.none": "\u0E44\u0E21\u0E48\u0E21\u0E35 (\u0E41\u0E2A\u0E14\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14)",
|
|
354
|
+
"echarts.panel.overflow.truncate": "\u0E15\u0E31\u0E14\u0E17\u0E34\u0E49\u0E07",
|
|
355
|
+
"echarts.panel.overflow.break": "\u0E15\u0E31\u0E14\u0E04\u0E33",
|
|
356
|
+
"echarts.panel.fontWeight.default": "\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
357
|
+
"echarts.panel.fontWeight.normal": "\u0E1B\u0E01\u0E15\u0E34",
|
|
358
|
+
"echarts.panel.fontWeight.bold": "\u0E2B\u0E19\u0E32",
|
|
359
|
+
"echarts.panel.label.distance": "\u0E23\u0E30\u0E22\u0E30\u0E2B\u0E48\u0E32\u0E07",
|
|
360
|
+
"echarts.panel.label.rotate": "\u0E01\u0E32\u0E23\u0E2B\u0E21\u0E38\u0E19 (\u0E2D\u0E07\u0E28\u0E32)",
|
|
361
|
+
"echarts.panel.label.fontSize": "\u0E02\u0E19\u0E32\u0E14\u0E1F\u0E2D\u0E19\u0E15\u0E4C",
|
|
362
|
+
"echarts.panel.label.fontWeight": "\u0E19\u0E49\u0E33\u0E2B\u0E19\u0E31\u0E01\u0E1F\u0E2D\u0E19\u0E15\u0E4C",
|
|
363
|
+
"echarts.panel.label.color": "\u0E2A\u0E35\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21",
|
|
364
|
+
"echarts.panel.label.backgroundColor": "\u0E2A\u0E35\u0E1E\u0E37\u0E49\u0E19\u0E2B\u0E25\u0E31\u0E07",
|
|
365
|
+
"echarts.panel.label.borderColor": "\u0E2A\u0E35\u0E40\u0E2A\u0E49\u0E19\u0E02\u0E2D\u0E1A",
|
|
366
|
+
"echarts.panel.label.borderWidth": "\u0E04\u0E27\u0E32\u0E21\u0E01\u0E27\u0E49\u0E32\u0E07\u0E40\u0E2A\u0E49\u0E19\u0E02\u0E2D\u0E1A",
|
|
367
|
+
"echarts.panel.label.borderRadius": "\u0E23\u0E31\u0E28\u0E21\u0E35",
|
|
368
|
+
"echarts.panel.label.padding": "\u0E23\u0E30\u0E22\u0E30\u0E20\u0E32\u0E22\u0E43\u0E19",
|
|
369
|
+
"echarts.panel.label.show": "\u0E41\u0E2A\u0E14\u0E07\u0E1B\u0E49\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
370
|
+
"echarts.panel.label.content": "\u0E40\u0E19\u0E37\u0E49\u0E2D\u0E2B\u0E32",
|
|
371
|
+
"echarts.panel.label.formatterTitle": "\u0E40\u0E19\u0E37\u0E49\u0E2D\u0E2B\u0E32\u0E1B\u0E49\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
372
|
+
"echarts.panel.label.formatterCustom": "\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E40\u0E2D\u0E07 / \u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
373
|
+
"echarts.panel.label.formatterPlaceholder": "\u0E40\u0E0A\u0E48\u0E19 {b}: {c}",
|
|
374
|
+
"echarts.panel.label.overflow": "\u0E25\u0E49\u0E19",
|
|
375
|
+
"echarts.panel.label.position": "\u0E15\u0E33\u0E41\u0E2B\u0E19\u0E48\u0E07",
|
|
376
|
+
"echarts.panel.label.positionTitle": "\u0E15\u0E33\u0E41\u0E2B\u0E19\u0E48\u0E07\u0E1B\u0E49\u0E32\u0E22",
|
|
377
|
+
"echarts.panel.label.positionDefault": "\u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
378
|
+
"echarts.panel.label.offset": "\u0E2D\u0E2D\u0E1F\u0E40\u0E0B\u0E47\u0E15 X / Y",
|
|
379
|
+
"echarts.panel.label.style": "\u0E2A\u0E44\u0E15\u0E25\u0E4C",
|
|
380
|
+
"echarts.panel.labelLine.fontWeight": "\u0E19\u0E49\u0E33\u0E2B\u0E19\u0E31\u0E01\u0E1F\u0E2D\u0E19\u0E15\u0E4C",
|
|
381
|
+
"echarts.panel.labelLine": "\u0E40\u0E2A\u0E49\u0E19\u0E1B\u0E49\u0E32\u0E22",
|
|
382
|
+
"echarts.panel.labelLine.show": "\u0E41\u0E2A\u0E14\u0E07\u0E40\u0E2A\u0E49\u0E19\u0E1B\u0E49\u0E32\u0E22",
|
|
383
|
+
"echarts.panel.labelLine.length": "\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27\u0E40\u0E2A\u0E49\u0E19\u0E1B\u0E49\u0E32\u0E22",
|
|
384
|
+
"echarts.panel.labelLine.length2": "\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27\u0E17\u0E48\u0E2D\u0E19\u0E17\u0E35\u0E48\u0E2A\u0E2D\u0E07",
|
|
385
|
+
"echarts.panel.labelLine.smooth": "\u0E40\u0E2A\u0E49\u0E19\u0E1B\u0E49\u0E32\u0E22\u0E42\u0E04\u0E49\u0E07",
|
|
386
|
+
"echarts.panel.dataSourceTitle": "\u0E41\u0E2B\u0E25\u0E48\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
387
|
+
"echarts.panel.categoryField": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48",
|
|
388
|
+
"echarts.panel.removeField": "\u0E25\u0E1A\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E19\u0E35\u0E49",
|
|
389
|
+
"echarts.panel.addField": "+ \u0E40\u0E1E\u0E34\u0E48\u0E21\u0E1F\u0E34\u0E25\u0E14\u0E4C",
|
|
390
|
+
"echarts.panel.seriesField": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E41\u0E22\u0E01\u0E0A\u0E38\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
391
|
+
"echarts.panel.seriesFieldHint": "\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A \u0E40\u0E0A\u0E48\u0E19 region (\u0E41\u0E22\u0E01\u0E40\u0E1B\u0E47\u0E19\u0E0A\u0E38\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E15\u0E32\u0E21\u0E04\u0E48\u0E32)",
|
|
392
|
+
"echarts.panel.bubbleSize": "\u0E02\u0E19\u0E32\u0E14\u0E1F\u0E2D\u0E07",
|
|
393
|
+
"echarts.panel.title": "\u0E0A\u0E37\u0E48\u0E2D\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34",
|
|
394
|
+
"echarts.panel.titleHint": "\u0E40\u0E27\u0E49\u0E19\u0E27\u0E48\u0E32\u0E07\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E0B\u0E48\u0E2D\u0E19\u0E0A\u0E37\u0E48\u0E2D",
|
|
395
|
+
"echarts.panel.legend": "\u0E41\u0E2A\u0E14\u0E07\u0E04\u0E33\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22",
|
|
396
|
+
"echarts.panel.palette": "\u0E0A\u0E38\u0E14\u0E2A\u0E35",
|
|
397
|
+
"echarts.palette.default": "\u0E2A\u0E35\u0E19\u0E49\u0E33\u0E40\u0E07\u0E34\u0E19\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19",
|
|
398
|
+
"echarts.palette.fresh": "\u0E2A\u0E35\u0E40\u0E02\u0E35\u0E22\u0E27\u0E2A\u0E14\u0E0A\u0E37\u0E48\u0E19",
|
|
399
|
+
"echarts.palette.warm": "\u0E2A\u0E35\u0E2A\u0E49\u0E21\u0E41\u0E14\u0E07\u0E2D\u0E1A\u0E2D\u0E38\u0E48\u0E19",
|
|
400
|
+
"echarts.palette.purple": "\u0E2A\u0E35\u0E21\u0E39\u0E1F\u0E40\u0E17\u0E32",
|
|
401
|
+
"echarts.panel.stack": "\u0E0B\u0E49\u0E2D\u0E19\u0E01\u0E31\u0E19",
|
|
402
|
+
"echarts.panel.innerRadius": "\u0E23\u0E31\u0E28\u0E21\u0E35\u0E43\u0E19 (%)",
|
|
403
|
+
"echarts.panel.paddingTRBL": "\u0E23\u0E30\u0E22\u0E30\u0E1A\u0E19/\u0E02\u0E27\u0E32/\u0E25\u0E48\u0E32\u0E07/\u0E0B\u0E49\u0E32\u0E22 (%)",
|
|
404
|
+
"echarts.panel.paddingTop": "\u0E23\u0E30\u0E22\u0E30\u0E1A\u0E19",
|
|
405
|
+
"echarts.panel.paddingRight": "\u0E23\u0E30\u0E22\u0E30\u0E02\u0E27\u0E32 (\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E1B\u0E49\u0E32\u0E22\u0E14\u0E49\u0E32\u0E19\u0E19\u0E2D\u0E01)",
|
|
406
|
+
"echarts.panel.paddingBottom": "\u0E23\u0E30\u0E22\u0E30\u0E25\u0E48\u0E32\u0E07",
|
|
407
|
+
"echarts.panel.paddingLeft": "\u0E23\u0E30\u0E22\u0E30\u0E0B\u0E49\u0E32\u0E22",
|
|
408
|
+
"echarts.panel.radius": "\u0E23\u0E31\u0E28\u0E21\u0E35 (%)",
|
|
409
|
+
"echarts.panel.minMax": "\u0E15\u0E48\u0E33\u0E2A\u0E38\u0E14 / \u0E2A\u0E39\u0E07\u0E2A\u0E38\u0E14",
|
|
410
|
+
"echarts.panel.group": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34",
|
|
411
|
+
"echarts.series.typeNames.bar": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07",
|
|
412
|
+
"echarts.series.typeNames.barH": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07\u0E41\u0E19\u0E27\u0E19\u0E2D\u0E19",
|
|
413
|
+
"echarts.series.typeNames.line": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E2A\u0E49\u0E19",
|
|
414
|
+
"echarts.series.typeNames.area": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48",
|
|
415
|
+
"echarts.series.typeNames.pie": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E27\u0E07\u0E01\u0E25\u0E21",
|
|
416
|
+
"echarts.series.typeNames.doughnut": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E27\u0E07\u0E01\u0E25\u0E21\u0E27\u0E07\u0E41\u0E2B\u0E27\u0E19",
|
|
417
|
+
"echarts.series.typeNames.scatter": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E01\u0E23\u0E30\u0E08\u0E32\u0E22",
|
|
418
|
+
"echarts.series.typeNames.radar": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E23\u0E14\u0E32\u0E23\u0E4C",
|
|
419
|
+
"echarts.series.typeNames.funnel": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E0A\u0E48\u0E2D\u0E07\u0E17\u0E32\u0E07",
|
|
420
|
+
"echarts.series.typeNames.gauge": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E01\u0E08\u0E27\u0E31\u0E14",
|
|
421
|
+
"echarts.label.formatter.value": "\u0E04\u0E48\u0E32",
|
|
422
|
+
"echarts.label.formatter.nameValue": "\u0E0A\u0E37\u0E48\u0E2D: \u0E04\u0E48\u0E32",
|
|
423
|
+
"echarts.label.formatter.name": "\u0E0A\u0E37\u0E48\u0E2D",
|
|
424
|
+
"echarts.label.formatter.percent": "\u0E40\u0E1B\u0E2D\u0E23\u0E4C\u0E40\u0E0B\u0E47\u0E19\u0E15\u0E4C",
|
|
425
|
+
"echarts.label.position.bar.top": "\u0E1A\u0E19",
|
|
426
|
+
"echarts.label.position.bar.inside": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19",
|
|
427
|
+
"echarts.label.position.bar.insideTop": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19\u0E1A\u0E19",
|
|
428
|
+
"echarts.label.position.bar.bottom": "\u0E25\u0E48\u0E32\u0E07",
|
|
429
|
+
"echarts.label.position.bar.insideBottom": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19\u0E25\u0E48\u0E32\u0E07",
|
|
430
|
+
"echarts.label.position.bar.right": "\u0E02\u0E27\u0E32",
|
|
431
|
+
"echarts.label.position.bar.left": "\u0E0B\u0E49\u0E32\u0E22",
|
|
432
|
+
"echarts.label.position.bar.middle": "\u0E01\u0E25\u0E32\u0E07",
|
|
433
|
+
"echarts.label.position.line.top": "\u0E1A\u0E19",
|
|
434
|
+
"echarts.label.position.line.bottom": "\u0E25\u0E48\u0E32\u0E07",
|
|
435
|
+
"echarts.label.position.line.inside": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19",
|
|
436
|
+
"echarts.label.position.line.left": "\u0E0B\u0E49\u0E32\u0E22",
|
|
437
|
+
"echarts.label.position.line.right": "\u0E02\u0E27\u0E32",
|
|
438
|
+
"echarts.label.position.pie.outside": "\u0E14\u0E49\u0E32\u0E19\u0E19\u0E2D\u0E01",
|
|
439
|
+
"echarts.label.position.pie.inside": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19",
|
|
440
|
+
"echarts.label.position.pie.center": "\u0E01\u0E25\u0E32\u0E07",
|
|
441
|
+
"echarts.label.position.scatter.top": "\u0E1A\u0E19",
|
|
442
|
+
"echarts.label.position.scatter.bottom": "\u0E25\u0E48\u0E32\u0E07",
|
|
443
|
+
"echarts.label.position.scatter.left": "\u0E0B\u0E49\u0E32\u0E22",
|
|
444
|
+
"echarts.label.position.scatter.right": "\u0E02\u0E27\u0E32",
|
|
445
|
+
"echarts.label.position.scatter.inside": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19",
|
|
446
|
+
"echarts.label.position.radar.top": "\u0E1A\u0E19",
|
|
447
|
+
"echarts.label.position.radar.bottom": "\u0E25\u0E48\u0E32\u0E07",
|
|
448
|
+
"echarts.label.position.radar.left": "\u0E0B\u0E49\u0E32\u0E22",
|
|
449
|
+
"echarts.label.position.radar.right": "\u0E02\u0E27\u0E32",
|
|
450
|
+
"echarts.label.position.radar.inside": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19",
|
|
451
|
+
"echarts.label.position.funnel.outer": "\u0E14\u0E49\u0E32\u0E19\u0E19\u0E2D\u0E01",
|
|
452
|
+
"echarts.label.position.funnel.inner": "\u0E14\u0E49\u0E32\u0E19\u0E43\u0E19",
|
|
453
|
+
"echarts.label.position.funnel.left": "\u0E0B\u0E49\u0E32\u0E22",
|
|
454
|
+
"echarts.label.position.funnel.right": "\u0E02\u0E27\u0E32",
|
|
455
|
+
"echarts.label.position.funnel.top": "\u0E1A\u0E19",
|
|
456
|
+
"echarts.label.position.funnel.bottom": "\u0E25\u0E48\u0E32\u0E07",
|
|
457
|
+
"echarts.meta.chartOption": "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34",
|
|
458
|
+
"echarts.meta.dataSource": "\u0E41\u0E2B\u0E25\u0E48\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
459
|
+
"echarts.meta.categoryField": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48",
|
|
460
|
+
"echarts.meta.valueFields": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32",
|
|
461
|
+
"echarts.meta.seriesField": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E41\u0E22\u0E01\u0E0A\u0E38\u0E14\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
|
|
462
|
+
"echarts.meta.bubbleSize": "\u0E02\u0E19\u0E32\u0E14\u0E1F\u0E2D\u0E07",
|
|
463
|
+
"echarts.notes.bar": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E41\u0E17\u0E48\u0E07: \u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48 + \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E2B\u0E25\u0E32\u0E22\u0E15\u0E31\u0E27 \u0E2B\u0E19\u0E36\u0E48\u0E07\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E15\u0E48\u0E2D\u0E2B\u0E19\u0E36\u0E48\u0E07 series; \u0E40\u0E02\u0E35\u0E22\u0E19\u0E15\u0E31\u0E27\u0E41\u0E17\u0E19 $data \u0E43\u0E19 series[].data; \u0E04\u0E27\u0E32\u0E21\u0E2A\u0E39\u0E07\u0E04\u0E07\u0E17\u0E35\u0E48 \u0E2B\u0E49\u0E32\u0E21\u0E43\u0E0A\u0E49 autoHeight",
|
|
464
|
+
"echarts.notes.barH": "\u0E41\u0E17\u0E48\u0E07\u0E41\u0E19\u0E27\u0E19\u0E2D\u0E19: xAxis \u0E40\u0E1B\u0E47\u0E19\u0E41\u0E01\u0E19\u0E04\u0E48\u0E32 yAxis \u0E40\u0E1B\u0E47\u0E19\u0E41\u0E01\u0E19\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48; \u0E40\u0E02\u0E35\u0E22\u0E19\u0E15\u0E31\u0E27\u0E41\u0E17\u0E19 $data \u0E43\u0E19 yAxis.data \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48",
|
|
465
|
+
"echarts.notes.line": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E2A\u0E49\u0E19: \u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48 + \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E2B\u0E25\u0E32\u0E22\u0E15\u0E31\u0E27; \u0E44\u0E21\u0E48\u0E40\u0E02\u0E35\u0E22\u0E19 areaStyle",
|
|
466
|
+
"echarts.notes.area": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48: \u0E40\u0E2A\u0E49\u0E19 + series[].areaStyle; \u0E19\u0E2D\u0E01\u0E19\u0E31\u0E49\u0E19\u0E40\u0E2B\u0E21\u0E37\u0E2D\u0E19\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E2A\u0E49\u0E19",
|
|
467
|
+
"echarts.notes.pie": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E27\u0E07\u0E01\u0E25\u0E21: \u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48 + \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E41\u0E23\u0E01\u0E2A\u0E23\u0E49\u0E32\u0E07 { name, value }; \u0E15\u0E49\u0E2D\u0E07\u0E01\u0E32\u0E23\u0E40\u0E1E\u0E35\u0E22\u0E07\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32",
|
|
468
|
+
"echarts.notes.doughnut": "\u0E27\u0E07\u0E01\u0E25\u0E21\u0E27\u0E07\u0E41\u0E2B\u0E27\u0E19: \u0E27\u0E07\u0E01\u0E25\u0E21 + radius:[\u0E23\u0E31\u0E28\u0E21\u0E35\u0E43\u0E19, \u0E23\u0E31\u0E28\u0E21\u0E35\u0E19\u0E2D\u0E01]; \u0E23\u0E31\u0E28\u0E21\u0E35\u0E43\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E43\u0E19\u0E41\u0E1C\u0E07",
|
|
469
|
+
"echarts.notes.scatter": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E01\u0E23\u0E30\u0E08\u0E32\u0E22: \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48\u0E40\u0E1B\u0E47\u0E19 x \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E41\u0E23\u0E01\u0E40\u0E1B\u0E47\u0E19 y; \u0E40\u0E21\u0E37\u0E48\u0E2D\u0E40\u0E1B\u0E34\u0E14 chartBubble \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E17\u0E35\u0E48\u0E2A\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E02\u0E19\u0E32\u0E14\u0E08\u0E38\u0E14",
|
|
470
|
+
"echarts.notes.radar": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E23\u0E14\u0E32\u0E23\u0E4C: \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E17\u0E38\u0E01\u0E15\u0E31\u0E27\u0E04\u0E37\u0E2D\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E21\u0E34\u0E15\u0E34 (radar.indicator) \u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E41\u0E15\u0E48\u0E25\u0E30\u0E41\u0E16\u0E27\u0E04\u0E37\u0E2D\u0E2B\u0E19\u0E36\u0E48\u0E07 series (\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48\u0E40\u0E1B\u0E47\u0E19\u0E0A\u0E37\u0E48\u0E2D series); \u0E23\u0E31\u0E28\u0E21\u0E35\u0E40\u0E02\u0E35\u0E22\u0E19\u0E42\u0E14\u0E22\u0E41\u0E1C\u0E07\u0E44\u0E1B\u0E17\u0E35\u0E48 radar.radius (%, \u0E04\u0E48\u0E32\u0E40\u0E23\u0E34\u0E48\u0E21\u0E15\u0E49\u0E19 75)",
|
|
471
|
+
"echarts.notes.funnel": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E0A\u0E48\u0E2D\u0E07\u0E17\u0E32\u0E07: \u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48 + \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E41\u0E23\u0E01 \u0E40\u0E23\u0E35\u0E22\u0E07\u0E15\u0E32\u0E21\u0E04\u0E48\u0E32\u0E25\u0E07\u0E21\u0E32; \u0E23\u0E30\u0E22\u0E30\u0E20\u0E32\u0E22\u0E43\u0E19\u0E2A\u0E35\u0E48\u0E14\u0E49\u0E32\u0E19\u0E40\u0E02\u0E35\u0E22\u0E19\u0E42\u0E14\u0E22\u0E41\u0E1C\u0E07\u0E44\u0E1B\u0E17\u0E35\u0E48 series.left/right/top/bottom (%, \u0E40\u0E1C\u0E37\u0E48\u0E2D\u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48\u0E14\u0E49\u0E32\u0E19\u0E02\u0E27\u0E32\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A\u0E1B\u0E49\u0E32\u0E22\u0E14\u0E49\u0E32\u0E19\u0E19\u0E2D\u0E01)",
|
|
472
|
+
"echarts.notes.gauge": "\u0E41\u0E1C\u0E19\u0E20\u0E39\u0E21\u0E34\u0E40\u0E01\u0E08\u0E27\u0E31\u0E14: \u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E04\u0E48\u0E32\u0E15\u0E31\u0E27\u0E41\u0E23\u0E01\u0E02\u0E2D\u0E07\u0E41\u0E16\u0E27\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E41\u0E23\u0E01\u0E40\u0E1B\u0E47\u0E19\u0E04\u0E48\u0E32\u0E1C\u0E25\u0E31\u0E01\u0E14\u0E31\u0E19; min/max \u0E40\u0E02\u0E35\u0E22\u0E19\u0E42\u0E14\u0E22\u0E41\u0E1C\u0E07\u0E44\u0E1B\u0E17\u0E35\u0E48 series[0].min/max"
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
|
|
8
476
|
// src/ui.ts
|
|
9
477
|
import { defineElementUI, registerElementUI } from "@worm-print-platform/plugin-kit";
|
|
478
|
+
import { render } from "@worm-print-platform/plugin-kit/dom";
|
|
479
|
+
import { colorPicker } from "@worm-print-platform/plugin-kit/controls";
|
|
480
|
+
|
|
481
|
+
// src/plugin.ts
|
|
482
|
+
import { t } from "@worm-print-platform/core/i18n";
|
|
483
|
+
import {
|
|
484
|
+
defineElementPlugin,
|
|
485
|
+
getElementPluginById,
|
|
486
|
+
registerElementPlugin
|
|
487
|
+
} from "@worm-print-platform/core/designer";
|
|
488
|
+
|
|
489
|
+
// src/kinds.ts
|
|
490
|
+
var BASE_REQUIRED = ["left", "top", "width", "height", "chartOption"];
|
|
491
|
+
var DATA_FIELDS = ["dataSource", "categoryField", "valueFields", "seriesField"];
|
|
492
|
+
var STYLE_FIELDS = ["title", "legend", "palette"];
|
|
493
|
+
var CHART_KIND_DEFINITIONS = [
|
|
494
|
+
{
|
|
495
|
+
type: "barChart",
|
|
496
|
+
label: "\u67F1\u72B6\u56FE",
|
|
497
|
+
labelKey: "echarts.series.typeNames.bar",
|
|
498
|
+
icon: "ChartColumn",
|
|
499
|
+
seriesType: "bar",
|
|
500
|
+
orientation: "vertical",
|
|
501
|
+
fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
|
|
502
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
503
|
+
defaultWidth: 100,
|
|
504
|
+
defaultHeight: 60,
|
|
505
|
+
notes: "\u67F1\u72B6\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6BCF\u5B57\u6BB5\u4E00\u4E2A series\uFF1Bseries[].data \u5199 $data \u5360\u4F4D\uFF1B\u56FA\u5B9A\u9AD8\uFF0C\u7981\u6B62 autoHeight",
|
|
506
|
+
notesKey: "echarts.notes.bar"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
type: "barHChart",
|
|
510
|
+
label: "\u6761\u5F62\u56FE",
|
|
511
|
+
labelKey: "echarts.series.typeNames.barH",
|
|
512
|
+
icon: "ChartBar",
|
|
513
|
+
seriesType: "bar",
|
|
514
|
+
orientation: "horizontal",
|
|
515
|
+
fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
|
|
516
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
517
|
+
defaultWidth: 100,
|
|
518
|
+
defaultHeight: 60,
|
|
519
|
+
notes: "\u6A2A\u5411\u6761\u5F62\u56FE\uFF1AxAxis \u4E3A\u6570\u503C\u3001yAxis \u4E3A\u7C7B\u76EE\uFF1B\u7C7B\u76EE\u5199 yAxis.data \u7684 $data \u5360\u4F4D",
|
|
520
|
+
notesKey: "echarts.notes.barH"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
type: "lineChart",
|
|
524
|
+
label: "\u6298\u7EBF\u56FE",
|
|
525
|
+
labelKey: "echarts.series.typeNames.line",
|
|
526
|
+
icon: "ChartLine",
|
|
527
|
+
seriesType: "line",
|
|
528
|
+
fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
|
|
529
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
530
|
+
defaultWidth: 100,
|
|
531
|
+
defaultHeight: 60,
|
|
532
|
+
notes: "\u6298\u7EBF\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF1B\u4E0D\u5199 areaStyle",
|
|
533
|
+
notesKey: "echarts.notes.line"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: "areaChart",
|
|
537
|
+
label: "\u9762\u79EF\u56FE",
|
|
538
|
+
labelKey: "echarts.series.typeNames.area",
|
|
539
|
+
icon: "ChartArea",
|
|
540
|
+
seriesType: "line",
|
|
541
|
+
fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
|
|
542
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
543
|
+
defaultWidth: 100,
|
|
544
|
+
defaultHeight: 60,
|
|
545
|
+
notes: "\u9762\u79EF\u56FE\uFF1A\u6298\u7EBF + series[].areaStyle\uFF1B\u5176\u4F59\u540C\u6298\u7EBF\u56FE",
|
|
546
|
+
notesKey: "echarts.notes.area"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
type: "pieChart",
|
|
550
|
+
label: "\u997C\u56FE",
|
|
551
|
+
labelKey: "echarts.series.typeNames.pie",
|
|
552
|
+
icon: "ChartPie",
|
|
553
|
+
seriesType: "pie",
|
|
554
|
+
fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "label"],
|
|
555
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
556
|
+
defaultWidth: 60,
|
|
557
|
+
defaultHeight: 60,
|
|
558
|
+
notes: "\u997C\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u751F\u6210 { name, value }\uFF1B\u53EA\u9700\u4E00\u4E2A\u6570\u503C\u5B57\u6BB5",
|
|
559
|
+
notesKey: "echarts.notes.pie"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
type: "doughnutChart",
|
|
563
|
+
label: "\u73AF\u5F62\u56FE",
|
|
564
|
+
labelKey: "echarts.series.typeNames.doughnut",
|
|
565
|
+
icon: "Donut",
|
|
566
|
+
seriesType: "pie",
|
|
567
|
+
fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "innerRadius", "label"],
|
|
568
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
569
|
+
defaultWidth: 60,
|
|
570
|
+
defaultHeight: 60,
|
|
571
|
+
notes: "\u73AF\u5F62\u56FE\uFF1A\u997C\u56FE + radius:[\u5185\u5F84,\u5916\u5F84]\uFF1B\u5185\u5F84\u7531\u9762\u677F\u914D\u7F6E",
|
|
572
|
+
notesKey: "echarts.notes.doughnut"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
type: "scatterChart",
|
|
576
|
+
label: "\u6563\u70B9\u56FE",
|
|
577
|
+
labelKey: "echarts.series.typeNames.scatter",
|
|
578
|
+
icon: "ChartScatter",
|
|
579
|
+
seriesType: "scatter",
|
|
580
|
+
fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "bubble", "label"],
|
|
581
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
582
|
+
defaultWidth: 80,
|
|
583
|
+
defaultHeight: 60,
|
|
584
|
+
notes: "\u6563\u70B9\u56FE\uFF1A\u7C7B\u76EE\u5B57\u6BB5\u4F5C x\u3001\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C y\uFF1BchartBubble \u5F00\u542F\u65F6\u7528\u7B2C\u4E8C\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u70B9\u5927\u5C0F",
|
|
585
|
+
notesKey: "echarts.notes.scatter"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
type: "radarChart",
|
|
589
|
+
label: "\u96F7\u8FBE\u56FE",
|
|
590
|
+
labelKey: "echarts.series.typeNames.radar",
|
|
591
|
+
icon: "Radar",
|
|
592
|
+
seriesType: "radar",
|
|
593
|
+
fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "radius", "label"],
|
|
594
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
595
|
+
defaultWidth: 70,
|
|
596
|
+
defaultHeight: 60,
|
|
597
|
+
notes: "\u96F7\u8FBE\u56FE\uFF1A\u6BCF\u4E2A\u6570\u503C\u5B57\u6BB5\u662F\u4E00\u4E2A\u7EF4\u5EA6\uFF08radar.indicator\uFF09\uFF0C\u6BCF\u884C\u6570\u636E\u662F\u4E00\u4E2A\u7CFB\u5217\uFF08\u7C7B\u76EE\u5B57\u6BB5\u4F5C\u7CFB\u5217\u540D\uFF09\uFF1B\u534A\u5F84\u7531\u9762\u677F\u5199 radar.radius\uFF08%\uFF0C\u9ED8\u8BA4 75\uFF09",
|
|
598
|
+
notesKey: "echarts.notes.radar"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
type: "funnelChart",
|
|
602
|
+
label: "\u6F0F\u6597\u56FE",
|
|
603
|
+
labelKey: "echarts.series.typeNames.funnel",
|
|
604
|
+
icon: "Funnel",
|
|
605
|
+
seriesType: "funnel",
|
|
606
|
+
fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "padding", "label"],
|
|
607
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
608
|
+
defaultWidth: 60,
|
|
609
|
+
defaultHeight: 60,
|
|
610
|
+
notes: "\u6F0F\u6597\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6309\u6570\u503C\u964D\u5E8F\uFF1B\u56DB\u8FB9\u5185\u8FB9\u8DDD\u7531\u9762\u677F\u5199 series.left/right/top/bottom\uFF08%\uFF0C\u53F3\u4FA7\u9700\u7559\u5916\u7F6E\u6807\u7B7E\u7A7A\u95F4\uFF09",
|
|
611
|
+
notesKey: "echarts.notes.funnel"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
type: "gaugeChart",
|
|
615
|
+
label: "\u4EEA\u8868\u76D8",
|
|
616
|
+
labelKey: "echarts.series.typeNames.gauge",
|
|
617
|
+
icon: "Gauge",
|
|
618
|
+
seriesType: "gauge",
|
|
619
|
+
fields: ["dataSource", "valueFields", ...STYLE_FIELDS, "gaugeRange", "label"],
|
|
620
|
+
requiredOptionKeys: BASE_REQUIRED,
|
|
621
|
+
defaultWidth: 60,
|
|
622
|
+
defaultHeight: 60,
|
|
623
|
+
notes: "\u4EEA\u8868\u76D8\uFF1A\u53D6\u9996\u884C\u6570\u636E\u7684\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u6307\u9488\u503C\uFF1Bmin/max \u7531\u9762\u677F\u5199\u5165 series[0].min/max",
|
|
624
|
+
notesKey: "echarts.notes.gauge"
|
|
625
|
+
}
|
|
626
|
+
];
|
|
627
|
+
var CHART_KINDS = CHART_KIND_DEFINITIONS.map((def) => def.type);
|
|
628
|
+
function getChartKindDefinition(type) {
|
|
629
|
+
return CHART_KIND_DEFINITIONS.find((def) => def.type === type);
|
|
630
|
+
}
|
|
631
|
+
function resolveChartPanelFields(type) {
|
|
632
|
+
return getChartKindDefinition(type)?.fields ?? [];
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/bind.ts
|
|
636
|
+
import { evaluateTemplate } from "@worm-print-platform/core";
|
|
637
|
+
function chartNumber(value) {
|
|
638
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
639
|
+
return Number.isFinite(n) ? n : 0;
|
|
640
|
+
}
|
|
641
|
+
function evaluateChartOption(node, data, keepStrings = false) {
|
|
642
|
+
if (typeof node === "string") {
|
|
643
|
+
if (node.startsWith("$data")) return node;
|
|
644
|
+
if (keepStrings) return node;
|
|
645
|
+
return node.includes("{") ? evaluateTemplate(node, data) : node;
|
|
646
|
+
}
|
|
647
|
+
if (Array.isArray(node)) return node.map((item) => evaluateChartOption(item, data, keepStrings));
|
|
648
|
+
if (node && typeof node === "object") {
|
|
649
|
+
const out = {};
|
|
650
|
+
for (const [key, value] of Object.entries(node)) {
|
|
651
|
+
const childKeep = keepStrings || key === "label" || key === "detail";
|
|
652
|
+
out[key] = evaluateChartOption(value, data, childKeep);
|
|
653
|
+
}
|
|
654
|
+
return out;
|
|
655
|
+
}
|
|
656
|
+
return node;
|
|
657
|
+
}
|
|
658
|
+
function hasDataPlaceholder(series) {
|
|
659
|
+
return Array.isArray(series.data) && series.data.includes("$data");
|
|
660
|
+
}
|
|
661
|
+
function resolveListSource(options, data) {
|
|
662
|
+
const explicit = options.dataSource;
|
|
663
|
+
if (typeof explicit === "string" && Array.isArray(data[explicit])) return data[explicit];
|
|
664
|
+
for (const value of Object.values(data)) {
|
|
665
|
+
if (Array.isArray(value)) return value;
|
|
666
|
+
}
|
|
667
|
+
return [];
|
|
668
|
+
}
|
|
669
|
+
function asString(value) {
|
|
670
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
671
|
+
}
|
|
672
|
+
function asFieldList(value) {
|
|
673
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string" && item.length > 0) : [];
|
|
674
|
+
}
|
|
675
|
+
function seriesOf(option) {
|
|
676
|
+
return Array.isArray(option.series) ? option.series : [];
|
|
677
|
+
}
|
|
678
|
+
function rowValue(row, field2) {
|
|
679
|
+
return field2 ? chartNumber(row[field2]) : 0;
|
|
680
|
+
}
|
|
681
|
+
function writeCategories(option, categories) {
|
|
682
|
+
for (const key of ["xAxis", "yAxis"]) {
|
|
683
|
+
const raw = option[key];
|
|
684
|
+
const axes = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
|
685
|
+
for (const axis of axes) {
|
|
686
|
+
if (axis && typeof axis === "object" && Array.isArray(axis.data) && axis.data.includes("$data")) {
|
|
687
|
+
axis.data = [...categories];
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
function applyCartesian(option, rows, categoryField, valueFields, seriesField) {
|
|
693
|
+
const rawSeries = seriesOf(option);
|
|
694
|
+
if (!rawSeries.some(hasDataPlaceholder)) return;
|
|
695
|
+
const categories = rows.map((row, index) => categoryField ? row[categoryField] : index + 1);
|
|
696
|
+
const fieldAt = (index) => valueFields[Math.min(index, valueFields.length - 1)];
|
|
697
|
+
if (seriesField) {
|
|
698
|
+
const template2 = rawSeries[0];
|
|
699
|
+
const groups = /* @__PURE__ */ new Map();
|
|
700
|
+
for (const row of rows) {
|
|
701
|
+
const name = String(row[seriesField] ?? "");
|
|
702
|
+
const bucket = groups.get(name) ?? /* @__PURE__ */ new Map();
|
|
703
|
+
const category = String(row[categoryField ?? ""]);
|
|
704
|
+
bucket.set(category, (bucket.get(category) ?? 0) + rowValue(row, fieldAt(0)));
|
|
705
|
+
groups.set(name, bucket);
|
|
706
|
+
}
|
|
707
|
+
const distinctCategories = [...new Set(categories)];
|
|
708
|
+
option.series = [...groups.entries()].map(([name, bucket]) => ({
|
|
709
|
+
...template2,
|
|
710
|
+
name,
|
|
711
|
+
data: distinctCategories.map((category) => bucket.get(String(category)) ?? null)
|
|
712
|
+
}));
|
|
713
|
+
writeCategories(option, distinctCategories);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
const template = rawSeries[rawSeries.length - 1];
|
|
717
|
+
while (rawSeries.length < valueFields.length) rawSeries.push({ ...template, data: ["$data"] });
|
|
718
|
+
option.series = rawSeries.map((series, index) => {
|
|
719
|
+
if (!hasDataPlaceholder(series)) return series;
|
|
720
|
+
return { ...series, data: rows.map((row) => rowValue(row, fieldAt(index))) };
|
|
721
|
+
});
|
|
722
|
+
writeCategories(option, categories);
|
|
723
|
+
}
|
|
724
|
+
function applyPieLike(option, rows, categoryField, valueField, sortDescending) {
|
|
725
|
+
const series = seriesOf(option);
|
|
726
|
+
if (!series.some(hasDataPlaceholder)) return;
|
|
727
|
+
const data = rows.map((row) => ({
|
|
728
|
+
name: categoryField ? String(row[categoryField] ?? "") : "",
|
|
729
|
+
value: rowValue(row, valueField)
|
|
730
|
+
}));
|
|
731
|
+
if (sortDescending) data.sort((a, b) => b.value - a.value);
|
|
732
|
+
option.series = series.map((item) => ({ ...item, data }));
|
|
733
|
+
}
|
|
734
|
+
function applyScatter(option, rows, xField, valueFields, bubble) {
|
|
735
|
+
const series = seriesOf(option);
|
|
736
|
+
if (!series.some(hasDataPlaceholder)) return;
|
|
737
|
+
const yField = valueFields[0];
|
|
738
|
+
const sizeField = bubble ? valueFields[1] : void 0;
|
|
739
|
+
const sizes = sizeField ? rows.map((row) => rowValue(row, sizeField)) : [];
|
|
740
|
+
const min = sizes.length > 0 ? Math.min(...sizes) : 0;
|
|
741
|
+
const max = sizes.length > 0 ? Math.max(...sizes) : 0;
|
|
742
|
+
const sizeOf = (value) => max === min ? 12 : Math.round(6 + (value - min) / (max - min) * 18);
|
|
743
|
+
option.series = series.map((item) => ({
|
|
744
|
+
...item,
|
|
745
|
+
data: rows.map((row) => {
|
|
746
|
+
const value = [rowValue(row, xField), rowValue(row, yField)];
|
|
747
|
+
if (!sizeField) return value;
|
|
748
|
+
return { value, symbolSize: sizeOf(rowValue(row, sizeField)) };
|
|
749
|
+
})
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
function niceMax(value) {
|
|
753
|
+
if (value <= 0) return 10;
|
|
754
|
+
const magnitude = 10 ** Math.floor(Math.log10(value));
|
|
755
|
+
const step = magnitude >= 10 ? magnitude : 10;
|
|
756
|
+
return Math.ceil(value / step) * step;
|
|
757
|
+
}
|
|
758
|
+
function applyRadar(option, rows, categoryField, valueFields) {
|
|
759
|
+
const series = seriesOf(option);
|
|
760
|
+
if (!series.some(hasDataPlaceholder)) return;
|
|
761
|
+
const columnMax = valueFields.map((field2) => Math.max(0, ...rows.map((row) => rowValue(row, field2))));
|
|
762
|
+
option.radar = {
|
|
763
|
+
...option.radar ?? {},
|
|
764
|
+
// 维度 = 数值字段;max 取该列最大值上浮取整
|
|
765
|
+
indicator: valueFields.map((field2, index) => ({ name: field2, max: niceMax(columnMax[index]) }))
|
|
766
|
+
};
|
|
767
|
+
option.series = series.map((item) => ({
|
|
768
|
+
...item,
|
|
769
|
+
data: rows.map((row) => ({
|
|
770
|
+
name: categoryField ? String(row[categoryField] ?? "") : "",
|
|
771
|
+
value: valueFields.map((field2) => rowValue(row, field2))
|
|
772
|
+
}))
|
|
773
|
+
}));
|
|
774
|
+
}
|
|
775
|
+
function applyGauge(option, rows, valueField) {
|
|
776
|
+
const series = seriesOf(option);
|
|
777
|
+
if (!series.some(hasDataPlaceholder)) return;
|
|
778
|
+
const first = rows[0] ?? {};
|
|
779
|
+
option.series = series.map((item) => ({ ...item, data: [{ value: rowValue(first, valueField), name: valueField }] }));
|
|
780
|
+
}
|
|
781
|
+
function bindChartData(type, options, data) {
|
|
782
|
+
const raw = options.chartOption;
|
|
783
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
784
|
+
const option = evaluateChartOption(raw, data);
|
|
785
|
+
const valueFields = asFieldList(options.chartValueFields);
|
|
786
|
+
if (valueFields.length === 0) return { _chartOption: option };
|
|
787
|
+
const list = resolveListSource({ ...options, dataSource: options.chartDataSource ?? options.dataSource }, data);
|
|
788
|
+
if (list.length === 0) return { _chartOption: option };
|
|
789
|
+
const categoryField = asString(options.chartCategoryField);
|
|
790
|
+
const def = getChartKindDefinition(type);
|
|
791
|
+
switch (def?.seriesType) {
|
|
792
|
+
case "radar":
|
|
793
|
+
applyRadar(option, list, categoryField, valueFields);
|
|
794
|
+
break;
|
|
795
|
+
case "gauge":
|
|
796
|
+
applyGauge(option, list, valueFields[0]);
|
|
797
|
+
break;
|
|
798
|
+
case "funnel":
|
|
799
|
+
applyPieLike(option, list, categoryField, valueFields[0], true);
|
|
800
|
+
break;
|
|
801
|
+
case "pie":
|
|
802
|
+
applyPieLike(option, list, categoryField, valueFields[0], false);
|
|
803
|
+
break;
|
|
804
|
+
case "scatter":
|
|
805
|
+
applyScatter(option, list, categoryField, valueFields, options.chartBubble === true);
|
|
806
|
+
break;
|
|
807
|
+
default:
|
|
808
|
+
applyCartesian(option, list, categoryField, valueFields, asString(options.chartSeriesField));
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
return { _chartOption: option };
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/config.ts
|
|
815
|
+
import { configurePlugin, getPluginConfig } from "@worm-print-platform/core/designer";
|
|
816
|
+
|
|
817
|
+
// src/constants.ts
|
|
818
|
+
var CHART_PLUGIN_ID = "@worm-print-platform/echarts";
|
|
819
|
+
var CHART_PALETTES = [
|
|
820
|
+
{ key: "default", label: "\u9ED8\u8BA4\u84DD", labelKey: "echarts.palette.default", colors: ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de"] },
|
|
821
|
+
{ key: "fresh", label: "\u6E05\u65B0\u7EFF", labelKey: "echarts.palette.fresh", colors: ["#2f9e6e", "#5cc9a7", "#9ad6c1", "#f2c94c", "#4a90e2"] },
|
|
822
|
+
{ key: "warm", label: "\u6696\u6A59\u7EA2", labelKey: "echarts.palette.warm", colors: ["#f2704e", "#f7a35c", "#f7d56d", "#c54e3f", "#8f5a4a"] },
|
|
823
|
+
{ key: "purple", label: "\u7D2B\u7070", labelKey: "echarts.palette.purple", colors: ["#7b61ff", "#9b8cff", "#c3baff", "#596275", "#8d99ae"] }
|
|
824
|
+
];
|
|
825
|
+
var FALLBACK_SAMPLE_CATEGORIES = ["\u793A\u4F8B\u4E00", "\u793A\u4F8B\u4E8C", "\u793A\u4F8B\u4E09"];
|
|
826
|
+
var FUNNEL_PADDING_DEFAULTS = { top: 6, right: 25, bottom: 6, left: 5 };
|
|
827
|
+
var RADAR_RADIUS_DEFAULT = 75;
|
|
828
|
+
var ECHARTS_RADAR_RADIUS_DEFAULT = 50;
|
|
829
|
+
var ECHARTS_FUNNEL_PADDING_PX = { top: 60, right: 80, bottom: 65, left: 80 };
|
|
830
|
+
|
|
831
|
+
// src/defaults.ts
|
|
832
|
+
var GRID = { left: "8%", right: "8%", bottom: "12%", top: "18%", containLabel: true };
|
|
833
|
+
function percentInsets(padding) {
|
|
834
|
+
return {
|
|
835
|
+
top: `${padding.top}%`,
|
|
836
|
+
right: `${padding.right}%`,
|
|
837
|
+
bottom: `${padding.bottom}%`,
|
|
838
|
+
left: `${padding.left}%`
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
function createDefaultChartOption(type) {
|
|
842
|
+
const def = getChartKindDefinition(type);
|
|
843
|
+
const title = { text: "" };
|
|
844
|
+
switch (def?.seriesType) {
|
|
845
|
+
case "pie":
|
|
846
|
+
return {
|
|
847
|
+
title,
|
|
848
|
+
tooltip: { trigger: "item" },
|
|
849
|
+
series: [{
|
|
850
|
+
type: "pie",
|
|
851
|
+
name: "\u6570\u91CF",
|
|
852
|
+
data: ["$data"],
|
|
853
|
+
radius: type === "doughnutChart" ? ["40%", "70%"] : "62%"
|
|
854
|
+
}]
|
|
855
|
+
};
|
|
856
|
+
case "scatter":
|
|
857
|
+
return {
|
|
858
|
+
title,
|
|
859
|
+
grid: GRID,
|
|
860
|
+
tooltip: { trigger: "axis" },
|
|
861
|
+
xAxis: { type: "value" },
|
|
862
|
+
yAxis: { type: "value" },
|
|
863
|
+
series: [{ type: "scatter", name: "\u6570\u91CF", data: ["$data"], symbolSize: 8 }]
|
|
864
|
+
};
|
|
865
|
+
case "radar":
|
|
866
|
+
return {
|
|
867
|
+
title,
|
|
868
|
+
tooltip: { trigger: "item" },
|
|
869
|
+
// indicator 由绑定阶段按 chartValueFields 生成;设计态预览见 previewChartOption
|
|
870
|
+
radar: { indicator: [], radius: `${RADAR_RADIUS_DEFAULT}%` },
|
|
871
|
+
series: [{ type: "radar", name: "\u6570\u91CF", data: ["$data"] }]
|
|
872
|
+
};
|
|
873
|
+
case "funnel":
|
|
874
|
+
return {
|
|
875
|
+
title,
|
|
876
|
+
tooltip: { trigger: "item" },
|
|
877
|
+
legend: { show: false },
|
|
878
|
+
// 不写内边距会吃 ECharts 的 px 默认(左右 80/上下 60~65),小框里图形只占一半不到
|
|
879
|
+
series: [{ type: "funnel", name: "\u6570\u91CF", data: ["$data"], sort: "descending", ...percentInsets(FUNNEL_PADDING_DEFAULTS) }]
|
|
880
|
+
};
|
|
881
|
+
case "gauge":
|
|
882
|
+
return {
|
|
883
|
+
title,
|
|
884
|
+
tooltip: { trigger: "item" },
|
|
885
|
+
series: [{ type: "gauge", name: "\u6570\u91CF", min: 0, max: 100, data: [{ value: 0, name: "\u6570\u91CF" }] }]
|
|
886
|
+
};
|
|
887
|
+
default: {
|
|
888
|
+
const horizontal = def?.orientation === "horizontal";
|
|
889
|
+
const isArea = def?.seriesType === "line" && type === "areaChart";
|
|
890
|
+
const seriesType = def?.seriesType === "line" ? "line" : "bar";
|
|
891
|
+
return {
|
|
892
|
+
title,
|
|
893
|
+
grid: GRID,
|
|
894
|
+
tooltip: { trigger: "axis" },
|
|
895
|
+
xAxis: horizontal ? { type: "value" } : { type: "category", data: ["$data"] },
|
|
896
|
+
yAxis: horizontal ? { type: "category", data: ["$data"] } : { type: "value" },
|
|
897
|
+
series: [{ type: seriesType, name: "\u6570\u91CF", data: ["$data"], ...isArea ? { areaStyle: {} } : {} }]
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// src/config.ts
|
|
904
|
+
function getChartPluginConfig() {
|
|
905
|
+
return getPluginConfig(CHART_PLUGIN_ID);
|
|
906
|
+
}
|
|
907
|
+
function getChartPalettes() {
|
|
908
|
+
const overrides = getChartPluginConfig().palettes ?? {};
|
|
909
|
+
const builtin = CHART_PALETTES.map((palette) => {
|
|
910
|
+
const custom = overrides[palette.key];
|
|
911
|
+
return custom ? { key: palette.key, label: custom.label ?? palette.label, labelKey: custom.label ? void 0 : palette.labelKey, colors: custom.colors } : { key: palette.key, label: palette.label, labelKey: palette.labelKey, colors: palette.colors };
|
|
912
|
+
});
|
|
913
|
+
const extra = Object.entries(overrides).filter(([key]) => !CHART_PALETTES.some((palette) => palette.key === key)).map(([key, value]) => ({ key, label: value.label ?? key, colors: value.colors }));
|
|
914
|
+
return [...builtin, ...extra];
|
|
915
|
+
}
|
|
916
|
+
function getSampleCategories() {
|
|
917
|
+
const custom = getChartPluginConfig().sampleCategories;
|
|
918
|
+
return Array.isArray(custom) && custom.length > 0 ? custom : FALLBACK_SAMPLE_CATEGORIES;
|
|
919
|
+
}
|
|
920
|
+
function chartFactoryDefaults(type, partial) {
|
|
921
|
+
const config = getChartPluginConfig();
|
|
922
|
+
const def = getChartKindDefinition(type);
|
|
923
|
+
return {
|
|
924
|
+
width: typeof config.defaultWidth === "number" ? config.defaultWidth : def?.defaultWidth ?? 100,
|
|
925
|
+
height: typeof config.defaultHeight === "number" ? config.defaultHeight : def?.defaultHeight ?? 60,
|
|
926
|
+
title: def?.label ?? "\u56FE\u8868",
|
|
927
|
+
chartOption: createDefaultChartOption(type),
|
|
928
|
+
chartDataSource: "",
|
|
929
|
+
chartCategoryField: "name",
|
|
930
|
+
chartValueFields: ["value"],
|
|
931
|
+
chartSeriesField: "",
|
|
932
|
+
...partial
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// src/echarts.ts
|
|
937
|
+
import { BarChart, LineChart, PieChart, ScatterChart, RadarChart, FunnelChart, GaugeChart } from "echarts/charts";
|
|
10
938
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
939
|
+
DatasetComponent,
|
|
940
|
+
GridComponent,
|
|
941
|
+
LegendComponent,
|
|
942
|
+
TitleComponent,
|
|
943
|
+
TooltipComponent
|
|
944
|
+
} from "echarts/components";
|
|
945
|
+
import * as echarts from "echarts/core";
|
|
946
|
+
import { SVGRenderer } from "echarts/renderers";
|
|
947
|
+
echarts.use([
|
|
948
|
+
BarChart,
|
|
949
|
+
LineChart,
|
|
950
|
+
PieChart,
|
|
951
|
+
ScatterChart,
|
|
952
|
+
RadarChart,
|
|
953
|
+
FunnelChart,
|
|
954
|
+
GaugeChart,
|
|
955
|
+
GridComponent,
|
|
956
|
+
TooltipComponent,
|
|
957
|
+
LegendComponent,
|
|
958
|
+
TitleComponent,
|
|
959
|
+
DatasetComponent,
|
|
960
|
+
SVGRenderer
|
|
961
|
+
]);
|
|
962
|
+
var appliedComponents = /* @__PURE__ */ new Set();
|
|
963
|
+
function applyExtraComponents() {
|
|
964
|
+
const extra = getChartPluginConfig().components ?? [];
|
|
965
|
+
const fresh = extra.filter((item) => item != null && !appliedComponents.has(item));
|
|
966
|
+
if (fresh.length === 0) return;
|
|
967
|
+
echarts.use(fresh);
|
|
968
|
+
for (const item of fresh) appliedComponents.add(item);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// src/units.ts
|
|
972
|
+
var PX_PER_MM = 96 / 25.4;
|
|
973
|
+
function mmToChartPx(mm) {
|
|
974
|
+
const value = Number.isFinite(mm) ? mm : 0;
|
|
975
|
+
return Math.max(1, Math.round(value * PX_PER_MM));
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// src/option-utils.ts
|
|
979
|
+
var SAMPLE_VALUES = [12, 20, 15];
|
|
980
|
+
function cloneChartOption(value) {
|
|
981
|
+
try {
|
|
982
|
+
return JSON.parse(JSON.stringify(value));
|
|
983
|
+
} catch {
|
|
984
|
+
return value;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
function previewChartOption(type, option) {
|
|
988
|
+
if (!option || typeof option !== "object" || Array.isArray(option)) return {};
|
|
989
|
+
const next = cloneChartOption(option);
|
|
990
|
+
const def = getChartKindDefinition(type);
|
|
991
|
+
const categories = [...getSampleCategories()];
|
|
992
|
+
const values = [...SAMPLE_VALUES];
|
|
993
|
+
const series = Array.isArray(next.series) ? next.series : [];
|
|
994
|
+
const replaceSeriesData = (mapper) => {
|
|
995
|
+
for (const item of series) {
|
|
996
|
+
if (Array.isArray(item.data) && item.data.includes("$data")) item.data = mapper(item);
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
const replaceAxisData = () => {
|
|
1000
|
+
for (const key of ["xAxis", "yAxis"]) {
|
|
1001
|
+
const axes = Array.isArray(next[key]) ? next[key] : next[key] ? [next[key]] : [];
|
|
1002
|
+
for (const axis of axes) {
|
|
1003
|
+
if (axis && Array.isArray(axis.data) && axis.data.includes("$data")) axis.data = [...categories];
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
switch (def?.seriesType) {
|
|
1008
|
+
case "pie":
|
|
1009
|
+
replaceSeriesData(() => categories.map((name, index) => ({ name, value: values[index] ?? 10 })));
|
|
1010
|
+
break;
|
|
1011
|
+
case "funnel":
|
|
1012
|
+
replaceSeriesData(() => categories.map((name, index) => ({ name, value: values[index] ?? 10 })));
|
|
1013
|
+
break;
|
|
1014
|
+
case "scatter":
|
|
1015
|
+
replaceSeriesData(() => values.map((value) => [value, value + 6]));
|
|
1016
|
+
break;
|
|
1017
|
+
case "radar":
|
|
1018
|
+
next.radar = {
|
|
1019
|
+
...next.radar ?? {},
|
|
1020
|
+
indicator: categories.map((name) => ({ name, max: 30 }))
|
|
1021
|
+
};
|
|
1022
|
+
replaceSeriesData(() => [{ name: "\u793A\u4F8B", value: values }]);
|
|
1023
|
+
break;
|
|
1024
|
+
case "gauge":
|
|
1025
|
+
replaceSeriesData(() => [{ value: values[0] ?? 40, name: "\u6570\u91CF" }]);
|
|
1026
|
+
break;
|
|
1027
|
+
default:
|
|
1028
|
+
replaceSeriesData(() => [...values]);
|
|
1029
|
+
replaceAxisData();
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
return next;
|
|
1033
|
+
}
|
|
1034
|
+
function readPaletteKey(option, palettes) {
|
|
1035
|
+
const color = Array.isArray(option?.color) ? (option?.color).map(String) : [];
|
|
1036
|
+
const hit = palettes.find((palette) => palette.colors.every((c, i) => c === color[i]) && color.length === palette.colors.length);
|
|
1037
|
+
return hit?.key ?? "default";
|
|
1038
|
+
}
|
|
1039
|
+
function asObject(node) {
|
|
1040
|
+
if (Array.isArray(node)) return node[0] && typeof node[0] === "object" ? { ...node[0] } : {};
|
|
1041
|
+
return node && typeof node === "object" ? { ...node } : {};
|
|
1042
|
+
}
|
|
1043
|
+
function syncSeriesCount(option, count, type) {
|
|
1044
|
+
const next = cloneChartOption(option);
|
|
1045
|
+
const rawSeries = Array.isArray(next.series) ? next.series : [];
|
|
1046
|
+
const def = getChartKindDefinition(type);
|
|
1047
|
+
const template = rawSeries[0] ?? { type: def?.seriesType === "line" ? "line" : "bar", data: ["$data"] };
|
|
1048
|
+
next.series = Array.from({ length: Math.max(count, 1) }, (_, index) => ({
|
|
1049
|
+
...template,
|
|
1050
|
+
...rawSeries[index] ?? {},
|
|
1051
|
+
data: ["$data"]
|
|
1052
|
+
}));
|
|
1053
|
+
return next;
|
|
1054
|
+
}
|
|
1055
|
+
var round1 = (value) => Math.round(value * 10) / 10;
|
|
1056
|
+
function pxToPercent(px, totalPx) {
|
|
1057
|
+
return totalPx > 0 ? round1(px / totalPx * 100) : 0;
|
|
1058
|
+
}
|
|
1059
|
+
function readInsetPercent(value, totalPx, echartsPx) {
|
|
1060
|
+
if (typeof value === "string" && value.trim().endsWith("%")) {
|
|
1061
|
+
const parsed = Number.parseFloat(value);
|
|
1062
|
+
if (Number.isFinite(parsed)) return round1(parsed);
|
|
1063
|
+
}
|
|
1064
|
+
if (typeof value === "number" && Number.isFinite(value)) return pxToPercent(value, totalPx);
|
|
1065
|
+
return pxToPercent(echartsPx, totalPx);
|
|
1066
|
+
}
|
|
1067
|
+
function clamp(value, min, max) {
|
|
1068
|
+
return Math.min(max, Math.max(min, value));
|
|
1069
|
+
}
|
|
1070
|
+
function percentString(value) {
|
|
1071
|
+
return `${clamp(round1(value), 0, 100)}%`;
|
|
1072
|
+
}
|
|
1073
|
+
function firstSeries(option) {
|
|
1074
|
+
const series = Array.isArray(option.series) ? option.series : [];
|
|
1075
|
+
const first = series[0];
|
|
1076
|
+
return first && typeof first === "object" ? first : {};
|
|
1077
|
+
}
|
|
1078
|
+
function readFunnelPadding(option, widthMm, heightMm) {
|
|
1079
|
+
const source = option && typeof option === "object" ? option : {};
|
|
1080
|
+
const series = firstSeries(source);
|
|
1081
|
+
const widthPx = mmToChartPx(widthMm);
|
|
1082
|
+
const heightPx = mmToChartPx(heightMm);
|
|
1083
|
+
return {
|
|
1084
|
+
top: readInsetPercent(series.top, heightPx, ECHARTS_FUNNEL_PADDING_PX.top),
|
|
1085
|
+
right: readInsetPercent(series.right, widthPx, ECHARTS_FUNNEL_PADDING_PX.right),
|
|
1086
|
+
bottom: readInsetPercent(series.bottom, heightPx, ECHARTS_FUNNEL_PADDING_PX.bottom),
|
|
1087
|
+
left: readInsetPercent(series.left, widthPx, ECHARTS_FUNNEL_PADDING_PX.left)
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
function writeFunnelPadding(option, padding) {
|
|
1091
|
+
const next = cloneChartOption(option);
|
|
1092
|
+
const series = Array.isArray(next.series) ? next.series : [];
|
|
1093
|
+
if (series.length === 0) series.push({ type: "funnel", data: ["$data"] });
|
|
1094
|
+
const first = series[0];
|
|
1095
|
+
first.top = percentString(padding.top);
|
|
1096
|
+
first.right = percentString(padding.right);
|
|
1097
|
+
first.bottom = percentString(padding.bottom);
|
|
1098
|
+
first.left = percentString(padding.left);
|
|
1099
|
+
next.series = series;
|
|
1100
|
+
return next;
|
|
1101
|
+
}
|
|
1102
|
+
function readRadarRadius(option, widthMm, heightMm) {
|
|
1103
|
+
const source = option && typeof option === "object" ? option : {};
|
|
1104
|
+
const raw = asObject(source.radar).radius;
|
|
1105
|
+
const value = Array.isArray(raw) ? raw[raw.length - 1] : raw;
|
|
1106
|
+
const widthPx = mmToChartPx(widthMm);
|
|
1107
|
+
const heightPx = mmToChartPx(heightMm);
|
|
1108
|
+
const viewSize = Math.min(widthPx, heightPx) / 2;
|
|
1109
|
+
if (typeof value === "string" && value.trim().endsWith("%")) {
|
|
1110
|
+
const parsed = Number.parseFloat(value);
|
|
1111
|
+
if (Number.isFinite(parsed)) return round1(parsed);
|
|
1112
|
+
}
|
|
1113
|
+
if (typeof value === "number" && Number.isFinite(value)) return pxToPercent(value, viewSize);
|
|
1114
|
+
return ECHARTS_RADAR_RADIUS_DEFAULT;
|
|
1115
|
+
}
|
|
1116
|
+
function writeRadarRadius(option, percent) {
|
|
1117
|
+
const next = cloneChartOption(option);
|
|
1118
|
+
next.radar = { ...asObject(next.radar), radius: percentString(clamp(percent, 20, 100)) };
|
|
1119
|
+
return next;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// src/label.ts
|
|
1123
|
+
var LABEL_PRESETS = [
|
|
1124
|
+
{ key: "value", label: "\u6570\u503C", labelKey: "echarts.label.formatter.value", formatter: "{c}" },
|
|
1125
|
+
{ key: "name-value", label: "\u540D\u79F0: \u6570\u503C", labelKey: "echarts.label.formatter.nameValue", formatter: "{b}: {c}" },
|
|
1126
|
+
{ key: "name", label: "\u540D\u79F0", labelKey: "echarts.label.formatter.name", formatter: "{b}" },
|
|
1127
|
+
{ key: "percent", label: "\u767E\u5206\u6BD4", labelKey: "echarts.label.formatter.percent", formatter: "{d}%" }
|
|
1128
|
+
];
|
|
1129
|
+
var LABEL_POSITIONS = {
|
|
1130
|
+
bar: [
|
|
1131
|
+
{ value: "top", label: "\u9876\u90E8", labelKey: "echarts.label.position.bar.top" },
|
|
1132
|
+
{ value: "inside", label: "\u5185\u90E8", labelKey: "echarts.label.position.bar.inside" },
|
|
1133
|
+
{ value: "insideTop", label: "\u5185\u90E8\u9876\u7AEF", labelKey: "echarts.label.position.bar.insideTop" },
|
|
1134
|
+
{ value: "bottom", label: "\u5E95\u90E8", labelKey: "echarts.label.position.bar.bottom" },
|
|
1135
|
+
{ value: "insideBottom", label: "\u5185\u90E8\u5E95\u7AEF", labelKey: "echarts.label.position.bar.insideBottom" },
|
|
1136
|
+
{ value: "right", label: "\u53F3\u4FA7", labelKey: "echarts.label.position.bar.right" },
|
|
1137
|
+
{ value: "left", label: "\u5DE6\u4FA7", labelKey: "echarts.label.position.bar.left" },
|
|
1138
|
+
{ value: "middle", label: "\u5C45\u4E2D", labelKey: "echarts.label.position.bar.middle" }
|
|
1139
|
+
],
|
|
1140
|
+
line: [
|
|
1141
|
+
{ value: "top", label: "\u9876\u90E8", labelKey: "echarts.label.position.line.top" },
|
|
1142
|
+
{ value: "bottom", label: "\u5E95\u90E8", labelKey: "echarts.label.position.line.bottom" },
|
|
1143
|
+
{ value: "inside", label: "\u5185\u90E8", labelKey: "echarts.label.position.line.inside" },
|
|
1144
|
+
{ value: "left", label: "\u5DE6\u4FA7", labelKey: "echarts.label.position.line.left" },
|
|
1145
|
+
{ value: "right", label: "\u53F3\u4FA7", labelKey: "echarts.label.position.line.right" }
|
|
1146
|
+
],
|
|
1147
|
+
pie: [
|
|
1148
|
+
{ value: "outside", label: "\u5916\u4FA7", labelKey: "echarts.label.position.pie.outside" },
|
|
1149
|
+
{ value: "inside", label: "\u5185\u90E8", labelKey: "echarts.label.position.pie.inside" },
|
|
1150
|
+
{ value: "center", label: "\u4E2D\u5FC3", labelKey: "echarts.label.position.pie.center" }
|
|
1151
|
+
],
|
|
1152
|
+
scatter: [
|
|
1153
|
+
{ value: "top", label: "\u9876\u90E8", labelKey: "echarts.label.position.scatter.top" },
|
|
1154
|
+
{ value: "bottom", label: "\u5E95\u90E8", labelKey: "echarts.label.position.scatter.bottom" },
|
|
1155
|
+
{ value: "left", label: "\u5DE6\u4FA7", labelKey: "echarts.label.position.scatter.left" },
|
|
1156
|
+
{ value: "right", label: "\u53F3\u4FA7", labelKey: "echarts.label.position.scatter.right" },
|
|
1157
|
+
{ value: "inside", label: "\u5185\u90E8", labelKey: "echarts.label.position.scatter.inside" }
|
|
1158
|
+
],
|
|
1159
|
+
radar: [
|
|
1160
|
+
{ value: "top", label: "\u9876\u90E8", labelKey: "echarts.label.position.radar.top" },
|
|
1161
|
+
{ value: "bottom", label: "\u5E95\u90E8", labelKey: "echarts.label.position.radar.bottom" },
|
|
1162
|
+
{ value: "left", label: "\u5DE6\u4FA7", labelKey: "echarts.label.position.radar.left" },
|
|
1163
|
+
{ value: "right", label: "\u53F3\u4FA7", labelKey: "echarts.label.position.radar.right" },
|
|
1164
|
+
{ value: "inside", label: "\u5185\u90E8", labelKey: "echarts.label.position.radar.inside" }
|
|
1165
|
+
],
|
|
1166
|
+
funnel: [
|
|
1167
|
+
{ value: "outer", label: "\u5916\u4FA7", labelKey: "echarts.label.position.funnel.outer" },
|
|
1168
|
+
{ value: "inner", label: "\u5185\u90E8", labelKey: "echarts.label.position.funnel.inner" },
|
|
1169
|
+
{ value: "left", label: "\u5DE6\u4FA7", labelKey: "echarts.label.position.funnel.left" },
|
|
1170
|
+
{ value: "right", label: "\u53F3\u4FA7", labelKey: "echarts.label.position.funnel.right" },
|
|
1171
|
+
{ value: "top", label: "\u9876\u90E8", labelKey: "echarts.label.position.funnel.top" },
|
|
1172
|
+
{ value: "bottom", label: "\u5E95\u90E8", labelKey: "echarts.label.position.funnel.bottom" }
|
|
1173
|
+
],
|
|
1174
|
+
gauge: []
|
|
1175
|
+
};
|
|
1176
|
+
var NATIVE_SHOW = {
|
|
1177
|
+
bar: false,
|
|
1178
|
+
line: false,
|
|
1179
|
+
pie: true,
|
|
1180
|
+
scatter: false,
|
|
1181
|
+
radar: false,
|
|
1182
|
+
funnel: true,
|
|
1183
|
+
gauge: true
|
|
1184
|
+
};
|
|
1185
|
+
var ENABLE_DEFAULTS = {
|
|
1186
|
+
bar: { position: "top", fontSize: 12 },
|
|
1187
|
+
line: { position: "top", fontSize: 12 },
|
|
1188
|
+
pie: { position: "outside", overflow: "none", fontSize: 11 },
|
|
1189
|
+
scatter: { position: "top", fontSize: 11 },
|
|
1190
|
+
radar: { position: "top", fontSize: 10 },
|
|
1191
|
+
funnel: { position: "outer", fontSize: 11 },
|
|
1192
|
+
gauge: { fontSize: 14 }
|
|
1193
|
+
};
|
|
1194
|
+
var TYPE_DEFAULTS = {
|
|
1195
|
+
barHChart: { position: "right", fontSize: 12 }
|
|
1196
|
+
};
|
|
1197
|
+
var FIELDS_BY_SERIES = {
|
|
1198
|
+
bar: [
|
|
1199
|
+
"formatter",
|
|
1200
|
+
"overflow",
|
|
1201
|
+
"position",
|
|
1202
|
+
"rotate",
|
|
1203
|
+
"offset",
|
|
1204
|
+
"fontSize",
|
|
1205
|
+
"fontWeight",
|
|
1206
|
+
"color",
|
|
1207
|
+
"backgroundColor",
|
|
1208
|
+
"borderColor",
|
|
1209
|
+
"borderWidth",
|
|
1210
|
+
"borderRadius",
|
|
1211
|
+
"padding"
|
|
1212
|
+
],
|
|
1213
|
+
line: [
|
|
1214
|
+
"formatter",
|
|
1215
|
+
"overflow",
|
|
1216
|
+
"position",
|
|
1217
|
+
"rotate",
|
|
1218
|
+
"offset",
|
|
1219
|
+
"fontSize",
|
|
1220
|
+
"fontWeight",
|
|
1221
|
+
"color",
|
|
1222
|
+
"backgroundColor",
|
|
1223
|
+
"borderColor",
|
|
1224
|
+
"borderWidth",
|
|
1225
|
+
"borderRadius",
|
|
1226
|
+
"padding"
|
|
1227
|
+
],
|
|
1228
|
+
pie: [
|
|
1229
|
+
"formatter",
|
|
1230
|
+
"overflow",
|
|
1231
|
+
"position",
|
|
1232
|
+
"distance",
|
|
1233
|
+
"offset",
|
|
1234
|
+
"fontSize",
|
|
1235
|
+
"fontWeight",
|
|
1236
|
+
"color",
|
|
1237
|
+
"backgroundColor",
|
|
1238
|
+
"borderColor",
|
|
1239
|
+
"borderWidth",
|
|
1240
|
+
"borderRadius",
|
|
1241
|
+
"padding",
|
|
1242
|
+
"labelLine.show",
|
|
1243
|
+
"labelLine.length",
|
|
1244
|
+
"labelLine.length2",
|
|
1245
|
+
"labelLine.smooth"
|
|
1246
|
+
],
|
|
1247
|
+
scatter: [
|
|
1248
|
+
"formatter",
|
|
1249
|
+
"overflow",
|
|
1250
|
+
"position",
|
|
1251
|
+
"distance",
|
|
1252
|
+
"rotate",
|
|
1253
|
+
"offset",
|
|
1254
|
+
"fontSize",
|
|
1255
|
+
"fontWeight",
|
|
1256
|
+
"color",
|
|
1257
|
+
"backgroundColor",
|
|
1258
|
+
"borderColor",
|
|
1259
|
+
"borderWidth",
|
|
1260
|
+
"borderRadius",
|
|
1261
|
+
"padding"
|
|
1262
|
+
],
|
|
1263
|
+
radar: ["formatter", "fontSize", "fontWeight", "color"],
|
|
1264
|
+
funnel: [
|
|
1265
|
+
"formatter",
|
|
1266
|
+
"overflow",
|
|
1267
|
+
"position",
|
|
1268
|
+
"distance",
|
|
1269
|
+
"fontSize",
|
|
1270
|
+
"fontWeight",
|
|
1271
|
+
"color",
|
|
1272
|
+
"labelLine.show",
|
|
1273
|
+
"labelLine.length",
|
|
1274
|
+
"labelLine.smooth"
|
|
1275
|
+
],
|
|
1276
|
+
gauge: ["formatter", "fontSize", "fontWeight", "color", "offset"]
|
|
1277
|
+
};
|
|
1278
|
+
var VALUE_KEYS = [
|
|
1279
|
+
"formatter",
|
|
1280
|
+
"overflow",
|
|
1281
|
+
"position",
|
|
1282
|
+
"distance",
|
|
1283
|
+
"rotate",
|
|
1284
|
+
"offset",
|
|
1285
|
+
"fontSize",
|
|
1286
|
+
"fontWeight",
|
|
1287
|
+
"color",
|
|
1288
|
+
"backgroundColor",
|
|
1289
|
+
"borderColor",
|
|
1290
|
+
"borderWidth",
|
|
1291
|
+
"borderRadius",
|
|
1292
|
+
"padding"
|
|
1293
|
+
];
|
|
1294
|
+
function seriesOf2(option) {
|
|
1295
|
+
const series = option?.series;
|
|
1296
|
+
return Array.isArray(series) ? series : [];
|
|
1297
|
+
}
|
|
1298
|
+
function asRecord(node) {
|
|
1299
|
+
return node && typeof node === "object" && !Array.isArray(node) ? { ...node } : {};
|
|
1300
|
+
}
|
|
1301
|
+
function normalizeLabelOffsetInPlace(target) {
|
|
1302
|
+
if (typeof target.offsetX !== "number" && typeof target.offsetY !== "number") return;
|
|
1303
|
+
if (!Array.isArray(target.offset)) {
|
|
1304
|
+
target.offset = [
|
|
1305
|
+
typeof target.offsetX === "number" ? target.offsetX : 0,
|
|
1306
|
+
typeof target.offsetY === "number" ? target.offsetY : 0
|
|
1307
|
+
];
|
|
1308
|
+
}
|
|
1309
|
+
delete target.offsetX;
|
|
1310
|
+
delete target.offsetY;
|
|
1311
|
+
}
|
|
1312
|
+
function labelTargetOf(type) {
|
|
1313
|
+
return getChartKindDefinition(type)?.seriesType === "gauge" ? "detail" : "label";
|
|
1314
|
+
}
|
|
1315
|
+
function labelFieldsOf(type) {
|
|
1316
|
+
const def = getChartKindDefinition(type);
|
|
1317
|
+
return def ? FIELDS_BY_SERIES[def.seriesType] : [];
|
|
1318
|
+
}
|
|
1319
|
+
function readChartLabel(option, type) {
|
|
1320
|
+
const def = getChartKindDefinition(type);
|
|
1321
|
+
const series = seriesOf2(option);
|
|
1322
|
+
const target = asRecord(series[0]?.[labelTargetOf(type)]);
|
|
1323
|
+
normalizeLabelOffsetInPlace(target);
|
|
1324
|
+
const state = {
|
|
1325
|
+
show: typeof target.show === "boolean" ? target.show : def ? NATIVE_SHOW[def.seriesType] : false,
|
|
1326
|
+
// labelLine 在 ECharts 里是 series 顶层键(与 label 平级),不是 label 的子键
|
|
1327
|
+
labelLine: asRecord(series[0]?.labelLine)
|
|
1328
|
+
};
|
|
1329
|
+
for (const key of VALUE_KEYS) {
|
|
1330
|
+
const value = target[key];
|
|
1331
|
+
if (key === "offset") continue;
|
|
1332
|
+
if (typeof value === "string" || typeof value === "number") state[key] = value;
|
|
1333
|
+
}
|
|
1334
|
+
const offset = target.offset;
|
|
1335
|
+
if (Array.isArray(offset) && typeof offset[0] === "number" && typeof offset[1] === "number") {
|
|
1336
|
+
state.offset = [offset[0], offset[1]];
|
|
1337
|
+
}
|
|
1338
|
+
return state;
|
|
1339
|
+
}
|
|
1340
|
+
function defaultSetOf(type) {
|
|
1341
|
+
const def = getChartKindDefinition(type);
|
|
1342
|
+
if (!def) return {};
|
|
1343
|
+
return { ...ENABLE_DEFAULTS[def.seriesType], ...TYPE_DEFAULTS[type] };
|
|
1344
|
+
}
|
|
1345
|
+
function isEmpty(value) {
|
|
1346
|
+
return value === null || value === void 0 || value === "";
|
|
1347
|
+
}
|
|
1348
|
+
function updateChartLabel(option, type, patch) {
|
|
1349
|
+
const next = cloneChartOption(option ?? {});
|
|
1350
|
+
const series = Array.isArray(next.series) ? next.series : [];
|
|
1351
|
+
const def = getChartKindDefinition(type);
|
|
1352
|
+
if (!def || series.length === 0) return next;
|
|
1353
|
+
const targetKey = labelTargetOf(type);
|
|
1354
|
+
const { enabled, labelLine, ...values } = patch;
|
|
1355
|
+
for (const item of series) {
|
|
1356
|
+
if (!item || typeof item !== "object") continue;
|
|
1357
|
+
const current = asRecord(item[targetKey]);
|
|
1358
|
+
normalizeLabelOffsetInPlace(current);
|
|
1359
|
+
if (enabled === true) {
|
|
1360
|
+
Object.assign(current, { ...defaultSetOf(type), ...current, show: true });
|
|
1361
|
+
} else if (enabled === false) {
|
|
1362
|
+
current.show = false;
|
|
1363
|
+
}
|
|
1364
|
+
for (const [key, value] of Object.entries(values)) {
|
|
1365
|
+
if (isEmpty(value)) delete current[key];
|
|
1366
|
+
else current[key] = value;
|
|
1367
|
+
}
|
|
1368
|
+
if (labelLine) {
|
|
1369
|
+
const line = asRecord(item.labelLine);
|
|
1370
|
+
for (const [key, value] of Object.entries(labelLine)) {
|
|
1371
|
+
if (isEmpty(value)) delete line[key];
|
|
1372
|
+
else line[key] = value;
|
|
1373
|
+
}
|
|
1374
|
+
item.labelLine = line;
|
|
1375
|
+
}
|
|
1376
|
+
item[targetKey] = current;
|
|
1377
|
+
}
|
|
1378
|
+
return next;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
// src/normalize.ts
|
|
1382
|
+
function asArray(value) {
|
|
1383
|
+
if (Array.isArray(value)) return value.map((item) => ({ ...item }));
|
|
1384
|
+
return [];
|
|
1385
|
+
}
|
|
1386
|
+
function normalizeCategoryAxis(axis, horizontal) {
|
|
1387
|
+
const next = { ...axis, type: horizontal ? "value" : "category" };
|
|
1388
|
+
if (horizontal) delete next.data;
|
|
1389
|
+
else if (!Array.isArray(next.data)) next.data = ["$data"];
|
|
1390
|
+
return next;
|
|
1391
|
+
}
|
|
1392
|
+
function normalizeValueAxis(axis, horizontal) {
|
|
1393
|
+
const next = { ...axis, type: horizontal ? "category" : "value" };
|
|
1394
|
+
if (horizontal && !Array.isArray(next.data)) next.data = ["$data"];
|
|
1395
|
+
if (!horizontal) delete next.data;
|
|
1396
|
+
return next;
|
|
1397
|
+
}
|
|
1398
|
+
function mapAxes(value, fn) {
|
|
1399
|
+
if (Array.isArray(value)) return value.map((item) => fn({ ...item }));
|
|
1400
|
+
if (value && typeof value === "object") return fn({ ...value });
|
|
1401
|
+
return fn({});
|
|
1402
|
+
}
|
|
1403
|
+
function normalizeChartOption(type, option) {
|
|
1404
|
+
const def = getChartKindDefinition(type);
|
|
1405
|
+
if (!def) return option;
|
|
1406
|
+
const next = structuredClone(option);
|
|
1407
|
+
const series = asArray(next.series);
|
|
1408
|
+
if (series.length === 0) return next;
|
|
1409
|
+
const labelKey = labelTargetOf(type);
|
|
1410
|
+
for (const item of series) {
|
|
1411
|
+
const label = item[labelKey];
|
|
1412
|
+
if (label && typeof label === "object" && !Array.isArray(label)) {
|
|
1413
|
+
const nextLabel = { ...label };
|
|
1414
|
+
normalizeLabelOffsetInPlace(nextLabel);
|
|
1415
|
+
item[labelKey] = nextLabel;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
if (def.seriesType === "pie") {
|
|
1419
|
+
next.series = series.map((item) => ({
|
|
1420
|
+
...item,
|
|
1421
|
+
type: "pie",
|
|
1422
|
+
...type === "doughnutChart" ? { radius: item.radius ?? ["40%", "70%"] } : {}
|
|
1423
|
+
}));
|
|
1424
|
+
delete next.xAxis;
|
|
1425
|
+
delete next.yAxis;
|
|
1426
|
+
return next;
|
|
1427
|
+
}
|
|
1428
|
+
if (def.seriesType === "scatter") {
|
|
1429
|
+
next.series = series.map((item) => ({ ...item, type: "scatter" }));
|
|
1430
|
+
next.xAxis = mapAxes(next.xAxis, (axis) => ({ ...axis, type: "value", data: void 0 }));
|
|
1431
|
+
next.yAxis = mapAxes(next.yAxis, (axis) => ({ ...axis, type: "value", data: void 0 }));
|
|
1432
|
+
return next;
|
|
1433
|
+
}
|
|
1434
|
+
if (def.seriesType === "radar") {
|
|
1435
|
+
next.series = series.map((item) => ({ ...item, type: "radar" }));
|
|
1436
|
+
return next;
|
|
1437
|
+
}
|
|
1438
|
+
if (def.seriesType === "funnel") {
|
|
1439
|
+
next.series = series.map((item) => ({ ...item, type: "funnel", sort: "descending" }));
|
|
1440
|
+
return next;
|
|
1441
|
+
}
|
|
1442
|
+
if (def.seriesType === "gauge") {
|
|
1443
|
+
next.series = series.map((item) => ({ ...item, type: "gauge" }));
|
|
1444
|
+
return next;
|
|
1445
|
+
}
|
|
1446
|
+
const horizontal = def.orientation === "horizontal";
|
|
1447
|
+
const seriesType = def.seriesType === "line" ? "line" : "bar";
|
|
1448
|
+
next.xAxis = mapAxes(next.xAxis, (axis) => normalizeCategoryAxis(axis, horizontal));
|
|
1449
|
+
next.yAxis = mapAxes(next.yAxis, (axis) => normalizeValueAxis(axis, horizontal));
|
|
1450
|
+
next.series = series.map((item) => {
|
|
1451
|
+
const shape = { ...item, type: seriesType };
|
|
1452
|
+
if (type === "areaChart") shape.areaStyle = item.areaStyle ?? {};
|
|
1453
|
+
else delete shape.areaStyle;
|
|
1454
|
+
return shape;
|
|
1455
|
+
});
|
|
1456
|
+
return next;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
// src/renderer.ts
|
|
1460
|
+
function fitSvgRoot(svg, widthPx, heightPx) {
|
|
1461
|
+
const match = /<svg\b[^>]*>/i.exec(svg);
|
|
1462
|
+
if (!match) return svg;
|
|
1463
|
+
const rootTag = match[0];
|
|
1464
|
+
const rawAttrs = rootTag.slice("<svg".length, -1);
|
|
1465
|
+
const styleMatch = /\sstyle\s*=\s*"([^"]*)"/i.exec(rawAttrs);
|
|
1466
|
+
const keptStyle = (styleMatch?.[1] ?? "").split(";").map((decl) => decl.trim()).filter((decl) => decl && !/^(width|height|display)\s*:/i.test(decl)).join(";");
|
|
1467
|
+
const attrs = rawAttrs.replace(/\s(width|height|style|viewBox)\s*=\s*"[^"]*"/gi, "").trimEnd();
|
|
1468
|
+
const style = ["display:block", "width:100%", "height:100%", keptStyle].filter(Boolean).join(";");
|
|
1469
|
+
const nextTag = `<svg${attrs} width="100%" height="100%" viewBox="0 0 ${widthPx} ${heightPx}" style="${style}">`;
|
|
1470
|
+
return svg.slice(0, match.index) + nextTag + svg.slice(match.index + rootTag.length);
|
|
1471
|
+
}
|
|
1472
|
+
function renderChartToSvg(spec) {
|
|
1473
|
+
applyExtraComponents();
|
|
1474
|
+
const option = normalizeChartOption(spec.type, spec.option);
|
|
1475
|
+
if (!option || typeof option !== "object" || Array.isArray(option)) {
|
|
1476
|
+
throw new Error("\u56FE\u8868 option \u975E\u6CD5\uFF1A\u9700\u8981\u5BF9\u8C61");
|
|
1477
|
+
}
|
|
1478
|
+
const width = mmToChartPx(spec.widthMm);
|
|
1479
|
+
const height = mmToChartPx(spec.heightMm);
|
|
1480
|
+
const chart = echarts.init(null, null, { renderer: "svg", ssr: true, width, height });
|
|
1481
|
+
try {
|
|
1482
|
+
const userTextStyle = option.textStyle && typeof option.textStyle === "object" && !Array.isArray(option.textStyle) ? option.textStyle : void 0;
|
|
1483
|
+
const textStyle = {
|
|
1484
|
+
...spec.fontFamily ? { fontFamily: spec.fontFamily } : {},
|
|
1485
|
+
...userTextStyle ?? {}
|
|
1486
|
+
};
|
|
1487
|
+
chart.setOption({
|
|
1488
|
+
animation: false,
|
|
1489
|
+
...option,
|
|
1490
|
+
...Object.keys(textStyle).length > 0 ? { textStyle } : {}
|
|
1491
|
+
});
|
|
1492
|
+
return fitSvgRoot(chart.renderToSVGString(), width, height);
|
|
1493
|
+
} finally {
|
|
1494
|
+
chart.dispose();
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
function escapeHtml(value) {
|
|
1498
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1499
|
+
}
|
|
1500
|
+
function renderChartElement(spec) {
|
|
1501
|
+
const option = spec._chartOption ?? spec.chartOption;
|
|
1502
|
+
const placeholder = `<span>${escapeHtml(String(spec.title ?? "\u56FE\u8868"))}</span>`;
|
|
1503
|
+
if (!option || typeof option !== "object" || Array.isArray(option)) return placeholder;
|
|
1504
|
+
try {
|
|
1505
|
+
return renderChartToSvg({
|
|
1506
|
+
key: String(spec.key ?? ""),
|
|
1507
|
+
type: String(spec.type ?? ""),
|
|
1508
|
+
option,
|
|
1509
|
+
widthMm: Number(spec.widthMm ?? 0),
|
|
1510
|
+
heightMm: Number(spec.heightMm ?? 0),
|
|
1511
|
+
fontFamily: typeof spec.fontFamily === "string" ? spec.fontFamily : void 0
|
|
1512
|
+
});
|
|
1513
|
+
} catch {
|
|
1514
|
+
return placeholder;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
// src/version.ts
|
|
1519
|
+
var CHART_EXECUTOR_VERSION = "2";
|
|
1520
|
+
|
|
1521
|
+
// src/plugin.ts
|
|
1522
|
+
var CHART_OPTION_META = {
|
|
1523
|
+
chartOption: { kind: "object", label: t("echarts.meta.chartOption") },
|
|
1524
|
+
chartDataSource: { kind: "text", label: t("echarts.meta.dataSource") },
|
|
1525
|
+
chartCategoryField: { kind: "text", label: t("echarts.meta.categoryField") },
|
|
1526
|
+
chartValueFields: { kind: "object", label: t("echarts.meta.valueFields") },
|
|
1527
|
+
chartSeriesField: { kind: "text", label: t("echarts.meta.seriesField") }
|
|
1528
|
+
};
|
|
1529
|
+
var SCATTER_OPTION_META = {
|
|
1530
|
+
...CHART_OPTION_META,
|
|
1531
|
+
chartBubble: { kind: "bool", label: t("echarts.meta.bubbleSize") }
|
|
1532
|
+
};
|
|
1533
|
+
var CHART_PLUGIN = defineElementPlugin({
|
|
1534
|
+
id: CHART_PLUGIN_ID,
|
|
1535
|
+
version: CHART_EXECUTOR_VERSION,
|
|
1536
|
+
kinds: CHART_KIND_DEFINITIONS.map((def) => ({
|
|
1537
|
+
type: def.type,
|
|
1538
|
+
// getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
|
|
1539
|
+
get label() {
|
|
1540
|
+
return t(def.labelKey);
|
|
1541
|
+
},
|
|
1542
|
+
icon: def.icon,
|
|
1543
|
+
fixedHeight: true,
|
|
1544
|
+
requiredOptionKeys: def.requiredOptionKeys,
|
|
1545
|
+
// getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
|
|
1546
|
+
get notes() {
|
|
1547
|
+
return t(def.notesKey);
|
|
1548
|
+
},
|
|
1549
|
+
optionMeta: def.type === "scatterChart" ? SCATTER_OPTION_META : CHART_OPTION_META,
|
|
1550
|
+
defaultOptions: (partial) => chartFactoryDefaults(def.type, partial),
|
|
1551
|
+
binding: { bind: (options, data) => bindChartData(def.type, options, data) }
|
|
1552
|
+
})),
|
|
1553
|
+
render: {
|
|
1554
|
+
html: renderChartElement,
|
|
1555
|
+
createRenderer: () => ({ render: renderChartElement })
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
var disposeHandle;
|
|
1559
|
+
function registerChartPlugin(designer, extraRender) {
|
|
1560
|
+
const current = getElementPluginById(CHART_PLUGIN_ID);
|
|
1561
|
+
if (!designer && !extraRender) {
|
|
1562
|
+
const dispose2 = registerElementPlugin(CHART_PLUGIN);
|
|
1563
|
+
disposeHandle = dispose2;
|
|
1564
|
+
return dispose2;
|
|
1565
|
+
}
|
|
1566
|
+
const merged = {
|
|
1567
|
+
...CHART_PLUGIN,
|
|
1568
|
+
designer: designer ?? current?.designer ?? CHART_PLUGIN.designer,
|
|
1569
|
+
render: { ...CHART_PLUGIN.render, ...current?.render, ...extraRender }
|
|
1570
|
+
};
|
|
1571
|
+
const dispose = registerElementPlugin(merged);
|
|
1572
|
+
disposeHandle = dispose;
|
|
1573
|
+
return dispose;
|
|
1574
|
+
}
|
|
1575
|
+
registerChartPlugin();
|
|
1576
|
+
|
|
1577
|
+
// src/ui.ts
|
|
1578
|
+
var activeT = globalT;
|
|
1579
|
+
var t2 = (key, params) => activeT(key, params);
|
|
1580
|
+
function withTranslator(translator, render2) {
|
|
1581
|
+
const prev = activeT;
|
|
1582
|
+
activeT = translator ?? globalT;
|
|
1583
|
+
try {
|
|
1584
|
+
return render2();
|
|
1585
|
+
} finally {
|
|
1586
|
+
activeT = prev;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
30
1589
|
var CANVAS_STYLE = "width:100%;height:100%;min-width:0;min-height:0;pointer-events:none";
|
|
31
1590
|
var STYLES = [
|
|
32
1591
|
".echarts-canvas-element{overflow:hidden}",
|
|
33
1592
|
".echarts-field-row{display:flex;gap:6px;align-items:center}",
|
|
34
1593
|
".echarts-field-row>.pd-input{flex:1;min-width:0}",
|
|
35
|
-
".echarts-field-row>.pd-button{flex:none}"
|
|
1594
|
+
".echarts-field-row>.pd-button{flex:none}",
|
|
1595
|
+
".echarts-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;height:26px;min-height:26px;padding:3px 6px;border:1px solid var(--pd-border,#d9dde6);border-radius:6px;background:var(--pd-input-bg,#fff);color:inherit;font:inherit;box-sizing:border-box;cursor:pointer;text-align:left}",
|
|
1596
|
+
".echarts-dropdown-trigger:hover{border-color:var(--pd-text-faint,#b4b9c4)}",
|
|
1597
|
+
'.echarts-dropdown-trigger[aria-expanded="true"]{border-color:var(--pd-accent,#165dff);box-shadow:0 0 0 2px rgb(22 93 255 / 12%)}',
|
|
1598
|
+
".echarts-dropdown-value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
1599
|
+
".echarts-dropdown-arrow{flex:none;color:var(--pd-text-muted,#909399);font-size:10px;transition:transform .14s}",
|
|
1600
|
+
'.echarts-dropdown-trigger[aria-expanded="true"] .echarts-dropdown-arrow{transform:rotate(180deg)}',
|
|
1601
|
+
".echarts-dropdown-panel{position:fixed;z-index:1200;max-height:240px;overflow:auto;padding:3px;border:1px solid var(--pd-border,#d9dde6);border-radius:6px;background:var(--pd-input-bg,#fff);box-shadow:0 6px 18px rgb(0 0 0 / 14%);box-sizing:border-box}",
|
|
1602
|
+
".echarts-dropdown-option{padding:5px 8px;border-radius:4px;cursor:pointer;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",
|
|
1603
|
+
".echarts-dropdown-option:hover{background:var(--pd-accent-soft,rgb(22 93 255 / 9%))}",
|
|
1604
|
+
".echarts-dropdown-option.is-active{background:var(--pd-accent-soft,rgb(22 93 255 / 9%));color:var(--pd-accent,#165dff)}",
|
|
1605
|
+
".echarts-label-group{margin-top:8px;border-top:1px solid var(--pd-border,#e5e7eb);padding-top:8px}",
|
|
1606
|
+
".echarts-label-group>summary{display:flex;align-items:center;cursor:pointer;list-style:none;font-size:12px;font-weight:600}",
|
|
1607
|
+
".echarts-label-summary>.pd-field{flex:1;margin:0;font-weight:400}",
|
|
1608
|
+
".echarts-label-sub{font-size:11px;color:var(--pd-text-secondary,#6b7280);margin:8px 0 4px}"
|
|
36
1609
|
].join("");
|
|
37
1610
|
var CHART_OPTION_KEYS = [
|
|
38
1611
|
"chartOption",
|
|
@@ -60,11 +1633,13 @@ var SEARCH_KEYWORDS = [
|
|
|
60
1633
|
"\u6563\u70B9",
|
|
61
1634
|
"\u96F7\u8FBE",
|
|
62
1635
|
"\u6F0F\u6597",
|
|
63
|
-
"\u4EEA\u8868"
|
|
1636
|
+
"\u4EEA\u8868",
|
|
1637
|
+
"\u6570\u636E\u6807\u7B7E",
|
|
1638
|
+
"\u6570\u503C\u6807\u7B7E",
|
|
1639
|
+
"label"
|
|
64
1640
|
];
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
function escapeHtml(value) {
|
|
1641
|
+
var panelHint = () => t2("echarts.panel.hint.dataBinding");
|
|
1642
|
+
function escapeHtml2(value) {
|
|
68
1643
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
69
1644
|
}
|
|
70
1645
|
function elementType(element) {
|
|
@@ -104,18 +1679,45 @@ function maxValueFields(def) {
|
|
|
104
1679
|
}
|
|
105
1680
|
}
|
|
106
1681
|
function valueFieldsLabel(def, limit) {
|
|
107
|
-
if (def?.seriesType === "radar") return "
|
|
108
|
-
return limit === 1 ? "
|
|
1682
|
+
if (def?.seriesType === "radar") return t2("echarts.panel.field.dimension");
|
|
1683
|
+
return limit === 1 ? t2("echarts.panel.field.value") : t2("echarts.panel.field.valueMulti");
|
|
109
1684
|
}
|
|
110
1685
|
function dataSourceCandidates(data) {
|
|
111
1686
|
const first = data?.[0];
|
|
112
1687
|
if (!first) return [];
|
|
113
1688
|
return Object.keys(first).filter((key) => Array.isArray(first[key]));
|
|
114
1689
|
}
|
|
1690
|
+
function dataRowFields(data, dataSource) {
|
|
1691
|
+
const first = data?.[0];
|
|
1692
|
+
if (!first) return [];
|
|
1693
|
+
const key = dataSource && Array.isArray(first[dataSource]) ? dataSource : Object.keys(first).find((k) => Array.isArray(first[k]));
|
|
1694
|
+
if (!key) return [];
|
|
1695
|
+
const rows = first[key];
|
|
1696
|
+
return rows.length > 0 && typeof rows[0] === "object" && rows[0] !== null ? Object.keys(rows[0]) : [];
|
|
1697
|
+
}
|
|
1698
|
+
function fieldLabelMap(fields) {
|
|
1699
|
+
const map = /* @__PURE__ */ new Map();
|
|
1700
|
+
for (const field2 of fields ?? []) {
|
|
1701
|
+
if (field2.fieldKey && field2.fieldLabel) map.set(field2.fieldKey, field2.fieldLabel);
|
|
1702
|
+
}
|
|
1703
|
+
return map;
|
|
1704
|
+
}
|
|
1705
|
+
function optionLabel(value, labels, fallbackSuffix) {
|
|
1706
|
+
if (!value) return fallbackSuffix ?? t2("echarts.panel.default");
|
|
1707
|
+
const name = labels.get(value);
|
|
1708
|
+
const base = name ? `${name}\uFF08${value}\uFF09` : value;
|
|
1709
|
+
return fallbackSuffix ? `${base}${fallbackSuffix}` : base;
|
|
1710
|
+
}
|
|
1711
|
+
function dropdownOptions(candidates, current, labels = /* @__PURE__ */ new Map()) {
|
|
1712
|
+
const opts = candidates.map((value) => ({ value, label: optionLabel(value, labels) }));
|
|
1713
|
+
if (current && !candidates.includes(current)) opts.unshift({ value: current, label: optionLabel(current, labels, t2("echarts.panel.current")) });
|
|
1714
|
+
if (!current) opts.unshift({ value: "", label: t2("echarts.panel.defaultFirstArray") });
|
|
1715
|
+
return opts;
|
|
1716
|
+
}
|
|
115
1717
|
function seriesList(option) {
|
|
116
1718
|
return Array.isArray(option.series) ? option.series : [];
|
|
117
1719
|
}
|
|
118
|
-
function
|
|
1720
|
+
function clamp2(value, min, max) {
|
|
119
1721
|
return Math.min(max, Math.max(min, value));
|
|
120
1722
|
}
|
|
121
1723
|
function syncValueFields(ctx, type, nextFields) {
|
|
@@ -136,13 +1738,13 @@ function renderCanvas(ctx) {
|
|
|
136
1738
|
try {
|
|
137
1739
|
const preview = previewChartOption(type, rawChartOption(element) ?? createDefaultChartOption(type));
|
|
138
1740
|
const option = normalizeChartOption(type, preview);
|
|
139
|
-
if (!option || typeof option !== "object" || Array.isArray(option)) throw new Error("
|
|
1741
|
+
if (!option || typeof option !== "object" || Array.isArray(option)) throw new Error(t2("echarts.panel.error.invalidOption"));
|
|
140
1742
|
const fontFamily = typeof options.fontFamily === "string" && options.fontFamily ? options.fontFamily : void 0;
|
|
141
1743
|
const svg = renderChartToSvg({ key: element.id, type, option, widthMm, heightMm, fontFamily });
|
|
142
1744
|
return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${svg}</div>`;
|
|
143
1745
|
} catch {
|
|
144
|
-
const title = typeof options.title === "string" && options.title.trim() ? options.title : getChartKindDefinition(type)?.label ?? "
|
|
145
|
-
return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${
|
|
1746
|
+
const title = typeof options.title === "string" && options.title.trim() ? options.title : getChartKindDefinition(type)?.label ?? t2("echarts.panel.chartFallback");
|
|
1747
|
+
return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${escapeHtml2(title)}</div>`;
|
|
146
1748
|
}
|
|
147
1749
|
}
|
|
148
1750
|
function el(tag, className, text) {
|
|
@@ -178,7 +1780,277 @@ function checkboxField(labelText, checked, onCommit) {
|
|
|
178
1780
|
wrap.appendChild(input);
|
|
179
1781
|
return wrap;
|
|
180
1782
|
}
|
|
1783
|
+
function selectInput(options, value, onCommit) {
|
|
1784
|
+
const select = el("select", "pd-select");
|
|
1785
|
+
for (const item of options) {
|
|
1786
|
+
const optionEl = el("option");
|
|
1787
|
+
optionEl.value = item.value;
|
|
1788
|
+
optionEl.textContent = item.label;
|
|
1789
|
+
select.appendChild(optionEl);
|
|
1790
|
+
}
|
|
1791
|
+
select.value = value;
|
|
1792
|
+
select.addEventListener("change", () => onCommit(select.value));
|
|
1793
|
+
return select;
|
|
1794
|
+
}
|
|
1795
|
+
var activeDropdown = null;
|
|
1796
|
+
function composedPathOf(ev) {
|
|
1797
|
+
const composed = typeof ev.composedPath === "function" ? ev.composedPath() : [];
|
|
1798
|
+
return composed.length ? composed : [ev.target];
|
|
1799
|
+
}
|
|
1800
|
+
function dropdownSelect(options, value, onCommit) {
|
|
1801
|
+
const current = options.find((item) => item.value === value) ?? { value, label: value || t2("echarts.panel.optionDefault") };
|
|
1802
|
+
const trigger = el("button", "echarts-dropdown-trigger");
|
|
1803
|
+
trigger.type = "button";
|
|
1804
|
+
trigger.setAttribute("aria-haspopup", "listbox");
|
|
1805
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
1806
|
+
const valueEl = el("span", "echarts-dropdown-value", current.label);
|
|
1807
|
+
const arrow = el("span", "echarts-dropdown-arrow", "\u25BE");
|
|
1808
|
+
trigger.appendChild(valueEl);
|
|
1809
|
+
trigger.appendChild(arrow);
|
|
1810
|
+
let panel = null;
|
|
1811
|
+
let off = [];
|
|
1812
|
+
const close = () => {
|
|
1813
|
+
off.forEach((fn) => fn());
|
|
1814
|
+
off = [];
|
|
1815
|
+
panel?.remove();
|
|
1816
|
+
panel = null;
|
|
1817
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
1818
|
+
if (activeDropdown?.close === close) activeDropdown = null;
|
|
1819
|
+
};
|
|
1820
|
+
const open = () => {
|
|
1821
|
+
activeDropdown?.close();
|
|
1822
|
+
const root = trigger.getRootNode();
|
|
1823
|
+
const mount = root instanceof ShadowRoot ? root : document.body;
|
|
1824
|
+
panel = el("div", "echarts-dropdown-panel");
|
|
1825
|
+
panel.setAttribute("role", "listbox");
|
|
1826
|
+
for (const item of options) {
|
|
1827
|
+
const optionEl = el("div", `echarts-dropdown-option${item.value === value ? " is-active" : ""}`, item.label);
|
|
1828
|
+
optionEl.setAttribute("role", "option");
|
|
1829
|
+
optionEl.setAttribute("aria-selected", item.value === value ? "true" : "false");
|
|
1830
|
+
optionEl.addEventListener("click", (ev) => {
|
|
1831
|
+
ev.stopPropagation();
|
|
1832
|
+
close();
|
|
1833
|
+
onCommit(item.value);
|
|
1834
|
+
});
|
|
1835
|
+
panel.appendChild(optionEl);
|
|
1836
|
+
}
|
|
1837
|
+
mount.appendChild(panel);
|
|
1838
|
+
const rect = trigger.getBoundingClientRect();
|
|
1839
|
+
panel.style.left = `${rect.left}px`;
|
|
1840
|
+
panel.style.top = `${rect.bottom + 4}px`;
|
|
1841
|
+
panel.style.minWidth = `${rect.width}px`;
|
|
1842
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
1843
|
+
activeDropdown = { close };
|
|
1844
|
+
const onPointerDown = (ev) => {
|
|
1845
|
+
const path = composedPathOf(ev);
|
|
1846
|
+
if (path.includes(trigger) || path.includes(panel)) return;
|
|
1847
|
+
close();
|
|
1848
|
+
};
|
|
1849
|
+
const onKeydown = (ev) => {
|
|
1850
|
+
if (ev.key === "Escape") close();
|
|
1851
|
+
};
|
|
1852
|
+
const onScroll = () => close();
|
|
1853
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
1854
|
+
document.addEventListener("keydown", onKeydown);
|
|
1855
|
+
window.addEventListener("scroll", onScroll, true);
|
|
1856
|
+
window.addEventListener("resize", onScroll);
|
|
1857
|
+
root.addEventListener("scroll", onScroll, true);
|
|
1858
|
+
off.push(
|
|
1859
|
+
() => document.removeEventListener("pointerdown", onPointerDown, true),
|
|
1860
|
+
() => document.removeEventListener("keydown", onKeydown),
|
|
1861
|
+
() => window.removeEventListener("scroll", onScroll, true),
|
|
1862
|
+
() => window.removeEventListener("resize", onScroll),
|
|
1863
|
+
() => root.removeEventListener("scroll", onScroll, true)
|
|
1864
|
+
);
|
|
1865
|
+
};
|
|
1866
|
+
trigger.addEventListener("click", (ev) => {
|
|
1867
|
+
ev.stopPropagation();
|
|
1868
|
+
if (panel) close();
|
|
1869
|
+
else open();
|
|
1870
|
+
});
|
|
1871
|
+
return trigger;
|
|
1872
|
+
}
|
|
1873
|
+
var overflowOptions = () => [
|
|
1874
|
+
{ value: "", label: t2("echarts.panel.overflow.default") },
|
|
1875
|
+
{ value: "none", label: t2("echarts.panel.overflow.none") },
|
|
1876
|
+
{ value: "truncate", label: t2("echarts.panel.overflow.truncate") },
|
|
1877
|
+
{ value: "break", label: t2("echarts.panel.overflow.break") }
|
|
1878
|
+
];
|
|
1879
|
+
var fontWeightOptions = () => [
|
|
1880
|
+
{ value: "", label: t2("echarts.panel.fontWeight.default") },
|
|
1881
|
+
{ value: "normal", label: t2("echarts.panel.fontWeight.normal") },
|
|
1882
|
+
{ value: "bold", label: t2("echarts.panel.fontWeight.bold") }
|
|
1883
|
+
];
|
|
1884
|
+
var styleFieldLabels = () => ({
|
|
1885
|
+
distance: t2("echarts.panel.label.distance"),
|
|
1886
|
+
rotate: t2("echarts.panel.label.rotate"),
|
|
1887
|
+
fontSize: t2("echarts.panel.label.fontSize"),
|
|
1888
|
+
fontWeight: t2("echarts.panel.label.fontWeight"),
|
|
1889
|
+
color: t2("echarts.panel.label.color"),
|
|
1890
|
+
backgroundColor: t2("echarts.panel.label.backgroundColor"),
|
|
1891
|
+
borderColor: t2("echarts.panel.label.borderColor"),
|
|
1892
|
+
borderWidth: t2("echarts.panel.label.borderWidth"),
|
|
1893
|
+
borderRadius: t2("echarts.panel.label.borderRadius"),
|
|
1894
|
+
padding: t2("echarts.panel.label.padding")
|
|
1895
|
+
});
|
|
1896
|
+
function renderLabelGroup(ctx, type) {
|
|
1897
|
+
const element = ctx.element;
|
|
1898
|
+
const def = getChartKindDefinition(type);
|
|
1899
|
+
const fields = labelFieldsOf(type);
|
|
1900
|
+
const has = (key) => fields.includes(key);
|
|
1901
|
+
const state = readChartLabel(panelOption(element), type);
|
|
1902
|
+
const styleLabels = styleFieldLabels();
|
|
1903
|
+
const commit = (patch) => {
|
|
1904
|
+
commitOption(ctx, type, updateChartLabel(panelOption(element), type, patch));
|
|
1905
|
+
};
|
|
1906
|
+
const commitNumber = (key, raw) => {
|
|
1907
|
+
if (raw.trim() === "") return commit({ [key]: null });
|
|
1908
|
+
const value = Number(raw);
|
|
1909
|
+
if (!Number.isFinite(value)) return;
|
|
1910
|
+
commit({ [key]: value });
|
|
1911
|
+
};
|
|
1912
|
+
const commitLineNumber = (key, raw) => {
|
|
1913
|
+
if (raw.trim() === "") return commit({ labelLine: { [key]: null } });
|
|
1914
|
+
const value = Number(raw);
|
|
1915
|
+
if (!Number.isFinite(value)) return;
|
|
1916
|
+
commit({ labelLine: { [key]: value } });
|
|
1917
|
+
};
|
|
1918
|
+
const numberField = (key, value) => {
|
|
1919
|
+
const wrap = field(styleLabels[key] ?? key);
|
|
1920
|
+
wrap.appendChild(
|
|
1921
|
+
textInput({ value: value === void 0 ? "" : String(value), type: "number" }, (raw) => commitNumber(key, raw))
|
|
1922
|
+
);
|
|
1923
|
+
return wrap;
|
|
1924
|
+
};
|
|
1925
|
+
const colorField = (key, value) => {
|
|
1926
|
+
const wrap = field(styleLabels[key] ?? key);
|
|
1927
|
+
const holder = el("span");
|
|
1928
|
+
render(colorPicker({
|
|
1929
|
+
value: value ?? "",
|
|
1930
|
+
title: styleLabels[key] ?? key,
|
|
1931
|
+
// 面板点击时才构建,届时候选渲染期 translator 已还原,必须固化 ctx.t
|
|
1932
|
+
translator: ctx.t,
|
|
1933
|
+
onChange: (next) => commit({ [key]: next ?? "" })
|
|
1934
|
+
}), holder);
|
|
1935
|
+
wrap.appendChild(holder);
|
|
1936
|
+
return wrap;
|
|
1937
|
+
};
|
|
1938
|
+
const group = el("details", "echarts-label-group");
|
|
1939
|
+
group.open = state.show;
|
|
1940
|
+
const summary = el("summary", "echarts-label-summary");
|
|
1941
|
+
const toggle = checkboxField(t2("echarts.panel.label.show"), state.show, (checked) => commit({ enabled: checked }));
|
|
1942
|
+
toggle.querySelector("input")?.addEventListener("click", (event) => event.stopPropagation());
|
|
1943
|
+
summary.appendChild(toggle);
|
|
1944
|
+
group.appendChild(summary);
|
|
1945
|
+
if (has("formatter") || has("overflow")) {
|
|
1946
|
+
group.appendChild(el("div", "echarts-label-sub", t2("echarts.panel.label.content")));
|
|
1947
|
+
if (has("formatter")) {
|
|
1948
|
+
const wrap = field(t2("echarts.panel.label.formatterTitle"));
|
|
1949
|
+
wrap.appendChild(
|
|
1950
|
+
selectInput(
|
|
1951
|
+
[{ value: "", label: t2("echarts.panel.label.formatterCustom") }, ...LABEL_PRESETS.map((preset) => ({ value: preset.formatter, label: t2(preset.labelKey) }))],
|
|
1952
|
+
state.formatter ?? "",
|
|
1953
|
+
(value) => commit({ formatter: value })
|
|
1954
|
+
)
|
|
1955
|
+
);
|
|
1956
|
+
wrap.appendChild(
|
|
1957
|
+
textInput({ value: state.formatter ?? "", placeholder: t2("echarts.panel.label.formatterPlaceholder") }, (value) => commit({ formatter: value }))
|
|
1958
|
+
);
|
|
1959
|
+
group.appendChild(wrap);
|
|
1960
|
+
}
|
|
1961
|
+
if (has("overflow")) {
|
|
1962
|
+
const wrap = field(t2("echarts.panel.label.overflow"));
|
|
1963
|
+
wrap.appendChild(selectInput(overflowOptions(), state.overflow ?? "", (value) => commit({ overflow: value })));
|
|
1964
|
+
group.appendChild(wrap);
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
if (has("position") || has("distance") || has("rotate") || has("offset")) {
|
|
1968
|
+
group.appendChild(el("div", "echarts-label-sub", t2("echarts.panel.label.position")));
|
|
1969
|
+
if (has("position")) {
|
|
1970
|
+
const wrap = field(t2("echarts.panel.label.positionTitle"));
|
|
1971
|
+
const positions = def ? LABEL_POSITIONS[def.seriesType] ?? [] : [];
|
|
1972
|
+
wrap.appendChild(
|
|
1973
|
+
selectInput([{ value: "", label: t2("echarts.panel.label.positionDefault") }, ...positions.map((p) => ({ value: p.value, label: t2(p.labelKey) }))], state.position ?? "", (value) => commit({ position: value }))
|
|
1974
|
+
);
|
|
1975
|
+
group.appendChild(wrap);
|
|
1976
|
+
}
|
|
1977
|
+
if (has("distance")) group.appendChild(numberField("distance", state.distance));
|
|
1978
|
+
if (has("rotate")) group.appendChild(numberField("rotate", state.rotate));
|
|
1979
|
+
if (has("offset")) {
|
|
1980
|
+
let commitOffset2 = function() {
|
|
1981
|
+
const parse = (input, fallback) => {
|
|
1982
|
+
const text = input.value.trim();
|
|
1983
|
+
if (text === "") return 0;
|
|
1984
|
+
const value = Number(text);
|
|
1985
|
+
return Number.isFinite(value) ? value : fallback;
|
|
1986
|
+
};
|
|
1987
|
+
commit({ offset: [parse(inputX, current[0] ?? 0), parse(inputY, current[1] ?? 0)] });
|
|
1988
|
+
};
|
|
1989
|
+
var commitOffset = commitOffset2;
|
|
1990
|
+
const wrap = field(t2("echarts.panel.label.offset"));
|
|
1991
|
+
const row = el("div", "echarts-field-row");
|
|
1992
|
+
const current = state.offset ?? [0, 0];
|
|
1993
|
+
const inputX = textInput({ value: String(current[0] ?? 0), type: "number" }, () => commitOffset2());
|
|
1994
|
+
const inputY = textInput({ value: String(current[1] ?? 0), type: "number" }, () => commitOffset2());
|
|
1995
|
+
row.appendChild(inputX);
|
|
1996
|
+
row.appendChild(inputY);
|
|
1997
|
+
wrap.appendChild(row);
|
|
1998
|
+
group.appendChild(wrap);
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
const styleKeys = ["fontSize", "fontWeight", "color", "backgroundColor", "borderColor", "borderWidth", "borderRadius", "padding"];
|
|
2002
|
+
if (styleKeys.some(has)) {
|
|
2003
|
+
group.appendChild(el("div", "echarts-label-sub", t2("echarts.panel.label.style")));
|
|
2004
|
+
if (has("fontSize")) group.appendChild(numberField("fontSize", state.fontSize));
|
|
2005
|
+
if (has("fontWeight")) {
|
|
2006
|
+
const wrap = field(t2("echarts.panel.labelLine.fontWeight"));
|
|
2007
|
+
wrap.appendChild(selectInput(fontWeightOptions(), state.fontWeight ?? "", (value) => commit({ fontWeight: value })));
|
|
2008
|
+
group.appendChild(wrap);
|
|
2009
|
+
}
|
|
2010
|
+
for (const key of ["color", "backgroundColor", "borderColor"]) {
|
|
2011
|
+
if (has(key)) group.appendChild(colorField(key, state[key]));
|
|
2012
|
+
}
|
|
2013
|
+
for (const key of ["borderWidth", "borderRadius", "padding"]) {
|
|
2014
|
+
if (has(key)) group.appendChild(numberField(key, state[key]));
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
if (has("labelLine.show")) {
|
|
2018
|
+
group.appendChild(el("div", "echarts-label-sub", t2("echarts.panel.labelLine")));
|
|
2019
|
+
group.appendChild(
|
|
2020
|
+
checkboxField(t2("echarts.panel.labelLine.show"), state.labelLine.show === true, (checked) => commit({ labelLine: { show: checked } }))
|
|
2021
|
+
);
|
|
2022
|
+
if (has("labelLine.length")) {
|
|
2023
|
+
const wrap = field(t2("echarts.panel.labelLine.length"));
|
|
2024
|
+
wrap.appendChild(
|
|
2025
|
+
textInput(
|
|
2026
|
+
{ value: state.labelLine.length === void 0 ? "" : String(state.labelLine.length), type: "number" },
|
|
2027
|
+
(raw) => commitLineNumber("length", raw)
|
|
2028
|
+
)
|
|
2029
|
+
);
|
|
2030
|
+
group.appendChild(wrap);
|
|
2031
|
+
}
|
|
2032
|
+
if (has("labelLine.length2")) {
|
|
2033
|
+
const wrap = field(t2("echarts.panel.labelLine.length2"));
|
|
2034
|
+
wrap.appendChild(
|
|
2035
|
+
textInput(
|
|
2036
|
+
{ value: state.labelLine.length2 === void 0 ? "" : String(state.labelLine.length2), type: "number" },
|
|
2037
|
+
(raw) => commitLineNumber("length2", raw)
|
|
2038
|
+
)
|
|
2039
|
+
);
|
|
2040
|
+
group.appendChild(wrap);
|
|
2041
|
+
}
|
|
2042
|
+
if (has("labelLine.smooth")) {
|
|
2043
|
+
group.appendChild(
|
|
2044
|
+
checkboxField(t2("echarts.panel.labelLine.smooth"), state.labelLine.smooth === true, (checked) => commit({ labelLine: { smooth: checked } }))
|
|
2045
|
+
);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
return group;
|
|
2049
|
+
}
|
|
181
2050
|
function renderProperty(ctx) {
|
|
2051
|
+
return withTranslator(ctx.t, () => renderPropertyInner(ctx));
|
|
2052
|
+
}
|
|
2053
|
+
function renderPropertyInner(ctx) {
|
|
182
2054
|
const element = ctx.element;
|
|
183
2055
|
const type = elementType(element);
|
|
184
2056
|
const def = getChartKindDefinition(type);
|
|
@@ -189,41 +2061,30 @@ function renderProperty(ctx) {
|
|
|
189
2061
|
const heightMm = Number(options.height) || 0;
|
|
190
2062
|
const limit = maxValueFields(def);
|
|
191
2063
|
const palettes = getChartPalettes();
|
|
2064
|
+
const fieldLabels = fieldLabelMap(ctx.fields);
|
|
192
2065
|
const root = el("div", "echarts-property");
|
|
193
2066
|
const form = el("form", "pd-form");
|
|
194
2067
|
form.addEventListener("submit", (event) => event.preventDefault());
|
|
195
2068
|
root.appendChild(form);
|
|
196
2069
|
if (has("dataSource")) {
|
|
197
|
-
const wrap = field("
|
|
198
|
-
const
|
|
199
|
-
let datalist;
|
|
200
|
-
if (candidates.length > 0) {
|
|
201
|
-
datalist = el("datalist");
|
|
202
|
-
datalist.id = `echarts-ds-${++datalistSeq}`;
|
|
203
|
-
for (const key of candidates) {
|
|
204
|
-
const optionEl = el("option");
|
|
205
|
-
optionEl.value = key;
|
|
206
|
-
datalist.appendChild(optionEl);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
2070
|
+
const wrap = field(t2("echarts.panel.dataSourceTitle"));
|
|
2071
|
+
const current = String(options.chartDataSource ?? "");
|
|
209
2072
|
wrap.appendChild(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
placeholder: "\u6570\u636E\u96C6\u8DEF\u5F84\uFF08\u7559\u7A7A\u53D6\u9876\u5C42\u7B2C\u4E00\u4E2A\u6570\u7EC4\uFF09",
|
|
214
|
-
list: datalist?.id
|
|
215
|
-
},
|
|
2073
|
+
dropdownSelect(
|
|
2074
|
+
dropdownOptions(dataSourceCandidates(ctx.data), current, fieldLabels),
|
|
2075
|
+
current,
|
|
216
2076
|
(value) => commitOption(ctx, type, panelOption(element), { chartDataSource: value })
|
|
217
2077
|
)
|
|
218
2078
|
);
|
|
219
|
-
if (datalist) wrap.appendChild(datalist);
|
|
220
2079
|
form.appendChild(wrap);
|
|
221
2080
|
}
|
|
222
2081
|
if (has("categoryField")) {
|
|
223
|
-
const wrap = field("
|
|
2082
|
+
const wrap = field(t2("echarts.panel.categoryField"));
|
|
2083
|
+
const current = String(options.chartCategoryField ?? "");
|
|
224
2084
|
wrap.appendChild(
|
|
225
|
-
|
|
226
|
-
|
|
2085
|
+
dropdownSelect(
|
|
2086
|
+
dropdownOptions(dataRowFields(ctx.data, String(options.chartDataSource ?? "")), current, fieldLabels),
|
|
2087
|
+
current,
|
|
227
2088
|
(value) => commitOption(ctx, type, panelOption(element), { chartCategoryField: value })
|
|
228
2089
|
)
|
|
229
2090
|
);
|
|
@@ -235,8 +2096,9 @@ function renderProperty(ctx) {
|
|
|
235
2096
|
fieldsNow.forEach((value, index) => {
|
|
236
2097
|
const row = el("div", "echarts-field-row");
|
|
237
2098
|
row.appendChild(
|
|
238
|
-
|
|
239
|
-
|
|
2099
|
+
dropdownSelect(
|
|
2100
|
+
dropdownOptions(dataRowFields(ctx.data, String(options.chartDataSource ?? "")), value, fieldLabels),
|
|
2101
|
+
value,
|
|
240
2102
|
(next) => {
|
|
241
2103
|
const list = readValueFields(element);
|
|
242
2104
|
list[index] = next;
|
|
@@ -247,14 +2109,14 @@ function renderProperty(ctx) {
|
|
|
247
2109
|
if (fieldsNow.length > 1) {
|
|
248
2110
|
const remove = el("button", "pd-button small", "\u2212");
|
|
249
2111
|
remove.type = "button";
|
|
250
|
-
remove.title = "
|
|
2112
|
+
remove.title = t2("echarts.panel.removeField");
|
|
251
2113
|
remove.addEventListener("click", () => syncValueFields(ctx, type, readValueFields(element).filter((_, i) => i !== index)));
|
|
252
2114
|
row.appendChild(remove);
|
|
253
2115
|
}
|
|
254
2116
|
wrap.appendChild(row);
|
|
255
2117
|
});
|
|
256
2118
|
if (fieldsNow.length < limit) {
|
|
257
|
-
const add = el("button", "pd-button small", "
|
|
2119
|
+
const add = el("button", "pd-button small", t2("echarts.panel.addField"));
|
|
258
2120
|
add.type = "button";
|
|
259
2121
|
add.addEventListener("click", () => syncValueFields(ctx, type, [...readValueFields(element), ""]));
|
|
260
2122
|
wrap.appendChild(add);
|
|
@@ -262,10 +2124,10 @@ function renderProperty(ctx) {
|
|
|
262
2124
|
form.appendChild(wrap);
|
|
263
2125
|
}
|
|
264
2126
|
if (has("seriesField")) {
|
|
265
|
-
const wrap = field("
|
|
2127
|
+
const wrap = field(t2("echarts.panel.seriesField"));
|
|
266
2128
|
wrap.appendChild(
|
|
267
2129
|
textInput(
|
|
268
|
-
{ value: String(options.chartSeriesField ?? ""), placeholder: "
|
|
2130
|
+
{ value: String(options.chartSeriesField ?? ""), placeholder: t2("echarts.panel.seriesFieldHint") },
|
|
269
2131
|
(value) => commitOption(ctx, type, panelOption(element), { chartSeriesField: value })
|
|
270
2132
|
)
|
|
271
2133
|
);
|
|
@@ -273,16 +2135,16 @@ function renderProperty(ctx) {
|
|
|
273
2135
|
}
|
|
274
2136
|
if (has("bubble")) {
|
|
275
2137
|
form.appendChild(
|
|
276
|
-
checkboxField("
|
|
2138
|
+
checkboxField(t2("echarts.panel.bubbleSize"), options.chartBubble === true, (checked) => {
|
|
277
2139
|
commitOption(ctx, type, panelOption(element), { chartBubble: checked });
|
|
278
2140
|
})
|
|
279
2141
|
);
|
|
280
2142
|
}
|
|
281
2143
|
if (has("title")) {
|
|
282
|
-
const wrap = field("
|
|
2144
|
+
const wrap = field(t2("echarts.panel.title"));
|
|
283
2145
|
wrap.appendChild(
|
|
284
2146
|
textInput(
|
|
285
|
-
{ value: String(asObject(panelOption(element).title).text ?? ""), placeholder: "
|
|
2147
|
+
{ value: String(asObject(panelOption(element).title).text ?? ""), placeholder: t2("echarts.panel.titleHint") },
|
|
286
2148
|
(value) => {
|
|
287
2149
|
const next = panelOption(element);
|
|
288
2150
|
next.title = { ...asObject(next.title), text: value };
|
|
@@ -295,7 +2157,7 @@ function renderProperty(ctx) {
|
|
|
295
2157
|
if (has("legend")) {
|
|
296
2158
|
const show = asObject(panelOption(element).legend).show !== false;
|
|
297
2159
|
form.appendChild(
|
|
298
|
-
checkboxField("
|
|
2160
|
+
checkboxField(t2("echarts.panel.legend"), show, (checked) => {
|
|
299
2161
|
const next = panelOption(element);
|
|
300
2162
|
next.legend = { ...asObject(next.legend), show: checked };
|
|
301
2163
|
commitOption(ctx, type, next);
|
|
@@ -303,12 +2165,12 @@ function renderProperty(ctx) {
|
|
|
303
2165
|
);
|
|
304
2166
|
}
|
|
305
2167
|
if (has("palette")) {
|
|
306
|
-
const wrap = field("
|
|
2168
|
+
const wrap = field(t2("echarts.panel.palette"));
|
|
307
2169
|
const select = el("select", "pd-select");
|
|
308
2170
|
for (const palette of palettes) {
|
|
309
2171
|
const optionEl = el("option");
|
|
310
2172
|
optionEl.value = palette.key;
|
|
311
|
-
optionEl.textContent = palette.label;
|
|
2173
|
+
optionEl.textContent = palette.labelKey ? t2(palette.labelKey) : palette.label;
|
|
312
2174
|
select.appendChild(optionEl);
|
|
313
2175
|
}
|
|
314
2176
|
select.value = readPaletteKey(panelOption(element), palettes);
|
|
@@ -321,11 +2183,14 @@ function renderProperty(ctx) {
|
|
|
321
2183
|
wrap.appendChild(select);
|
|
322
2184
|
form.appendChild(wrap);
|
|
323
2185
|
}
|
|
2186
|
+
if (has("label")) {
|
|
2187
|
+
form.appendChild(renderLabelGroup(ctx, type));
|
|
2188
|
+
}
|
|
324
2189
|
if (has("stack")) {
|
|
325
2190
|
const series = seriesList(panelOption(element));
|
|
326
2191
|
const stacked = series.some((item) => item.stack !== void 0 && item.stack !== null && item.stack !== "");
|
|
327
2192
|
form.appendChild(
|
|
328
|
-
checkboxField("
|
|
2193
|
+
checkboxField(t2("echarts.panel.stack"), stacked, (checked) => {
|
|
329
2194
|
const next = panelOption(element);
|
|
330
2195
|
for (const item of seriesList(next)) {
|
|
331
2196
|
if (checked) item.stack = "total";
|
|
@@ -336,34 +2201,34 @@ function renderProperty(ctx) {
|
|
|
336
2201
|
);
|
|
337
2202
|
}
|
|
338
2203
|
if (has("innerRadius")) {
|
|
339
|
-
const wrap = field("
|
|
2204
|
+
const wrap = field(t2("echarts.panel.innerRadius"));
|
|
340
2205
|
const radius = seriesList(panelOption(element))[0]?.radius;
|
|
341
2206
|
const inner = Array.isArray(radius) ? Number(String(radius[0] ?? "40%").replace("%", "")) || 40 : 40;
|
|
342
2207
|
wrap.appendChild(
|
|
343
2208
|
textInput({ value: String(inner), type: "number", min: 0, max: 90 }, (value) => {
|
|
344
2209
|
const next = panelOption(element);
|
|
345
2210
|
const series = seriesList(next);
|
|
346
|
-
if (series[0]) series[0].radius = [`${
|
|
2211
|
+
if (series[0]) series[0].radius = [`${clamp2(Number(value) || 0, 0, 90)}%`, "70%"];
|
|
347
2212
|
commitOption(ctx, type, next);
|
|
348
2213
|
})
|
|
349
2214
|
);
|
|
350
2215
|
form.appendChild(wrap);
|
|
351
2216
|
}
|
|
352
2217
|
if (has("padding")) {
|
|
353
|
-
const wrap = field(
|
|
2218
|
+
const wrap = field(t2("echarts.panel.paddingTRBL"));
|
|
354
2219
|
const padding = readFunnelPadding(panelOption(element), widthMm, heightMm);
|
|
355
2220
|
const row = el("div", "echarts-field-row");
|
|
356
2221
|
const sides = [
|
|
357
|
-
{ side: "top", title: "
|
|
358
|
-
{ side: "right", title: "
|
|
359
|
-
{ side: "bottom", title: "
|
|
360
|
-
{ side: "left", title: "
|
|
2222
|
+
{ side: "top", title: t2("echarts.panel.paddingTop") },
|
|
2223
|
+
{ side: "right", title: t2("echarts.panel.paddingRight") },
|
|
2224
|
+
{ side: "bottom", title: t2("echarts.panel.paddingBottom") },
|
|
2225
|
+
{ side: "left", title: t2("echarts.panel.paddingLeft") }
|
|
361
2226
|
];
|
|
362
2227
|
for (const { side, title } of sides) {
|
|
363
2228
|
row.appendChild(
|
|
364
2229
|
textInput({ value: String(padding[side]), type: "number", min: 0, max: 60, title }, (value) => {
|
|
365
2230
|
const raw = Number(value);
|
|
366
|
-
const next = Number.isFinite(raw) ?
|
|
2231
|
+
const next = Number.isFinite(raw) ? clamp2(raw, 0, 60) : FUNNEL_PADDING_DEFAULTS[side];
|
|
367
2232
|
const option = panelOption(element);
|
|
368
2233
|
const current = readFunnelPadding(option, widthMm, heightMm);
|
|
369
2234
|
commitOption(ctx, type, writeFunnelPadding(option, { ...current, [side]: next }));
|
|
@@ -374,13 +2239,13 @@ function renderProperty(ctx) {
|
|
|
374
2239
|
form.appendChild(wrap);
|
|
375
2240
|
}
|
|
376
2241
|
if (has("radius")) {
|
|
377
|
-
const wrap = field("
|
|
2242
|
+
const wrap = field(t2("echarts.panel.radius"));
|
|
378
2243
|
wrap.appendChild(
|
|
379
2244
|
textInput(
|
|
380
2245
|
{ value: String(readRadarRadius(panelOption(element), widthMm, heightMm)), type: "number", min: 20, max: 100 },
|
|
381
2246
|
(value) => {
|
|
382
2247
|
const raw = Number(value);
|
|
383
|
-
const next = Number.isFinite(raw) ?
|
|
2248
|
+
const next = Number.isFinite(raw) ? clamp2(raw, 20, 100) : RADAR_RADIUS_DEFAULT;
|
|
384
2249
|
commitOption(ctx, type, writeRadarRadius(panelOption(element), next));
|
|
385
2250
|
}
|
|
386
2251
|
)
|
|
@@ -388,7 +2253,7 @@ function renderProperty(ctx) {
|
|
|
388
2253
|
form.appendChild(wrap);
|
|
389
2254
|
}
|
|
390
2255
|
if (has("gaugeRange")) {
|
|
391
|
-
const wrap = field("
|
|
2256
|
+
const wrap = field(t2("echarts.panel.minMax"));
|
|
392
2257
|
const series = seriesList(panelOption(element));
|
|
393
2258
|
const row = el("div", "echarts-field-row");
|
|
394
2259
|
row.appendChild(
|
|
@@ -410,7 +2275,7 @@ function renderProperty(ctx) {
|
|
|
410
2275
|
wrap.appendChild(row);
|
|
411
2276
|
form.appendChild(wrap);
|
|
412
2277
|
}
|
|
413
|
-
form.appendChild(el("p", "pd-hint",
|
|
2278
|
+
form.appendChild(el("p", "pd-hint", panelHint()));
|
|
414
2279
|
return root;
|
|
415
2280
|
}
|
|
416
2281
|
var CHART_ELEMENT_UI = defineElementUI({
|
|
@@ -418,19 +2283,21 @@ var CHART_ELEMENT_UI = defineElementUI({
|
|
|
418
2283
|
renderCanvas,
|
|
419
2284
|
renderProperty,
|
|
420
2285
|
hasProperties: chartHasProperties,
|
|
421
|
-
group: "
|
|
2286
|
+
group: t2("echarts.panel.group"),
|
|
422
2287
|
searchKeywords: SEARCH_KEYWORDS,
|
|
423
|
-
styles: STYLES
|
|
2288
|
+
styles: STYLES,
|
|
2289
|
+
i18nId: "echarts",
|
|
2290
|
+
locales: { "zh-CN": zh_CN_default.echarts, "en-US": en_US_default.echarts, "th-TH": th_TH_default.echarts }
|
|
424
2291
|
});
|
|
425
|
-
var
|
|
2292
|
+
var disposeHandle2;
|
|
426
2293
|
function installChartCommonUI() {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
return
|
|
2294
|
+
disposeHandle2?.();
|
|
2295
|
+
disposeHandle2 = registerElementUI(CHART_ELEMENT_UI);
|
|
2296
|
+
return disposeHandle2;
|
|
430
2297
|
}
|
|
431
2298
|
function uninstallChartCommonUI() {
|
|
432
|
-
|
|
433
|
-
|
|
2299
|
+
disposeHandle2?.();
|
|
2300
|
+
disposeHandle2 = void 0;
|
|
434
2301
|
}
|
|
435
2302
|
installChartCommonUI();
|
|
436
2303
|
export {
|