@ganwei-web/gw-base-components-plus 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/echartList/barEchart/dist/index.es.js +152 -0
- package/echartList/barEchart/dist/index.umd.js +1 -0
- package/echartList/barEchart/dist/style.css +1 -0
- package/echartList/curve/dist/index.es.js +217 -0
- package/echartList/curve/dist/index.umd.js +1 -0
- package/echartList/curve/dist/style.css +1 -0
- package/echartList/historyEchart/dist/index.es.js +292 -0
- package/echartList/historyEchart/dist/index.umd.js +10 -0
- package/echartList/historyEchart/dist/style.css +1 -0
- package/echartList/solid-bar/dist/index.es.js +290 -0
- package/echartList/solid-bar/dist/index.umd.js +1 -0
- package/echartList/solid-bar/dist/style.css +1 -0
- package/echartList/solid-circle/dist/index.es.js +332 -0
- package/echartList/solid-circle/dist/index.umd.js +6 -0
- package/echartList/solid-circle/dist/style.css +1 -0
- package/echartList/solid-pie/dist/index.es.js +336 -0
- package/echartList/solid-pie/dist/index.umd.js +6 -0
- package/echartList/solid-pie/dist/style.css +1 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs +902 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs.map +1 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.css +789 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js +903 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js.map +1 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.js +902 -0
- package/element-plus-adapter/dist/ElementPlusAdapter.js.map +1 -0
- package/equip-list-vue2/dist/index.es.js +1275 -0
- package/equip-list-vue2/dist/index.umd.js +1 -0
- package/equip-list-vue2/dist/style.css +1 -0
- package/equip-list-vue3/dist/index.es.js +1510 -0
- package/equip-list-vue3/dist/index.umd.js +1 -0
- package/equip-list-vue3/dist/style.css +1 -0
- package/equip-select-vue2/dist/index.es.js +231 -0
- package/equip-select-vue2/dist/index.umd.js +1 -0
- package/equip-select-vue2/dist/style.css +1 -0
- package/equip-select-vue3/dist/index.es.js +231 -0
- package/equip-select-vue3/dist/index.umd.js +1 -0
- package/equip-select-vue3/dist/style.css +1 -0
- package/equipProcessing/dist/index.es.js +203 -0
- package/equipProcessing/dist/index.umd.js +1 -0
- package/loadMore/dist/index.es.js +12 -0
- package/loadMore/dist/index.umd.js +1 -0
- package/loading/dist/index.es.js +25 -0
- package/loading/dist/index.umd.js +1 -0
- package/loading/dist/style.css +1 -0
- package/package.json +11 -0
- package/player/dist/index.es.js +1080 -0
- package/player/dist/index.umd.js +14 -0
- package/player/dist/style.css +1 -0
- package/selectV2/dist/index.es.js +190 -0
- package/selectV2/dist/index.umd.js +1 -0
- package/selectV2/dist/style.css +1 -0
- package/showPassword/dist/index.es.js +72 -0
- package/showPassword/dist/index.umd.js +1 -0
- package/table/dist/index.es.js +182 -0
- package/table/dist/index.umd.js +1 -0
- package/table/dist/style.css +1 -0
- package/widthSetting/dist/index.es.js +113 -0
- package/widthSetting/dist/index.umd.js +1 -0
- package/widthSetting/dist/style.css +1 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { createElementBlock as g, createElementVNode as m, normalizeStyle as S, openBlock as y, toDisplayString as x } from "vue";
|
|
2
|
+
|
|
3
|
+
import "./style.css";
|
|
4
|
+
const v = (s, t) => {
|
|
5
|
+
const e = s.__vccOpts || s;
|
|
6
|
+
for (const [i, a] of t) { e[i] = a; }
|
|
7
|
+
return e;
|
|
8
|
+
}, b = {
|
|
9
|
+
name: "cityGreenLand",
|
|
10
|
+
components: {},
|
|
11
|
+
props: {
|
|
12
|
+
data: {
|
|
13
|
+
type: Array,
|
|
14
|
+
required: !0
|
|
15
|
+
},
|
|
16
|
+
//图表名称
|
|
17
|
+
name: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
unit: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
width: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "100%"
|
|
28
|
+
},
|
|
29
|
+
height: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "100%"
|
|
32
|
+
},
|
|
33
|
+
showLegend: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
layoutOptions: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: () => {
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
seriesOptions: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: () => {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
echartId: "",
|
|
51
|
+
myChart: null,
|
|
52
|
+
optionData: [{
|
|
53
|
+
name: "林地面积统计",
|
|
54
|
+
value: 1e4,
|
|
55
|
+
itemStyle: {
|
|
56
|
+
color: "#22c4ff"
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
name: "草地面积统计",
|
|
60
|
+
value: 12116,
|
|
61
|
+
itemStyle: {
|
|
62
|
+
color: "#aaff00"
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
name: "耕地地面积统计",
|
|
66
|
+
value: 16616,
|
|
67
|
+
itemStyle: {
|
|
68
|
+
color: "#ffaaff"
|
|
69
|
+
}
|
|
70
|
+
}],
|
|
71
|
+
pieSeries: {
|
|
72
|
+
name: "pie2d",
|
|
73
|
+
type: "pie",
|
|
74
|
+
labelLine: {
|
|
75
|
+
length: 10,
|
|
76
|
+
length2: 10
|
|
77
|
+
},
|
|
78
|
+
label: {
|
|
79
|
+
color: "red",
|
|
80
|
+
show: !0
|
|
81
|
+
},
|
|
82
|
+
startAngle: -20,
|
|
83
|
+
//起始角度,支持范围[0, 360]。
|
|
84
|
+
clockwise: !1,
|
|
85
|
+
//饼图的扇区是否是顺时针排布。上述这两项配置主要是为了对齐3d的样式
|
|
86
|
+
radius: ["20%", "72%"],
|
|
87
|
+
center: ["48%", "55%"],
|
|
88
|
+
itemStyle: {
|
|
89
|
+
opacity: 1
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
computed: {
|
|
95
|
+
styleObject() {
|
|
96
|
+
return {
|
|
97
|
+
width: this.width,
|
|
98
|
+
height: this.height
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
created() {
|
|
103
|
+
this.echartId = this.myUtils.generateUUID();
|
|
104
|
+
},
|
|
105
|
+
mounted() {
|
|
106
|
+
this.init();
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
init() {
|
|
110
|
+
this.data.sort((s, t) => t.value - s.value), this.myChart = this.$echart.init(document.getElementById(this.echartId)), this.option = this.getPie3D(this.data, 0), this.option = this.merge(this.option, this.layoutOptions), this.pieSeries.data = JSON.parse(JSON.stringify(this.data)).map((s) => (s.itemStyle.color = "transparent", s)), this.option.series.push(this.merge(this.pieSeries, this.seriesOptions && this.seriesOptions.label || {})), console.log(this.option), this.myChart.setOption(this.option), this.bindListen(this.myChart), this.myChart.on("legendselectchanged", (s) => {
|
|
111
|
+
let t = JSON.parse(JSON.stringify(this.data));
|
|
112
|
+
t.forEach((e) => {
|
|
113
|
+
s.selected[e.name] || (e.value = 0);
|
|
114
|
+
}), this.option = this.getPie3D(t, 0), this.option = this.merge(this.option, this.layoutOptions), this.pieSeries.data = JSON.parse(JSON.stringify(t)).map((e) => (e.itemStyle.color = "transparent", e)), this.option.series.push(this.merge(this.pieSeries, this.seriesOptions && this.seriesOptions.label || {})), console.log(this.option), this.myChart.setOption(this.option);
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
getPie3D(s, t) {
|
|
118
|
+
let e = this, i = [], a = 0, n = 0, p = 0, l = [], d = 1 - t;
|
|
119
|
+
for (let o = 0; o < s.length; o++) {
|
|
120
|
+
a += s[o].value;
|
|
121
|
+
let h = {
|
|
122
|
+
name: typeof s[o].name > "u" ? `series${o}` : s[o].name,
|
|
123
|
+
type: "surface",
|
|
124
|
+
parametric: !0,
|
|
125
|
+
wireframe: {
|
|
126
|
+
show: !1
|
|
127
|
+
},
|
|
128
|
+
pieData: s[o],
|
|
129
|
+
pieStatus: {
|
|
130
|
+
selected: !1,
|
|
131
|
+
hovered: !1,
|
|
132
|
+
k: d
|
|
133
|
+
},
|
|
134
|
+
center: ["10%", "50%"]
|
|
135
|
+
};
|
|
136
|
+
if (this.merge(h, this.seriesOptions && this.seriesOptions.surface || {}), typeof s[o].itemStyle < "u") {
|
|
137
|
+
let r = {};
|
|
138
|
+
typeof s[o].itemStyle.color < "u" && (r.color = s[o].itemStyle.color), typeof s[o].itemStyle.opacity < "u" && (r.opacity = s[o].itemStyle.opacity), h.itemStyle = r;
|
|
139
|
+
}
|
|
140
|
+
i.push(h);
|
|
141
|
+
}
|
|
142
|
+
l = [];
|
|
143
|
+
for (let o = 0; o < i.length; o++) {
|
|
144
|
+
p = n + i[o].pieData.value, i[o].pieData.startRatio = n / a, i[o].pieData.endRatio = p / a, i[o].parametricEquation = this.getParametricEquation(
|
|
145
|
+
i[o].pieData.startRatio,
|
|
146
|
+
i[o].pieData.endRatio,
|
|
147
|
+
!1,
|
|
148
|
+
!1,
|
|
149
|
+
d,
|
|
150
|
+
i[o].pieData.value
|
|
151
|
+
), n = p;
|
|
152
|
+
let h = e.fomatFloat(i[o].pieData.value / a, 4);
|
|
153
|
+
l.push({
|
|
154
|
+
name: i[o].name,
|
|
155
|
+
value: h
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
let f = this.getHeight3D(i, 26), u = {
|
|
159
|
+
legend: {
|
|
160
|
+
data: l,
|
|
161
|
+
orient: "horizontal",
|
|
162
|
+
left: 10,
|
|
163
|
+
top: 10,
|
|
164
|
+
itemGap: 10,
|
|
165
|
+
textStyle: {
|
|
166
|
+
color: "#A1E2FF"
|
|
167
|
+
},
|
|
168
|
+
show: this.showLegend,
|
|
169
|
+
icon: "circle",
|
|
170
|
+
formatter: function(o) {
|
|
171
|
+
let h = l.filter((c) => c.name == o)[0], r = e.fomatFloat(h.value * 100, 2) + "%";
|
|
172
|
+
return `${h.name} ${r}`;
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
labelLine: {
|
|
176
|
+
show: !0,
|
|
177
|
+
lineStyle: {
|
|
178
|
+
color: "#7BC0CB"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
label: {
|
|
182
|
+
show: !0,
|
|
183
|
+
position: "outside",
|
|
184
|
+
rich: {
|
|
185
|
+
b: {
|
|
186
|
+
color: "#7BC0CB",
|
|
187
|
+
fontSize: 12,
|
|
188
|
+
lineHeight: 20
|
|
189
|
+
},
|
|
190
|
+
c: {
|
|
191
|
+
fontSize: 16
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
formatter: `{b|{b}
|
|
195
|
+
}{c|{c}}{b| 亩}`
|
|
196
|
+
},
|
|
197
|
+
tooltip: {
|
|
198
|
+
formatter: (o) => {
|
|
199
|
+
if (o.seriesName !== "mouseoutSeries" && o.seriesName !== "pie2d") {
|
|
200
|
+
let h = ((u.series[o.seriesIndex].pieData.endRatio - u.series[o.seriesIndex].pieData.startRatio) * 100).toFixed(2);
|
|
201
|
+
return `${o.seriesName}<br/><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${o.color};"></span>${h}%`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
xAxis3D: {
|
|
206
|
+
min: -1,
|
|
207
|
+
max: 1
|
|
208
|
+
},
|
|
209
|
+
yAxis3D: {
|
|
210
|
+
min: -1,
|
|
211
|
+
max: 1
|
|
212
|
+
},
|
|
213
|
+
zAxis3D: {
|
|
214
|
+
min: -1,
|
|
215
|
+
max: 1
|
|
216
|
+
},
|
|
217
|
+
grid3D: {
|
|
218
|
+
show: !1,
|
|
219
|
+
boxHeight: f,
|
|
220
|
+
//圆环的高度
|
|
221
|
+
viewControl: {
|
|
222
|
+
//3d效果可以放大、旋转等,请自己去查看官方配置
|
|
223
|
+
alpha: 40,
|
|
224
|
+
//角度
|
|
225
|
+
distance: 300,
|
|
226
|
+
//调整视角到主体的距离,类似调整zoom
|
|
227
|
+
rotateSensitivity: 0,
|
|
228
|
+
//设置为0无法旋转
|
|
229
|
+
zoomSensitivity: 0,
|
|
230
|
+
//设置为0无法缩放
|
|
231
|
+
panSensitivity: 0,
|
|
232
|
+
//设置为0无法平移
|
|
233
|
+
autoRotate: !1
|
|
234
|
+
//自动旋转
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
series: i
|
|
238
|
+
};
|
|
239
|
+
return u;
|
|
240
|
+
},
|
|
241
|
+
//获取3d丙图的最高扇区的高度
|
|
242
|
+
getHeight3D(s, t) {
|
|
243
|
+
let e = 0;
|
|
244
|
+
for (let i of s) { e = i.pieData.value > e ? i.pieData.value : e; }
|
|
245
|
+
return t * 25 / e;
|
|
246
|
+
},
|
|
247
|
+
// 生成扇形的曲面参数方程,用于 series-surface.parametricEquation
|
|
248
|
+
getParametricEquation(s, t, e, i, a, n) {
|
|
249
|
+
let p = (s + t) / 2, l = s * Math.PI * 2, d = t * Math.PI * 2, f = p * Math.PI * 2;
|
|
250
|
+
s === 0 && t === 1 && (e = !1), a = typeof a < "u" ? a : 1 / 3;
|
|
251
|
+
let u = e ? Math.cos(f) * 0.1 : 0, o = e ? Math.sin(f) * 0.1 : 0, h = i ? 1.05 : 1;
|
|
252
|
+
return {
|
|
253
|
+
u: {
|
|
254
|
+
min: -Math.PI,
|
|
255
|
+
max: Math.PI * 3,
|
|
256
|
+
step: Math.PI / 32
|
|
257
|
+
},
|
|
258
|
+
v: {
|
|
259
|
+
min: 0,
|
|
260
|
+
max: Math.PI * 2,
|
|
261
|
+
step: Math.PI / 20
|
|
262
|
+
},
|
|
263
|
+
x: function(r, c) {
|
|
264
|
+
return r < l ? u + Math.cos(l) * (1 + Math.cos(c) * a) * h : r > d ? u + Math.cos(d) * (1 + Math.cos(c) * a) * h : u + Math.cos(r) * (1 + Math.cos(c) * a) * h;
|
|
265
|
+
},
|
|
266
|
+
y: function(r, c) {
|
|
267
|
+
return r < l ? o + Math.sin(l) * (1 + Math.cos(c) * a) * h : r > d ? o + Math.sin(d) * (1 + Math.cos(c) * a) * h : o + Math.sin(r) * (1 + Math.cos(c) * a) * h;
|
|
268
|
+
},
|
|
269
|
+
z: function(r, c) {
|
|
270
|
+
return r < -Math.PI * 0.5 ? Math.sin(r) : r > Math.PI * 2.5 ? Math.sin(r) * n * 0.1 : Math.sin(c) > 0 ? 1 * n * 0.1 : -1;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
},
|
|
274
|
+
fomatFloat(s, t) {
|
|
275
|
+
let e = parseFloat(s);
|
|
276
|
+
if (isNaN(e)) { return !1; }
|
|
277
|
+
e = Math.round(s * Math.pow(10, t)) / Math.pow(10, t);
|
|
278
|
+
let i = e.toString(), a = i.indexOf(".");
|
|
279
|
+
for (a < 0 && (a = i.length, i += "."); i.length <= a + t;) { i += "0"; }
|
|
280
|
+
return i;
|
|
281
|
+
},
|
|
282
|
+
bindListen(s) {
|
|
283
|
+
let t = this, e = "";
|
|
284
|
+
s.on("mouseover", function(i) {
|
|
285
|
+
let a, n, p, l, d;
|
|
286
|
+
e !== i.seriesIndex && (e !== "" && (a = t.option.series[e].pieStatus.selected, n = !1, p = t.option.series[e].pieData.startRatio, l = t.option.series[e].pieData.endRatio, d = t.option.series[e].pieStatus.k, t.option.series[e].parametricEquation = t.getParametricEquation(
|
|
287
|
+
p,
|
|
288
|
+
l,
|
|
289
|
+
a,
|
|
290
|
+
n,
|
|
291
|
+
d,
|
|
292
|
+
t.option.series[e].pieData.value
|
|
293
|
+
), t.option.series[e].pieStatus.hovered = n, e = ""), i.seriesName !== "mouseoutSeries" && i.seriesName !== "pie2d" && (a = t.option.series[i.seriesIndex].pieStatus.selected, n = !0, p = t.option.series[i.seriesIndex].pieData.startRatio, l = t.option.series[i.seriesIndex].pieData.endRatio, d = t.option.series[i.seriesIndex].pieStatus.k, t.option.series[i.seriesIndex].parametricEquation = t.getParametricEquation(
|
|
294
|
+
p,
|
|
295
|
+
l,
|
|
296
|
+
a,
|
|
297
|
+
n,
|
|
298
|
+
d,
|
|
299
|
+
t.option.series[i.seriesIndex].pieData.value + 5
|
|
300
|
+
), t.option.series[i.seriesIndex].pieStatus.hovered = n, e = i.seriesIndex), s.setOption(t.option));
|
|
301
|
+
}), s.on("globalout", function() {
|
|
302
|
+
let i, a, n, p, l;
|
|
303
|
+
e !== "" && (i = t.option.series[e].pieStatus.selected, a = !1, l = t.option.series[e].pieStatus.k, n = t.option.series[e].pieData.startRatio, p = t.option.series[e].pieData.endRatio, t.option.series[e].parametricEquation = t.getParametricEquation(
|
|
304
|
+
n,
|
|
305
|
+
p,
|
|
306
|
+
i,
|
|
307
|
+
a,
|
|
308
|
+
l,
|
|
309
|
+
t.option.series[e].pieData.value
|
|
310
|
+
), t.option.series[e].pieStatus.hovered = a, e = ""), s.setOption(t.option);
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
merge(s, t) {
|
|
314
|
+
if (typeof t == "object" && !Array.isArray(t)) {
|
|
315
|
+
for (let e of Object.keys(t)) { !s[e] || typeof s[e] != "object" || Array.isArray(t[e]) ? s[e] = t[e] : this.merge(s[e], t[e]); }
|
|
316
|
+
}
|
|
317
|
+
return s;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}, I = { class: "name" }, M = ["id"];
|
|
321
|
+
function D(s, t, e, i, a, n) {
|
|
322
|
+
return y(), g("div", {
|
|
323
|
+
class: "solidChart",
|
|
324
|
+
style: S([n.styleObject])
|
|
325
|
+
}, [
|
|
326
|
+
m("div", I, x(e.name), 1),
|
|
327
|
+
m("div", {
|
|
328
|
+
class: "chartBox",
|
|
329
|
+
id: a.echartId
|
|
330
|
+
}, null, 8, M)
|
|
331
|
+
], 4);
|
|
332
|
+
}
|
|
333
|
+
const w = /* @__PURE__ */ v(b, [["render", D], ["__scopeId", "data-v-0274a0e9"]]);
|
|
334
|
+
export {
|
|
335
|
+
w as default
|
|
336
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(function(u, m){ typeof exports == "object" && typeof module < "u" ? module.exports = m(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], m) : (u = typeof globalThis < "u" ? globalThis : u || self, u.index = m(u.Vue)) })(this, function(u){
|
|
2
|
+
"use strict";const m = "", g = (s, t)=>{ const e = s.__vccOpts || s;for(const[i, a]of t){ e[i] = a; }return e }, S = {name: "cityGreenLand", components: {}, props: {data: {type: Array, required: !0}, name: {type: String, default: ""}, unit: {type: String, default: ""}, width: {type: String, default: "100%"}, height: {type: String, default: "100%"}, showLegend: {type: Boolean, default: !1}, layoutOptions: {type: Object, default: ()=>{}}, seriesOptions: {type: Object, default: ()=>{}}}, data(){ return{echartId: "", myChart: null, optionData: [{name: "林地面积统计", value: 1e4, itemStyle: {color: "#22c4ff"}}, {name: "草地面积统计", value: 12116, itemStyle: {color: "#aaff00"}}, {name: "耕地地面积统计", value: 16616, itemStyle: {color: "#ffaaff"}}], pieSeries: {name: "pie2d", type: "pie", labelLine: {length: 10, length2: 10}, label: {color: "red", show: !0}, startAngle: -20, clockwise: !1, radius: ["20%", "72%"], center: ["48%", "55%"], itemStyle: {opacity: 1}}} }, computed: {styleObject(){ return{width: this.width, height: this.height} }}, created(){ this.echartId = this.myUtils.generateUUID() }, mounted(){ this.init() }, methods: {init(){ this.data.sort((s, t)=>t.value - s.value), this.myChart = this.$echart.init(document.getElementById(this.echartId)), this.option = this.getPie3D(this.data, 0), this.option = this.merge(this.option, this.layoutOptions), this.pieSeries.data = JSON.parse(JSON.stringify(this.data)).map(s=>(s.itemStyle.color = "transparent", s)), this.option.series.push(this.merge(this.pieSeries, this.seriesOptions && this.seriesOptions.label || {})), console.log(this.option), this.myChart.setOption(this.option), this.bindListen(this.myChart), this.myChart.on("legendselectchanged", s=>{ let t = JSON.parse(JSON.stringify(this.data));t.forEach(e=>{ s.selected[e.name] || (e.value = 0) }), this.option = this.getPie3D(t, 0), this.option = this.merge(this.option, this.layoutOptions), this.pieSeries.data = JSON.parse(JSON.stringify(t)).map(e=>(e.itemStyle.color = "transparent", e)), this.option.series.push(this.merge(this.pieSeries, this.seriesOptions && this.seriesOptions.label || {})), console.log(this.option), this.myChart.setOption(this.option) }) }, getPie3D(s, t){
|
|
3
|
+
let e = this, i = [], a = 0, n = 0, p = 0, l = [], d = 1 - t;for(let o = 0;o < s.length;o++){ a += s[o].value;let h = {name: typeof s[o].name > "u" ? `series${o}` : s[o].name, type: "surface", parametric: !0, wireframe: {show: !1}, pieData: s[o], pieStatus: {selected: !1, hovered: !1, k: d}, center: ["10%", "50%"]};if(this.merge(h, this.seriesOptions && this.seriesOptions.surface || {}), typeof s[o].itemStyle < "u"){ let r = {};typeof s[o].itemStyle.color < "u" && (r.color = s[o].itemStyle.color), typeof s[o].itemStyle.opacity < "u" && (r.opacity = s[o].itemStyle.opacity), h.itemStyle = r }i.push(h) }l = [];for(let o = 0;o < i.length;o++){ p = n + i[o].pieData.value, i[o].pieData.startRatio = n / a, i[o].pieData.endRatio = p / a, i[o].parametricEquation = this.getParametricEquation(i[o].pieData.startRatio, i[o].pieData.endRatio, !1, !1, d, i[o].pieData.value), n = p;let h = e.fomatFloat(i[o].pieData.value / a, 4);l.push({name: i[o].name, value: h}) }let y = this.getHeight3D(i, 26), f = {legend: {data: l, orient: "horizontal", left: 10, top: 10, itemGap: 10, textStyle: {color: "#A1E2FF"}, show: this.showLegend, icon: "circle", formatter: function(o){ let h = l.filter(c=>c.name == o)[0], r = e.fomatFloat(h.value * 100, 2) + "%";return`${h.name} ${r}` }}, labelLine: {show: !0, lineStyle: {color: "#7BC0CB"}}, label: {show: !0, position: "outside", rich: {b: {color: "#7BC0CB", fontSize: 12, lineHeight: 20}, c: {fontSize: 16}}, formatter: `{b|{b}
|
|
4
|
+
}{c|{c}}{b| 亩}`}, tooltip: {formatter: o=>{ if(o.seriesName !== "mouseoutSeries" && o.seriesName !== "pie2d"){ let h = ((f.series[o.seriesIndex].pieData.endRatio - f.series[o.seriesIndex].pieData.startRatio) * 100).toFixed(2);return`${o.seriesName}<br/><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${o.color};"></span>${h}%` } }}, xAxis3D: {min: -1, max: 1}, yAxis3D: {min: -1, max: 1}, zAxis3D: {min: -1, max: 1}, grid3D: {show: !1, boxHeight: y, viewControl: {alpha: 40, distance: 300, rotateSensitivity: 0, zoomSensitivity: 0, panSensitivity: 0, autoRotate: !1}}, series: i};return f
|
|
5
|
+
}, getHeight3D(s, t){ let e = 0;for(let i of s){ e = i.pieData.value > e ? i.pieData.value : e; }return t * 25 / e }, getParametricEquation(s, t, e, i, a, n){ let p = (s + t) / 2, l = s * Math.PI * 2, d = t * Math.PI * 2, y = p * Math.PI * 2;s === 0 && t === 1 && (e = !1), a = typeof a < "u" ? a : .3333333333333333;let f = e ? Math.cos(y) * .1 : 0, o = e ? Math.sin(y) * .1 : 0, h = i ? 1.05 : 1;return{u: {min: -Math.PI, max: Math.PI * 3, step: Math.PI / 32}, v: {min: 0, max: Math.PI * 2, step: Math.PI / 20}, x: function(r, c){ return r < l ? f + Math.cos(l) * (1 + Math.cos(c) * a) * h : r > d ? f + Math.cos(d) * (1 + Math.cos(c) * a) * h : f + Math.cos(r) * (1 + Math.cos(c) * a) * h }, y: function(r, c){ return r < l ? o + Math.sin(l) * (1 + Math.cos(c) * a) * h : r > d ? o + Math.sin(d) * (1 + Math.cos(c) * a) * h : o + Math.sin(r) * (1 + Math.cos(c) * a) * h }, z: function(r, c){ return r < -Math.PI * .5 ? Math.sin(r) : r > Math.PI * 2.5 ? Math.sin(r) * n * .1 : Math.sin(c) > 0 ? 1 * n * .1 : -1 }} }, fomatFloat(s, t){ let e = parseFloat(s);if(isNaN(e)){ return!1; }e = Math.round(s * Math.pow(10, t)) / Math.pow(10, t);let i = e.toString(), a = i.indexOf(".");for(a < 0 && (a = i.length, i += ".");i.length <= a + t;){ i += "0"; }return i }, bindListen(s){ let t = this, e = "";s.on("mouseover", function(i){ let a, n, p, l, d;e !== i.seriesIndex && (e !== "" && (a = t.option.series[e].pieStatus.selected, n = !1, p = t.option.series[e].pieData.startRatio, l = t.option.series[e].pieData.endRatio, d = t.option.series[e].pieStatus.k, t.option.series[e].parametricEquation = t.getParametricEquation(p, l, a, n, d, t.option.series[e].pieData.value), t.option.series[e].pieStatus.hovered = n, e = ""), i.seriesName !== "mouseoutSeries" && i.seriesName !== "pie2d" && (a = t.option.series[i.seriesIndex].pieStatus.selected, n = !0, p = t.option.series[i.seriesIndex].pieData.startRatio, l = t.option.series[i.seriesIndex].pieData.endRatio, d = t.option.series[i.seriesIndex].pieStatus.k, t.option.series[i.seriesIndex].parametricEquation = t.getParametricEquation(p, l, a, n, d, t.option.series[i.seriesIndex].pieData.value + 5), t.option.series[i.seriesIndex].pieStatus.hovered = n, e = i.seriesIndex), s.setOption(t.option)) }), s.on("globalout", function(){ let i, a, n, p, l;e !== "" && (i = t.option.series[e].pieStatus.selected, a = !1, l = t.option.series[e].pieStatus.k, n = t.option.series[e].pieData.startRatio, p = t.option.series[e].pieData.endRatio, t.option.series[e].parametricEquation = t.getParametricEquation(n, p, i, a, l, t.option.series[e].pieData.value), t.option.series[e].pieStatus.hovered = a, e = ""), s.setOption(t.option) }) }, merge(s, t){ if(typeof t == "object" && !Array.isArray(t)){ for(let e of Object.keys(t)){ !s[e] || typeof s[e] != "object" || Array.isArray(t[e]) ? s[e] = t[e] : this.merge(s[e], t[e]); } }return s }}}, x = {class: "name"}, v = ["id"];function b(s, t, e, i, a, n){ return u.openBlock(), u.createElementBlock("div", {class: "solidChart", style: u.normalizeStyle([n.styleObject])}, [u.createElementVNode("div", x, u.toDisplayString(e.name), 1), u.createElementVNode("div", {class: "chartBox", id: a.echartId}, null, 8, v)], 4) }return g(S, [["render", b], ["__scopeId", "data-v-0274a0e9"]])
|
|
6
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.solidChart[data-v-0274a0e9]{color:#fff}.solidChart .name[data-v-0274a0e9]{height:40px;font-size:18px}.solidChart .chartBox[data-v-0274a0e9]{width:100%;height:calc(100% - 40px)}.solidChart .chartBox div[data-v-0274a0e9],.solidChart .chartBox canvas[data-v-0274a0e9]{width:100%;height:100%!important}
|