This commit is contained in:
duanxiaohai 2024-04-18 17:30:21 +08:00
parent 9f42dbaee3
commit 254e051b6a
3 changed files with 289 additions and 154 deletions

View File

@ -0,0 +1,281 @@
<template>
<div ref="chart" style="width: 100%; height: 300px"></div>
</template>
<script setup>
import { onMounted, reactive, ref } from "vue";
import * as echarts from "echarts";
const chart = ref(); // DOM
const data = [150, 230, 224, 218, 135, 147];
const data1 = ["2019年", "2020年", "2021年", "2022年", "2023年", "2024年"];
const data2 = [
"10000人",
"14000人",
"23000人",
"10000人",
"13200人",
"10000人",
];
// const max = data.concat(lineData).reduce((pre, cur) => (pre > cur ? pre : cur), 0); //
const option = {
// color,
// calculable: true,
grid: {
top: "6%",
left: "9%",
right: "10%",
bottom: "0%",
containLabel: false, //---grid
},
tooltip: {
show: true, //---,true
trigger: "axis",
formatter: "{b0}:{c0}",
},
xAxis: [
{
type: "value",
scale: false,
axisLabel: {
//线
show: false,
textStyle: {
color: "#ffffff",
},
},
axisLine: {
//y线
show: false // x线
},
splitLine: {
show: false,//---grid 线
},
axisTick: {
show: false, //
},
// data: ["2019", "2019", "2019", "2019", "2019", "2019", "2019"],
},
],
yAxis: [
{
type: "category",
scale: true,
// name: "/",
// max: data.length,
splitLine: {
show: false,
lineStyle: {
color: "#ffffff",
width: 1,
},
},
axisTick: {
show: false, //
},
axisLabel: {
//y
textStyle: {
color: "#ffffff",
},
},
axisLine: {
//线
show: false,
// lineStyle: {
// color: "#ffffff",
// width: 1,
// type: "solid",
// },
},
data: data1,
},
{
type: "category",
show: true,
position: "right",
axisLine: {
//--- 线
show: false // 线
},
axisLabel: {
//---
textStyle: {
color: "#ffffff",
},
},
axisTick: {
show: false, //
},
data: data2,
},
],
series: [
{
type: "bar",
data: data,
barWidth: 5, //
barGap: 0.3 /*多个并排柱子设置柱子之间的间距*/,
// itemStyle: {
// normal: {
// // borderWidth: 1,
// // borderColor: "rgba(0, 183, 255, 1)",
// // borderRadius: [0, 0, 50, 0], //
// color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
// { offset: 0, color: "rgba(26, 255, 217, 0)" },
// { offset: 1, color: "rgba(0, 183, 255, 1)" },
// ]),
// // color: [{new echarts.graphic.LinearGradient(0, 0, 1, 0, [
// // { offset: 0, color: "rgba(26, 255, 217, 0)" },
// // { offset: 1, color: "rgba(0, 230, 255, 1)" },
// // ])},
// // {new echarts.graphic.LinearGradient(0, 0, 1, 0, [
// // { offset: 0, color: "rgba(26, 255, 217, 0)" },
// // { offset: 1, color: "rgba(0, 255, 208,1)" },
// // ])},
// // {new echarts.graphic.LinearGradient(0, 0, 1, 0, [
// // { offset: 0, color: "rgba(26, 255, 217, 0)" },
// // { offset: 1, color: "rgba(255, 234, 90, 1)" },
// // ])},
// // ],
// },
// },
itemStyle: {
normal: {
color: function (params) {
let colorList = [
["rgba(0, 230, 255, 1)", "rgba(0, 230, 255, 0.2)"],
["rgba(0, 255, 208,1)", "rgba(0, 255, 208, 0.20)"],
["rgba(255, 234, 90, 1)", "rgba(255, 234, 90, 0.20)"],
];
if (params.dataIndex == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 3 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 2 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(255, 243, 119, 1)",
},
{
offset: 1,
color: "rgba(255, 242, 142, 0.20)",
},
],
false
);
} else {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
},
{
offset: 1,
color: "rgba(142, 187, 255, 0.20)",
},
],
false
);
}
},
},
},
label: {
show: true,
width: 8,
height: 8,
borderRadius: 1000,
color: "rgba(0,0,0,0)",
backgroundColor: "rgba(0, 230, 255, 1)",
shadowColor: "#00E6FF",
position: ["99%", -1],
shadowBlur: 6,
},
},
{
yAxisIndex: 1,
showBackground: true,
barWidth: 30, //
itemStyle: {
color: "rgba(0, 230, 255, 0)", //
},
// data: data.map(() => data),
data: data,
type: "bar",
emphasis: {
itemStyle: {
color: {
type: "linear",
x: 0,
x2: 0,
y: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(64, 247, 176, 0.25)",
},
{
offset: 1,
color: "rgba(17, 34, 64, 0.25)",
},
],
},
},
},
},
],
};
onMounted(() => {
var myChart = echarts.init(chart.value);
myChart.setOption(option);
});
</script>
<style scoped></style>

View File

