This commit is contained in:
lnn19986213 2024-04-15 09:43:44 +08:00
parent eba9d53f45
commit e06c7cdd98
7 changed files with 240 additions and 2 deletions

9
package-lock.json generated
View File

@ -10,6 +10,7 @@
"dependencies": {
"echarts": "^5.4.2",
"echarts-gl": "^2.0.9",
"echarts-liquidfill": "^3.1.0",
"sass": "^1.60.0",
"vue": "^3.2.47",
"vue-router": "^4.1.6"
@ -263,6 +264,14 @@
"echarts": "^5.1.2"
}
},
"node_modules/echarts-liquidfill": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/echarts-liquidfill/-/echarts-liquidfill-3.1.0.tgz",
"integrity": "sha512-5Dlqs/jTsdTUAsd+K5LPLLTgrbbNORUSBQyk8PSy1Mg2zgHDWm83FmvA4s0ooNepCJojFYRITTQ4GU1UUSKYLw==",
"peerDependencies": {
"echarts": "^5.0.1"
}
},
"node_modules/esbuild": {
"version": "0.17.14",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.14.tgz",

View File

@ -11,6 +11,7 @@
"dependencies": {
"echarts": "^5.4.2",
"echarts-gl": "^2.0.9",
"echarts-liquidfill": "^3.1.0",
"sass": "^1.60.0",
"vue": "^3.2.47",
"vue-router": "^4.1.6"

BIN
src/assets/bgImg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -0,0 +1,219 @@
<template>
<div ref="chart" style="width: 50%; height: 160px"></div>
</template>
<script setup>
import { onMounted, reactive, ref } from "vue";
// echarts
import * as echarts from "echarts";
import "echarts-liquidfill";
const chart = ref(); // DOM
const liq = reactive({ //chart
value: 0.18,
})
const Pie = () => {
let dataArr = [];
for (var i = 0; i < 150; i++) {
if (i % 2 === 0) {
dataArr.push({
name: (i + 1).toString(),
value: 50,
itemStyle: {
normal: {
color: '#00AFFF',
borderWidth: 0,
borderColor: 'rgba(0,0,0,0)',
},
},
});
} else {
dataArr.push({
name: (i + 1).toString(),
value: 100,
itemStyle: {
normal: {
color: 'rgba(0,0,0,0)',
borderWidth: 0,
borderColor: 'rgba(0,0,0,0)',
},
},
});
}
}
return dataArr;
}
let option = {
series: [
{
value: liq.value, // formatter
type: 'liquidFill',
radius: '70%', //
center: ['50%', '50%'],
data: [
liq.value,
{
value: liq.value,
direction: 'left', //
},
], // data
backgroundStyle: {
borderWidth: 1,
color: 'rgba(62, 208, 255, 1)', //
},
amplitude: '6 %', //
//
// color: ['#0286ea', 'l#0b99ff'], //
color: [
{
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 1,
color: '#6CDEFC',
},
{
offset: 0,
color: '#429BF7',
},
],
globalCoord: false,
},
],
label: {
normal: {
// formatter: 0.87 * 100 + '\n%',
// formatter: 0.6 * 100 + '{d|%}',
formatter: function(params){
return params.value * 100 + "%";
},
rich: {
d: {
fontSize: 20,
},
},
textStyle: {
fontSize: 20,
color: '#fff',
},
},
},
outline: {
show: false,
},
},
{
type: 'pie',
z: 1,
center: ['50%', '50%'],
radius: ['72%', '73.5%'], //
hoverAnimation: false,
data: [
{
name: '',
value: 500,
labelLine: {
show: false,
},
itemStyle: {
color: '#00AFFF',
},
emphasis: {
labelLine: {
show: false,
},
itemStyle: {
color: '#00AFFF',
},
},
},
],
},
{
//
type: 'pie',
z: 1,
zlevel: -1,
radius: ['70%', '90.5%'],
center: ['50%', '50%'],
hoverAnimation: false,
clockWise: false,
itemStyle: {
normal: {
borderWidth: 20,
color: 'rgba(224,242,255,1)',
},
},
label: {
show: false,
},
data: [100],
},
// {
// //
// type: 'pie',
// z: 1,
// zlevel: -2,
// radius: ['70%', '100%'],
// center: ['50%', '50%'],
// hoverAnimation: false,
// clockWise: false,
// itemStyle: {
// normal: {
// borderWidth: 20,
// color: 'rgba(224,242,255,.4)',
// },
// },
// label: {
// show: false,
// },
// data: [100],
// },
{
type: 'pie',
zlevel: 0,
silent: true,
radius: ['78%', '80%'],
z: 1,
label: {
normal: {
show: false,
},
},
labelLine: {
normal: {
show: false,
},
},
data: Pie(),
},
],
};
// 使
onMounted(() => {
// domecharts
// var myChart = echarts.init(document.getElementById('main'));
// Vue3
var myChart = echarts.init(chart.value);
// init(); // vue3.2this
// 使
myChart.setOption(option);
// :
window.addEventListener("resize", () => {
myChart.resize();
});
});
</script>
<style scoped></style>

View File

@ -41,7 +41,9 @@ onBeforeMount(() => {
<style scoped lang="scss">
.content {
background-color: rgba(2, 4, 27, 1);
background-image: url("../assets/bgImg.png");
background-size: 100% 100%;
background-repeat: no-repeat;
height: 100vh;
width: 100vw;
background-repeat: no-repeat;

View File

@ -75,6 +75,7 @@
<div class="yd_title">
<span class="text">活动数据分析</span>
</div>
<waterBall></waterBall>
<ePie3d></ePie3d>
</div>
<div class="flex1">
@ -222,6 +223,7 @@ import ePie from "./echarts/pie.vue";
import ePie2 from "./echarts/pie2.vue";
import eGraph from "./echarts/graph.vue";
import ePie3d from "./echarts/pie3d.vue";
import waterBall from "./echarts/waterBall.vue";
</script>
<style lang="scss" scoped>

View File

@ -165,7 +165,12 @@ echarts-gl@^2.0.9:
claygl "^1.2.1"
zrender "^5.1.1"
echarts@^5.1.2, echarts@^5.4.2:
echarts-liquidfill@^3.1.0:
version "3.1.0"
resolved "https://registry.npmmirror.com/echarts-liquidfill/-/echarts-liquidfill-3.1.0.tgz"
integrity sha512-5Dlqs/jTsdTUAsd+K5LPLLTgrbbNORUSBQyk8PSy1Mg2zgHDWm83FmvA4s0ooNepCJojFYRITTQ4GU1UUSKYLw==
echarts@^5.0.1, echarts@^5.1.2, echarts@^5.4.2:
version "5.4.2"
resolved "https://registry.npmjs.org/echarts/-/echarts-5.4.2.tgz"
integrity sha512-2W3vw3oI2tWJdyAz+b8DuWS0nfXtSDqlDmqgin/lfzbkB01cuMEN66KWBlmur3YMp5nEDEEt5s23pllnAzB4EA==