@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,10 @@
|
|
|
1
|
+
(function(o, n){ typeof exports == "object" && typeof module < "u" ? module.exports = n(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], n) : (o = typeof globalThis < "u" ? globalThis : o || self, o.index = n(o.Vue)) })(this, function(o){
|
|
2
|
+
"use strict";function n(e, a){ let t;return function(i){ let r = this, l = arguments;t && clearTimeout(t), t = setTimeout(()=>{ t = null, e.call(r, l) }, a) } }const s = {props: {historyTime: {type: Array, default: ()=>[]}, historyValue: {type: Array, default: ()=>[]}, status: {type: Boolean, default: !0}, reflesh: {type: Boolean, default: !0}, refleshExtream: {type: Function}, resize: {type: Boolean, default: !1}}, watch: {status: function(e){ this.historyValue.length > 0 && this.onInquire() }, reflesh: function(e){ console.log(e), this.onInquire() }, resize(){ this.echart && this.echart.resize() }}, data(){ return{echart: null, echartId: "", zoomLock: !1} }, created(){ this.echartId = this.generateUUID() }, destroyed(){ window.removeEventListener("resize", this.echart.resize()) }, mounted(){ window.addEventListener("resize", n(()=>{ this.echart && this.echart.resize() }, 500)), this.onInquire() }, methods: {generateUUID(){ let e = new Date().getTime();return window.performance && typeof window.performance.now == "function" && (e += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t){ let i = (e + Math.random() * 16) % 16 | 0;return e = Math.floor(e / 16), (t === "x" ? i : i & 3 | 8).toString(16) }) }, onInquire(){
|
|
3
|
+
this.historyValue.length > 0 && setTimeout(()=>{
|
|
4
|
+
this.echart = this.$echart.init(document.getElementById(this.echartId), "light");let e = {grid: {left: "30px", top: "10%", right: "55px", bottom: "14%", containLabel: !0, color: "red"}, tooltip: {style: {color: "red"}}, xAxis: {type: "category", splitLine: {show: !1}, axisLine: {lineStyle: {color: window.localStorage.getItem("theme") && window.localStorage.getItem("theme") == "light" ? "#e6e6e6" : "#999fa8", width: 1}}, axisLabel: {margin: 12, textStyle: {color: window.localStorage.getItem("theme") && window.localStorage.getItem("theme") == "light" ? "#595959" : "#d3d8e2", fontSize: "13"}}, labels: {style: {color: "#d3d8e2"}}, style: {color: "#d3d8e2"}, data: this.historyTime}, yAxis: {gridLineColor: "#3b4357", gridLineWidth: 1, type: "value", axisLine: {show: !1}, axisTick: {show: !1}, axisLabel: {margin: 12, textStyle: {color: window.localStorage.getItem("theme") && window.localStorage.getItem("theme") == "light" ? "#595959" : "#d3d8e2", fontSize: "13"}}, style: {color: "#d3d8e2", fontWeight: "bold", fontSize: "12px", fontFamily: "Trebuchet MS, Verdana, sans-serif"}, title: {style: {color: "#d3d8e2", fontWeight: "bold", fontSize: "12px", fontFamily: "Trebuchet MS, Verdana, sans-serif"}}, labels: {style: {color: "#d3d8e2"}}}, dataZoom: [{type: "slider", show: !0, xAxisIndex: [0], start: 0, end: 100, yAxisIndex: [3], fillerColor: "transparent", textStyle: {color: window.localStorage.getItem("theme") && window.localStorage.getItem("theme") == "light" ? "#595959" : "#d3d8e2", fontSize: "10"}, labelFormatter: function(a, t){
|
|
5
|
+
return t.split(" ")[0] + `
|
|
6
|
+
` + t.split(" ")[1]
|
|
7
|
+
}, selectedDataBackground: {lineStyle: {color: "#39CC7E", type: "solid"}, areaStyle: {color: "transparent"}}, dataBackground: {lineStyle: {color: "#184e31"}, areaStyle: {color: "transparent"}}}], series: [{data: this.historyValue, type: "line", smooth: !0, sampling: "average", itemStyle: {normal: {color: "#39CC7E", lineStyle: {color: "#39CC7E"}}}, lineStyle: {width: 2}, emphasis: {lineStyle: {width: 2}}}]};this.echart.setOption(e), this.echart.on("dataZoom", a=>{ this.$nextTick(()=>{ a.batch ? (a.batch[0].start, a.batch[0].end) : (a.start, a.end);let t = this.echart.getModel().option, i = t.dataZoom[0].startValue, r = t.dataZoom[0].endValue;return this.refleshExtream(i, r), this.echart }) }), this.echart.hideLoading()
|
|
8
|
+
}, 500)
|
|
9
|
+
}}}, y = "", d = (e, a)=>{ const t = e.__vccOpts || e;for(const[i, r]of a){ t[i] = r; }return t }, c = s, h = {class: "historyEchart"}, u = ["id"], f = ["data-noData"];function m(e, a, t, i, r, l){ return o.openBlock(), o.createElementBlock("div", h, [e.historyValue.length > 0 ? (o.openBlock(), o.createElementBlock("div", {id: e.echartId, key: e.reflesh}, null, 8, u)) : o.createCommentVNode("", !0), e.historyValue.length == 0 ? (o.openBlock(), o.createElementBlock("div", {key: 1, class: "noDataTips", "data-noData": e.$t("publics.noData")}, null, 8, f)) : o.createCommentVNode("", !0)]) }return d(c, [["render", m], ["__scopeId", "data-v-1fae3189"]])
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.historyEchart[data-v-1fae3189]{width:100%;height:100%}.historyEchart>div[data-v-1fae3189]{width:100%;height:100%}.historyEchart .noData[data-v-1fae3189]{color:var(--frame-main-color);display:flex;justify-content:center;align-items:center}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { createElementBlock as d, createElementVNode as u, normalizeStyle as x, openBlock as y, toDisplayString as p } from "vue";
|
|
2
|
+
|
|
3
|
+
import "./style.css";
|
|
4
|
+
const g = (s, t) => {
|
|
5
|
+
const e = s.__vccOpts || s;
|
|
6
|
+
for (const [c, h] of t) { e[c] = h; }
|
|
7
|
+
return e;
|
|
8
|
+
}, b = {
|
|
9
|
+
props: {
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ""
|
|
13
|
+
},
|
|
14
|
+
xData: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
},
|
|
18
|
+
yData: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
unit: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
width: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "100%"
|
|
29
|
+
},
|
|
30
|
+
height: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "100%"
|
|
33
|
+
},
|
|
34
|
+
showLegend: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
layoutOptions: {
|
|
39
|
+
type: Object,
|
|
40
|
+
default: () => ({})
|
|
41
|
+
},
|
|
42
|
+
seriesOptions: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: () => ({})
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
computed: {
|
|
48
|
+
styleObject() {
|
|
49
|
+
return {
|
|
50
|
+
width: this.width,
|
|
51
|
+
height: this.height
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
data() {
|
|
56
|
+
return {
|
|
57
|
+
echartId: "",
|
|
58
|
+
myChart: null,
|
|
59
|
+
option: {
|
|
60
|
+
backgroundColor: "transparent",
|
|
61
|
+
tooltip: {
|
|
62
|
+
trigger: "axis",
|
|
63
|
+
axisPointer: {
|
|
64
|
+
type: "shadow"
|
|
65
|
+
},
|
|
66
|
+
formatter: function(s, t, e) {
|
|
67
|
+
const c = s[1];
|
|
68
|
+
return c.name + " : " + c.value;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
grid: {
|
|
72
|
+
left: "2%",
|
|
73
|
+
right: "10%",
|
|
74
|
+
top: "20%",
|
|
75
|
+
bottom: "5%",
|
|
76
|
+
containLabel: !0
|
|
77
|
+
},
|
|
78
|
+
xAxis: {
|
|
79
|
+
type: "category",
|
|
80
|
+
data: this.xData,
|
|
81
|
+
axisLine: {
|
|
82
|
+
show: !0,
|
|
83
|
+
lineStyle: {
|
|
84
|
+
width: 2,
|
|
85
|
+
color: "#2B7BD6"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
axisTick: {
|
|
89
|
+
show: !1
|
|
90
|
+
},
|
|
91
|
+
axisLabel: {
|
|
92
|
+
fontSize: 14
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
yAxis: {
|
|
96
|
+
type: "value",
|
|
97
|
+
axisLine: {
|
|
98
|
+
show: !0,
|
|
99
|
+
lineStyle: {
|
|
100
|
+
width: 2,
|
|
101
|
+
color: "#2B7BD6"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
splitLine: {
|
|
105
|
+
show: !0,
|
|
106
|
+
lineStyle: {
|
|
107
|
+
color: "#153D7D"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
axisTick: {
|
|
111
|
+
show: !1
|
|
112
|
+
},
|
|
113
|
+
axisLabel: {
|
|
114
|
+
fontSize: 14
|
|
115
|
+
}
|
|
116
|
+
// boundaryGap: ['20%', '20%'],
|
|
117
|
+
},
|
|
118
|
+
legend: {
|
|
119
|
+
orient: "horizontal",
|
|
120
|
+
textStyle: {
|
|
121
|
+
color: "#A1E2FF"
|
|
122
|
+
},
|
|
123
|
+
show: this.showLegend,
|
|
124
|
+
icon: "circle"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
customSeries: {
|
|
128
|
+
type: "custom",
|
|
129
|
+
renderItem: (s, t) => {
|
|
130
|
+
const e = t.coord([t.value(0), t.value(1)]);
|
|
131
|
+
return {
|
|
132
|
+
type: "group",
|
|
133
|
+
children: [
|
|
134
|
+
{
|
|
135
|
+
type: "CubeLeft",
|
|
136
|
+
shape: {
|
|
137
|
+
api: t,
|
|
138
|
+
xValue: t.value(0),
|
|
139
|
+
yValue: t.value(1),
|
|
140
|
+
x: e[0],
|
|
141
|
+
y: e[1],
|
|
142
|
+
xAxisPoint: t.coord([t.value(0), 0])
|
|
143
|
+
},
|
|
144
|
+
style: {
|
|
145
|
+
fill: this.seriesOptions.color && this.seriesOptions.color.CubeLeft || new this.$echart.graphic.LinearGradient(0, 0, 0, 1, [
|
|
146
|
+
{
|
|
147
|
+
offset: 0,
|
|
148
|
+
color: "#33BCEB"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
offset: 1,
|
|
152
|
+
color: "#337CEB"
|
|
153
|
+
}
|
|
154
|
+
])
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: "CubeRight",
|
|
159
|
+
shape: {
|
|
160
|
+
api: t,
|
|
161
|
+
xValue: t.value(0),
|
|
162
|
+
yValue: t.value(1),
|
|
163
|
+
x: e[0],
|
|
164
|
+
y: e[1],
|
|
165
|
+
xAxisPoint: t.coord([t.value(0), 0])
|
|
166
|
+
},
|
|
167
|
+
style: {
|
|
168
|
+
fill: this.seriesOptions.color && this.seriesOptions.color.CubeRight || new this.$echart.graphic.LinearGradient(0, 0, 0, 1, [
|
|
169
|
+
{
|
|
170
|
+
offset: 0,
|
|
171
|
+
color: "#28A2CE"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
offset: 1,
|
|
175
|
+
color: "#1A57B7"
|
|
176
|
+
}
|
|
177
|
+
])
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: "CubeTop",
|
|
182
|
+
shape: {
|
|
183
|
+
api: t,
|
|
184
|
+
xValue: t.value(0),
|
|
185
|
+
yValue: t.value(1),
|
|
186
|
+
x: e[0],
|
|
187
|
+
y: e[1],
|
|
188
|
+
xAxisPoint: t.coord([t.value(0), 0])
|
|
189
|
+
},
|
|
190
|
+
style: {
|
|
191
|
+
fill: this.seriesOptions.color && this.seriesOptions.color.CubeTop || new this.$echart.graphic.LinearGradient(0, 0, 0, 1, [
|
|
192
|
+
{
|
|
193
|
+
offset: 0,
|
|
194
|
+
color: "#43C4F1"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
offset: 1,
|
|
198
|
+
color: "#28A2CE"
|
|
199
|
+
}
|
|
200
|
+
])
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
data: this.yData
|
|
207
|
+
},
|
|
208
|
+
labelSeries: {
|
|
209
|
+
type: "bar",
|
|
210
|
+
label: {
|
|
211
|
+
normal: {
|
|
212
|
+
show: !0,
|
|
213
|
+
position: "top",
|
|
214
|
+
formatter: (s) => s.value + this.unit,
|
|
215
|
+
fontSize: 16,
|
|
216
|
+
color: "#43C4F1",
|
|
217
|
+
offset: [0, -25]
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
itemStyle: {
|
|
221
|
+
color: "transparent"
|
|
222
|
+
},
|
|
223
|
+
tooltip: {},
|
|
224
|
+
data: this.yData
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
created() {
|
|
229
|
+
this.echartId = this.myUtils.generateUUID();
|
|
230
|
+
},
|
|
231
|
+
mounted() {
|
|
232
|
+
const e = this.$echart.graphic.extendShape({
|
|
233
|
+
shape: {
|
|
234
|
+
x: 0,
|
|
235
|
+
y: 0
|
|
236
|
+
},
|
|
237
|
+
buildPath: function(l, o) {
|
|
238
|
+
const i = o.xAxisPoint, r = [o.x, o.y], n = [o.x - 20, o.y - 10], a = [i[0] - 20, i[1] - 10], f = [i[0], i[1]];
|
|
239
|
+
l.moveTo(r[0], r[1]).lineTo(n[0], n[1]).lineTo(a[0], a[1]).lineTo(f[0], f[1]).closePath();
|
|
240
|
+
}
|
|
241
|
+
}), c = this.$echart.graphic.extendShape({
|
|
242
|
+
shape: {
|
|
243
|
+
x: 0,
|
|
244
|
+
y: 0
|
|
245
|
+
},
|
|
246
|
+
buildPath: function(l, o) {
|
|
247
|
+
const i = o.xAxisPoint, r = [o.x, o.y], n = [i[0], i[1]], a = [i[0] + 20, i[1] - 10], f = [o.x + 20, o.y - 10];
|
|
248
|
+
l.moveTo(r[0], r[1]).lineTo(n[0], n[1]).lineTo(a[0], a[1]).lineTo(f[0], f[1]).closePath();
|
|
249
|
+
}
|
|
250
|
+
}), h = this.$echart.graphic.extendShape({
|
|
251
|
+
shape: {
|
|
252
|
+
x: 0,
|
|
253
|
+
y: 0
|
|
254
|
+
},
|
|
255
|
+
buildPath: function(l, o) {
|
|
256
|
+
const i = [o.x, o.y], r = [o.x + 20, o.y - 10], n = [o.x, o.y - 20], a = [o.x - 20, o.y - 10];
|
|
257
|
+
l.moveTo(i[0], i[1]).lineTo(r[0], r[1]).lineTo(n[0], n[1]).lineTo(a[0], a[1]).closePath();
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
this.$echart.graphic.registerShape("CubeLeft", e), this.$echart.graphic.registerShape("CubeRight", c), this.$echart.graphic.registerShape("CubeTop", h), this.drawEchart();
|
|
261
|
+
},
|
|
262
|
+
methods: {
|
|
263
|
+
drawEchart() {
|
|
264
|
+
let s = document.getElementById(this.echartId);
|
|
265
|
+
this.myChart = this.$echart.init(s), this.option = Object.assign({}, this.option, this.layoutOptions), this.merge(this.labelSeries.label, this.seriesOptions.label || {}), this.option.series = [this.customSeries, this.labelSeries], this.myChart.setOption(this.option);
|
|
266
|
+
},
|
|
267
|
+
merge(s, t) {
|
|
268
|
+
if (typeof t == "object" && !Array.isArray(t)) {
|
|
269
|
+
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]); }
|
|
270
|
+
}
|
|
271
|
+
return s;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, m = { class: "name" }, v = ["id"];
|
|
275
|
+
function S(s, t, e, c, h, l) {
|
|
276
|
+
return y(), d("div", {
|
|
277
|
+
class: "solidChart",
|
|
278
|
+
style: x([l.styleObject])
|
|
279
|
+
}, [
|
|
280
|
+
u("div", m, p(e.name), 1),
|
|
281
|
+
u("div", {
|
|
282
|
+
class: "chartBox",
|
|
283
|
+
id: h.echartId
|
|
284
|
+
}, null, 8, v)
|
|
285
|
+
], 4);
|
|
286
|
+
}
|
|
287
|
+
const C = /* @__PURE__ */ g(b, [["render", S], ["__scopeId", "data-v-ade5a470"]]);
|
|
288
|
+
export {
|
|
289
|
+
C as default
|
|
290
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(r, d){ typeof exports == "object" && typeof module < "u" ? module.exports = d(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], d) : (r = typeof globalThis < "u" ? globalThis : r || self, r.index = d(r.Vue)) })(this, function(r){ "use strict";const d = "", y = (i, e)=>{ const t = i.__vccOpts || i;for(const[l, f]of e){ t[l] = f; }return t }, x = {props: {name: {type: String, default: ""}, xData: {type: Array, default: ()=>[]}, yData: {type: Array, 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: ()=>({})}}, computed: {styleObject(){ return{width: this.width, height: this.height} }}, data(){ return{echartId: "", myChart: null, option: {backgroundColor: "transparent", tooltip: {trigger: "axis", axisPointer: {type: "shadow"}, formatter: function(i, e, t){ const l = i[1];return l.name + " : " + l.value }}, grid: {left: "2%", right: "10%", top: "20%", bottom: "5%", containLabel: !0}, xAxis: {type: "category", data: this.xData, axisLine: {show: !0, lineStyle: {width: 2, color: "#2B7BD6"}}, axisTick: {show: !1}, axisLabel: {fontSize: 14}}, yAxis: {type: "value", axisLine: {show: !0, lineStyle: {width: 2, color: "#2B7BD6"}}, splitLine: {show: !0, lineStyle: {color: "#153D7D"}}, axisTick: {show: !1}, axisLabel: {fontSize: 14}}, legend: {orient: "horizontal", textStyle: {color: "#A1E2FF"}, show: this.showLegend, icon: "circle"}}, customSeries: {type: "custom", renderItem: (i, e)=>{ const t = e.coord([e.value(0), e.value(1)]);return{type: "group", children: [{type: "CubeLeft", shape: {api: e, xValue: e.value(0), yValue: e.value(1), x: t[0], y: t[1], xAxisPoint: e.coord([e.value(0), 0])}, style: {fill: this.seriesOptions.color && this.seriesOptions.color.CubeLeft || new this.$echart.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0, color: "#33BCEB"}, {offset: 1, color: "#337CEB"}])}}, {type: "CubeRight", shape: {api: e, xValue: e.value(0), yValue: e.value(1), x: t[0], y: t[1], xAxisPoint: e.coord([e.value(0), 0])}, style: {fill: this.seriesOptions.color && this.seriesOptions.color.CubeRight || new this.$echart.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0, color: "#28A2CE"}, {offset: 1, color: "#1A57B7"}])}}, {type: "CubeTop", shape: {api: e, xValue: e.value(0), yValue: e.value(1), x: t[0], y: t[1], xAxisPoint: e.coord([e.value(0), 0])}, style: {fill: this.seriesOptions.color && this.seriesOptions.color.CubeTop || new this.$echart.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0, color: "#43C4F1"}, {offset: 1, color: "#28A2CE"}])}}]} }, data: this.yData}, labelSeries: {type: "bar", label: {normal: {show: !0, position: "top", formatter: i=>i.value + this.unit, fontSize: 16, color: "#43C4F1", offset: [0, -25]}}, itemStyle: {color: "transparent"}, tooltip: {}, data: this.yData}} }, created(){ this.echartId = this.myUtils.generateUUID() }, mounted(){ const t = this.$echart.graphic.extendShape({shape: {x: 0, y: 0}, buildPath: function(h, o){ const s = o.xAxisPoint, n = [o.x, o.y], c = [o.x - 20, o.y - 10], a = [s[0] - 20, s[1] - 10], u = [s[0], s[1]];h.moveTo(n[0], n[1]).lineTo(c[0], c[1]).lineTo(a[0], a[1]).lineTo(u[0], u[1]).closePath() }}), l = this.$echart.graphic.extendShape({shape: {x: 0, y: 0}, buildPath: function(h, o){ const s = o.xAxisPoint, n = [o.x, o.y], c = [s[0], s[1]], a = [s[0] + 20, s[1] - 10], u = [o.x + 20, o.y - 10];h.moveTo(n[0], n[1]).lineTo(c[0], c[1]).lineTo(a[0], a[1]).lineTo(u[0], u[1]).closePath() }}), f = this.$echart.graphic.extendShape({shape: {x: 0, y: 0}, buildPath: function(h, o){ const s = [o.x, o.y], n = [o.x + 20, o.y - 10], c = [o.x, o.y - 20], a = [o.x - 20, o.y - 10];h.moveTo(s[0], s[1]).lineTo(n[0], n[1]).lineTo(c[0], c[1]).lineTo(a[0], a[1]).closePath() }});this.$echart.graphic.registerShape("CubeLeft", t), this.$echart.graphic.registerShape("CubeRight", l), this.$echart.graphic.registerShape("CubeTop", f), this.drawEchart() }, methods: {drawEchart(){ let i = document.getElementById(this.echartId);this.myChart = this.$echart.init(i), this.option = Object.assign({}, this.option, this.layoutOptions), this.merge(this.labelSeries.label, this.seriesOptions.label || {}), this.option.series = [this.customSeries, this.labelSeries], this.myChart.setOption(this.option) }, merge(i, e){ if(typeof e == "object" && !Array.isArray(e)){ for(let t of Object.keys(e)){ !i[t] || typeof i[t] != "object" || Array.isArray(e[t]) ? i[t] = e[t] : this.merge(i[t], e[t]); } }return i }}}, p = {class: "name"}, g = ["id"];function b(i, e, t, l, f, h){ return r.openBlock(), r.createElementBlock("div", {class: "solidChart", style: r.normalizeStyle([h.styleObject])}, [r.createElementVNode("div", p, r.toDisplayString(t.name), 1), r.createElementVNode("div", {class: "chartBox", id: f.echartId}, null, 8, g)], 4) }return y(x, [["render", b], ["__scopeId", "data-v-ade5a470"]]) });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.solidChart[data-v-ade5a470]{color:#fff}.solidChart .name[data-v-ade5a470]{height:40px;font-size:18px}.solidChart .chartBox[data-v-ade5a470]{width:100%;height:calc(100% - 40px)}.solidChart .chartBox div[data-v-ade5a470],.solidChart .chartBox canvas[data-v-ade5a470]{width:100%;height:100%!important}
|
|
@@ -0,0 +1,332 @@
|
|
|
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, o] of t) { e[i] = o; }
|
|
7
|
+
return e;
|
|
8
|
+
}, b = {
|
|
9
|
+
name: "cityGreenLand",
|
|
10
|
+
props: {
|
|
11
|
+
data: {
|
|
12
|
+
type: Array,
|
|
13
|
+
required: !0
|
|
14
|
+
},
|
|
15
|
+
//图表名称
|
|
16
|
+
name: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
unit: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ""
|
|
23
|
+
},
|
|
24
|
+
width: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "100%"
|
|
27
|
+
},
|
|
28
|
+
height: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "100%"
|
|
31
|
+
},
|
|
32
|
+
showLegend: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
layoutOptions: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: () => ({})
|
|
39
|
+
},
|
|
40
|
+
seriesOptions: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({})
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
echartId: "",
|
|
48
|
+
myChart: null,
|
|
49
|
+
optionData: [{
|
|
50
|
+
name: "林地面积统计",
|
|
51
|
+
value: 1e4,
|
|
52
|
+
itemStyle: {
|
|
53
|
+
color: "#22c4ff"
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
name: "草地面积统计",
|
|
57
|
+
value: 12116,
|
|
58
|
+
itemStyle: {
|
|
59
|
+
color: "#aaff00"
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
name: "耕地地面积统计",
|
|
63
|
+
value: 16616,
|
|
64
|
+
itemStyle: {
|
|
65
|
+
color: "#ffaaff"
|
|
66
|
+
}
|
|
67
|
+
}],
|
|
68
|
+
option: {},
|
|
69
|
+
pieSeries: {
|
|
70
|
+
name: "pie2d",
|
|
71
|
+
type: "pie",
|
|
72
|
+
labelLine: {
|
|
73
|
+
length: 10,
|
|
74
|
+
length2: 10
|
|
75
|
+
},
|
|
76
|
+
startAngle: -20,
|
|
77
|
+
//起始角度,支持范围[0, 360]。
|
|
78
|
+
clockwise: !1,
|
|
79
|
+
//饼图的扇区是否是顺时针排布。上述这两项配置主要是为了对齐3d的样式
|
|
80
|
+
radius: ["20%", "72%"],
|
|
81
|
+
center: ["48%", "55%"],
|
|
82
|
+
itemStyle: {
|
|
83
|
+
opacity: 1
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
computed: {
|
|
89
|
+
styleObject() {
|
|
90
|
+
return {
|
|
91
|
+
width: this.width,
|
|
92
|
+
height: this.height
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
created() {
|
|
97
|
+
this.echartId = this.myUtils.generateUUID();
|
|
98
|
+
},
|
|
99
|
+
mounted() {
|
|
100
|
+
this.$nextTick(function() {
|
|
101
|
+
this.init();
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
methods: {
|
|
105
|
+
init() {
|
|
106
|
+
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.8), 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 || {})), this.myChart.setOption(this.option), this.bindListen(this.myChart), this.myChart.on("legendselectchanged", (s) => {
|
|
107
|
+
let t = JSON.parse(JSON.stringify(this.data));
|
|
108
|
+
t.forEach((e) => {
|
|
109
|
+
s.selected[e.name] || (e.value = 0);
|
|
110
|
+
}), this.option = this.getPie3D(t, 0.8), 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);
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
getPie3D(s, t) {
|
|
114
|
+
let e = this, i = [], o = 0, n = 0, p = 0, l = [], d = 1 - t;
|
|
115
|
+
for (let a = 0; a < s.length; a++) {
|
|
116
|
+
o += s[a].value;
|
|
117
|
+
let h = {
|
|
118
|
+
name: typeof s[a].name > "u" ? `series${a}` : s[a].name,
|
|
119
|
+
type: "surface",
|
|
120
|
+
parametric: !0,
|
|
121
|
+
wireframe: {
|
|
122
|
+
show: !1
|
|
123
|
+
},
|
|
124
|
+
pieData: s[a],
|
|
125
|
+
pieStatus: {
|
|
126
|
+
selected: !1,
|
|
127
|
+
hovered: !1,
|
|
128
|
+
k: d
|
|
129
|
+
},
|
|
130
|
+
center: ["20%", "30%"]
|
|
131
|
+
};
|
|
132
|
+
if (this.merge(h, this.seriesOptions && this.seriesOptions.surface || {}), typeof s[a].itemStyle < "u") {
|
|
133
|
+
let r = {};
|
|
134
|
+
typeof s[a].itemStyle.color < "u" && (r.color = s[a].itemStyle.color), typeof s[a].itemStyle.opacity < "u" && (r.opacity = s[a].itemStyle.opacity), h.itemStyle = r;
|
|
135
|
+
}
|
|
136
|
+
i.push(h);
|
|
137
|
+
}
|
|
138
|
+
l = [];
|
|
139
|
+
for (let a = 0; a < i.length; a++) {
|
|
140
|
+
p = n + i[a].pieData.value, i[a].pieData.startRatio = n / o, i[a].pieData.endRatio = p / o, i[a].parametricEquation = this.getParametricEquation(
|
|
141
|
+
i[a].pieData.startRatio,
|
|
142
|
+
i[a].pieData.endRatio,
|
|
143
|
+
!1,
|
|
144
|
+
!1,
|
|
145
|
+
d,
|
|
146
|
+
i[a].pieData.value
|
|
147
|
+
), n = p;
|
|
148
|
+
let h = e.fomatFloat(i[a].pieData.value / o, 4);
|
|
149
|
+
l.push({
|
|
150
|
+
name: i[a].name,
|
|
151
|
+
value: h
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
let f = this.getHeight3D(i, 26), u = {
|
|
155
|
+
legend: {
|
|
156
|
+
data: l,
|
|
157
|
+
orient: "horizontal",
|
|
158
|
+
left: 10,
|
|
159
|
+
top: 10,
|
|
160
|
+
itemGap: 10,
|
|
161
|
+
textStyle: {
|
|
162
|
+
color: "#A1E2FF"
|
|
163
|
+
},
|
|
164
|
+
show: this.showLegend,
|
|
165
|
+
icon: "circle",
|
|
166
|
+
formatter: function(a) {
|
|
167
|
+
let h = l.filter((c) => c.name == a)[0], r = e.fomatFloat(h.value * 100, 2) + "%";
|
|
168
|
+
return `${h.name} ${r}`;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
labelLine: {
|
|
172
|
+
show: !0,
|
|
173
|
+
lineStyle: {
|
|
174
|
+
color: "#7BC0CB"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
label: {
|
|
178
|
+
show: !0,
|
|
179
|
+
position: "outside",
|
|
180
|
+
rich: {
|
|
181
|
+
b: {
|
|
182
|
+
color: "#7BC0CB",
|
|
183
|
+
fontSize: 12,
|
|
184
|
+
lineHeight: 20
|
|
185
|
+
},
|
|
186
|
+
c: {
|
|
187
|
+
fontSize: 16
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
formatter: `{b|{b}
|
|
191
|
+
}{c|{c}}{b| 亩}`
|
|
192
|
+
},
|
|
193
|
+
tooltip: {
|
|
194
|
+
formatter: (a) => {
|
|
195
|
+
if (a.seriesName !== "mouseoutSeries" && a.seriesName !== "pie2d") {
|
|
196
|
+
let h = ((u.series[a.seriesIndex].pieData.endRatio - u.series[a.seriesIndex].pieData.startRatio) * 100).toFixed(2);
|
|
197
|
+
return `${a.seriesName}<br/><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${a.color};"></span>${h}%`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
xAxis3D: {
|
|
202
|
+
min: -1,
|
|
203
|
+
max: 1
|
|
204
|
+
},
|
|
205
|
+
yAxis3D: {
|
|
206
|
+
min: -1,
|
|
207
|
+
max: 1
|
|
208
|
+
},
|
|
209
|
+
zAxis3D: {
|
|
210
|
+
min: -1,
|
|
211
|
+
max: 1
|
|
212
|
+
},
|
|
213
|
+
grid3D: {
|
|
214
|
+
show: !1,
|
|
215
|
+
boxHeight: f,
|
|
216
|
+
//圆环的高度
|
|
217
|
+
viewControl: {
|
|
218
|
+
//3d效果可以放大、旋转等,请自己去查看官方配置
|
|
219
|
+
alpha: 40,
|
|
220
|
+
//角度
|
|
221
|
+
distance: 300,
|
|
222
|
+
//调整视角到主体的距离,类似调整zoom
|
|
223
|
+
rotateSensitivity: 0,
|
|
224
|
+
//设置为0无法旋转
|
|
225
|
+
zoomSensitivity: 0,
|
|
226
|
+
//设置为0无法缩放
|
|
227
|
+
panSensitivity: 0,
|
|
228
|
+
//设置为0无法平移
|
|
229
|
+
autoRotate: !1
|
|
230
|
+
//自动旋转
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
series: i
|
|
234
|
+
};
|
|
235
|
+
return u;
|
|
236
|
+
},
|
|
237
|
+
//获取3d丙图的最高扇区的高度
|
|
238
|
+
getHeight3D(s, t) {
|
|
239
|
+
let e = 0;
|
|
240
|
+
for (let i of s) { e = i.pieData.value > e ? i.pieData.value : e; }
|
|
241
|
+
return t * 25 / e;
|
|
242
|
+
},
|
|
243
|
+
// 生成扇形的曲面参数方程,用于 series-surface.parametricEquation
|
|
244
|
+
getParametricEquation(s, t, e, i, o, n) {
|
|
245
|
+
let p = (s + t) / 2, l = s * Math.PI * 2, d = t * Math.PI * 2, f = p * Math.PI * 2;
|
|
246
|
+
s === 0 && t === 1 && (e = !1), o = typeof o < "u" ? o : 1 / 3;
|
|
247
|
+
let u = e ? Math.cos(f) * 0.1 : 0, a = e ? Math.sin(f) * 0.1 : 0, h = i ? 1.05 : 1;
|
|
248
|
+
return {
|
|
249
|
+
u: {
|
|
250
|
+
min: -Math.PI,
|
|
251
|
+
max: Math.PI * 3,
|
|
252
|
+
step: Math.PI / 32
|
|
253
|
+
},
|
|
254
|
+
v: {
|
|
255
|
+
min: 0,
|
|
256
|
+
max: Math.PI * 2,
|
|
257
|
+
step: Math.PI / 20
|
|
258
|
+
},
|
|
259
|
+
x: function(r, c) {
|
|
260
|
+
return r < l ? u + Math.cos(l) * (2 + Math.cos(c) * o) * h : r > d ? u + Math.cos(d) * (2 + Math.cos(c) * o) * h : u + Math.cos(r) * (2 + Math.cos(c) * o) * h;
|
|
261
|
+
},
|
|
262
|
+
y: function(r, c) {
|
|
263
|
+
return r < l ? a + Math.sin(l) * (2 + Math.cos(c) * o) * h : r > d ? a + Math.sin(d) * (2 + Math.cos(c) * o) * h : a + Math.sin(r) * (2 + Math.cos(c) * o) * h;
|
|
264
|
+
},
|
|
265
|
+
z: function(r, c) {
|
|
266
|
+
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;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
fomatFloat(s, t) {
|
|
271
|
+
let e = parseFloat(s);
|
|
272
|
+
if (isNaN(e)) { return !1; }
|
|
273
|
+
e = Math.round(s * Math.pow(10, t)) / Math.pow(10, t);
|
|
274
|
+
let i = e.toString(), o = i.indexOf(".");
|
|
275
|
+
for (o < 0 && (o = i.length, i += "."); i.length <= o + t;) { i += "0"; }
|
|
276
|
+
return i;
|
|
277
|
+
},
|
|
278
|
+
bindListen(s) {
|
|
279
|
+
let t = this, e = "";
|
|
280
|
+
s.on("mouseover", function(i) {
|
|
281
|
+
let o, n, p, l, d;
|
|
282
|
+
e !== i.seriesIndex && (e !== "" && (o = 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(
|
|
283
|
+
p,
|
|
284
|
+
l,
|
|
285
|
+
o,
|
|
286
|
+
n,
|
|
287
|
+
d,
|
|
288
|
+
t.option.series[e].pieData.value
|
|
289
|
+
), t.option.series[e].pieStatus.hovered = n, e = ""), i.seriesName !== "mouseoutSeries" && i.seriesName !== "pie2d" && (o = 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(
|
|
290
|
+
p,
|
|
291
|
+
l,
|
|
292
|
+
o,
|
|
293
|
+
n,
|
|
294
|
+
d,
|
|
295
|
+
t.option.series[i.seriesIndex].pieData.value + 5
|
|
296
|
+
), t.option.series[i.seriesIndex].pieStatus.hovered = n, e = i.seriesIndex), s.setOption(t.option));
|
|
297
|
+
}), s.on("globalout", function() {
|
|
298
|
+
let i, o, n, p, l;
|
|
299
|
+
e !== "" && (i = t.option.series[e].pieStatus.selected, o = !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(
|
|
300
|
+
n,
|
|
301
|
+
p,
|
|
302
|
+
i,
|
|
303
|
+
o,
|
|
304
|
+
l,
|
|
305
|
+
t.option.series[e].pieData.value
|
|
306
|
+
), t.option.series[e].pieStatus.hovered = o, e = ""), s.setOption(t.option);
|
|
307
|
+
});
|
|
308
|
+
},
|
|
309
|
+
merge(s, t) {
|
|
310
|
+
if (typeof t == "object" && !Array.isArray(t)) {
|
|
311
|
+
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]); }
|
|
312
|
+
}
|
|
313
|
+
return s;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}, I = { class: "name" }, M = ["id"];
|
|
317
|
+
function D(s, t, e, i, o, n) {
|
|
318
|
+
return y(), g("div", {
|
|
319
|
+
class: "solidChart",
|
|
320
|
+
style: S([n.styleObject])
|
|
321
|
+
}, [
|
|
322
|
+
m("div", I, x(e.name), 1),
|
|
323
|
+
m("div", {
|
|
324
|
+
class: "chartBox",
|
|
325
|
+
id: o.echartId
|
|
326
|
+
}, null, 8, M)
|
|
327
|
+
], 4);
|
|
328
|
+
}
|
|
329
|
+
const O = /* @__PURE__ */ v(b, [["render", D], ["__scopeId", "data-v-82a2ccf1"]]);
|
|
330
|
+
export {
|
|
331
|
+
O as default
|
|
332
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(function(c, m){ typeof exports == "object" && typeof module < "u" ? module.exports = m(require("vue")) : typeof define == "function" && define.amd ? define(["vue"], m) : (c = typeof globalThis < "u" ? globalThis : c || self, c.index = m(c.Vue)) })(this, function(c){
|
|
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", 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"}}], option: {}, pieSeries: {name: "pie2d", type: "pie", labelLine: {length: 10, length2: 10}, 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.$nextTick(function(){ 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, .8), 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 || {})), 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, .8), 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: ["20%", "30%"]};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(u=>u.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, u){ return r < l ? f + Math.cos(l) * (2 + Math.cos(u) * a) * h : r > d ? f + Math.cos(d) * (2 + Math.cos(u) * a) * h : f + Math.cos(r) * (2 + Math.cos(u) * a) * h }, y: function(r, u){ return r < l ? o + Math.sin(l) * (2 + Math.cos(u) * a) * h : r > d ? o + Math.sin(d) * (2 + Math.cos(u) * a) * h : o + Math.sin(r) * (2 + Math.cos(u) * a) * h }, z: function(r, u){ return r < -Math.PI * .5 ? Math.sin(r) : r > Math.PI * 2.5 ? Math.sin(r) * n * .1 : Math.sin(u) > 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 c.openBlock(), c.createElementBlock("div", {class: "solidChart", style: c.normalizeStyle([n.styleObject])}, [c.createElementVNode("div", x, c.toDisplayString(e.name), 1), c.createElementVNode("div", {class: "chartBox", id: a.echartId}, null, 8, v)], 4) }return g(S, [["render", b], ["__scopeId", "data-v-82a2ccf1"]])
|
|
6
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.solidChart[data-v-82a2ccf1]{color:#fff}.solidChart .name[data-v-82a2ccf1]{height:40px;font-size:18px}.solidChart .chartBox[data-v-82a2ccf1]{width:100%;height:calc(100% - 40px)}.solidChart .chartBox div[data-v-82a2ccf1],.solidChart .chartBox canvas[data-v-82a2ccf1]{width:100%;height:100%!important}
|