@ -152,7 +152,7 @@ let option = {
}, },
}, },
axisTick: { axisTick: {
show: false, // x show: false, // y
}, },
//线 //线
splitLine: { splitLine: {

View File

@ -57,47 +57,7 @@
<div class="flex1"> <div class="flex1">
<div class="yd_title center_1"></div> <div class="yd_title center_1"></div>
<div class="school"> <div class="school">
<div class="schoolaBox"> <ePjz></ePjz>
<div class="schoola">
<span>1,211</span>
<span class="schoola1">学校总数</span>
</div>
<div class="schoola">
<span>46,718</span> <span class="schoola1">学生总数</span>
</div>
<div class="schoola">
<span>883</span> <span class="schoola1">班级总数</span>
</div>
<div class="schoola">
<span>4,381</span> <span class="schoola1">教职工总数</span>
</div>
</div>
<div class="schoolb">
<div class="grade">
<div class="schoolbs">
<span class="spot">初中</span> <span>7</span>
</div>
<div class="schoolbs">
<span class="spot">高中</span> <span>7</span>
</div>
</div>
<div class="grade">
<div class="schoolbs">
<span class="spot">小学</span> <span>7</span>
</div>
<div class="schoolbs">
<span class="spot">中职</span> <span>7</span>
</div>
</div>
<div class="grade grade1">
<div class="schoolbs">
<span class="spot">幼儿园</span> <span>7</span>
</div>
<div class="schoolbs">
<span class="spot">特殊教育</span> <span>7</span>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="flex1"> <div class="flex1">
@ -106,9 +66,9 @@
<div class="flex1"> <div class="flex1">
<div class="fundingBox"> <div class="fundingBox">
<div class="funding"> <div class="funding">
<span>资助项目</span> <span>一卡通财政补贴</span>
<span>资助数量</span> <span>金额()</span>
<span>资助金额</span> <span>数据对比</span>
</div> </div>
<div class="rolling"> <div class="rolling">
<div <div
@ -116,8 +76,8 @@
:key="index" :key="index"
class="fundingContent" class="fundingContent"
> >
<span class="spot">幼儿资助</span> <span class="spot">城乡居民最低生活保障金</span>
<span class="spot">379人次</span> <span class="spot">99,126,474</span>
<span class="spot">70.88</span> <span class="spot">70.88</span>
</div> </div>
</div> </div>
@ -180,6 +140,7 @@ import eP1 from "./echarts_work/eP1.vue";
import eP2 from "./echarts_work/eP2.vue"; import eP2 from "./echarts_work/eP2.vue";
import eP3 from "./echarts_work/eP3.vue"; import eP3 from "./echarts_work/eP3.vue";
import eP4 from "./echarts_work/eP4.vue"; import eP4 from "./echarts_work/eP4.vue";
import ePjz from "./echarts_work/ePjz.vue";
const zxjz = ref(true); const zxjz = ref(true);
const zxjzChange = () => { const zxjzChange = () => {
zxjz.value = !zxjz.value; zxjz.value = !zxjz.value;
@ -910,114 +871,7 @@ onBeforeMount(() => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
.schoolaBox {
display: flex;
justify-content: space-between;
}
.schoola {
width: 124px;
height: 79px;
margin-top: 20px;
padding: 2px 0 14px 0;
box-sizing: border-box;
background-image: url(@/assets/eduImg/jyImg3.png);
background-repeat: no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
justify-content: space-between;
span {
// font-weight: 500;
// font-size: 14px;
// color: #ffffff;
// letter-spacing: 4px;
// font-style: normal;
// font-family: PingFangSC, PingFang SC;
font-family: DINAlternate, DINAlternate;
// font-weight: bold;
font-size: 23px;
color: #ffffff;
line-height: 30px;
letter-spacing: 1px;
text-shadow: 0px 0px 23px rgba(0, 52, 52, 0.5);
text-align: center;
font-style: normal;
}
.schoola1 {
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: #ffffff;
line-height: 22px;
letter-spacing: 3px;
text-shadow: 0px 0px 4px rgba(60, 145, 249, 0.65);
text-align: center;
font-style: normal;
}
}
.schoolb {
width: 550px;
height: 241px;
// height: calc(100% - 0px);
background-image: url(@/assets/eduImg/jyImg2.png);
background-repeat: no-repeat;
background-size: 100% 100%;
margin-top: 20px;
display: flex;
flex-direction: column;
padding: 10px 0;
box-sizing: border-box;
span {
font-weight: 500;
font-size: 14px;
color: #ffffff;
letter-spacing: 4px;
font-style: normal;
font-family: PingFangSC, PingFang SC;
}
.grade {
display: flex;
justify-content: space-between;
padding: 36px 0 0px 18px;
.schoolbs {
// width: 128px;
height: 41px;
padding: 0px 20px 0 30px;
background-image: url(@/assets/eduImg/jyImg1.png);
background-repeat: no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.spot {
position: relative;
margin-right: 7px;
}
/* 添加伪元素圆点 */
.spot::before {
content: "";
position: absolute;
top: 50%;
left: -16px; /* 调整圆点的位置 */
transform: translateY(-50%);
width: 6px;
height: 6px;
background-color: rgba(0, 230, 255, 1);
border-radius: 50%;
box-shadow: 0px 0px 7px 0px #00ffd3;
filter: blur(0px);
}
}
.grade1 {
padding: 12px 110px 0 138px;
box-sizing: border-box;
}
}
} }
.fundingBox { .fundingBox {
display: flex; display: flex;