This commit is contained in:
姚宇浩 2024-04-22 09:32:41 +08:00
parent d07c48d8b7
commit 966b1a9769
5 changed files with 119 additions and 129 deletions

View File

@ -10,44 +10,15 @@ import * as echarts from "echarts";
const chart = ref(); // DOM
const data = [120, 200, 50, 80, 70];
const lineData = [150, 230, 24, 218, 135];
const lineData = [1500, 2300, 204, 2018, 1305];
const max = data
.concat(lineData)
.reduce((pre, cur) => (pre > cur ? pre : cur), 0); //
//
const color = [
{
type: "linear",
x: 0,
x2: 0,
y: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
},
{
offset: 0.5,
color: "rgba(142, 187, 255, 0.5)",
},
{
offset: 1,
color: "rgba(142, 187, 255, 0.20)",
},
],
},
];
const option = {
tooltip: {
trigger: "axis",
formatter: "{b0}<br/> {a0}:{c0}<br/>{a1}:{c1}",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#3F82F7", //
},
},
},
legend: {
data: ["救助金额", "救助人数"],
@ -65,7 +36,7 @@ const option = {
color: "#ffffff",
},
calculable: true,
color,
xAxis: [
{
type: "category",
@ -92,7 +63,7 @@ const option = {
type: "value",
scale: true,
name: "救助人数",
max: max,
splitLine: {
//线
show: false,
@ -121,7 +92,7 @@ const option = {
type: "value",
scale: true,
min: 0,
max: max,
name: "救助金额/万",
splitLine: {
show: false,
@ -146,9 +117,35 @@ const option = {
},
},
},
{
type: "value",
min: 0,
max: 100,
splitLine: {
show: false,
lineStyle: {
type: "solid",
color: "rgb(221, 242, 255,0.1)",
},
},
axisLine: {
show: false,
lineStyle: {
type: "dotted",
},
},
axisLabel: {
show: false,
fontSize: 14,
fontFamily: "MicrosoftYaHei",
color: "#DEF1FF",
lineHeight: 19,
},
},
],
series: [
{
yAxisIndex: 1,
name: "救助金额",
data: lineData,
type: "line", //线
@ -162,6 +159,7 @@ const option = {
},
},
{
yAxisIndex: 0,
name: "救助人数",
data: data,
barWidth: 20,
@ -180,12 +178,9 @@ const option = {
},
},
{
type: "bar",
xAxisIndex: 1,
itemStyle: {
color: "rgba(180, 180, 180, 0.2)", //
},
data: data.map(() => max),
barWidth: 40, //
yAxisIndex: 2,
emphasis: {
itemStyle: {
color: {
@ -207,7 +202,11 @@ const option = {
},
},
},
type: "bar",
itemStyle: {
color: "rgba(221, 242, 255, 0.1)",
},
data: ["2019", "2020", "2021", "2022", "2023"].map(() => 100),
barWidth: 50,
},
],
};

View File

@ -44,12 +44,7 @@ const option = {
tooltip: {
trigger: "axis",
formatter: "{b0}<br/> {a0}:{c0}<br/>{a1}:{c1}",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#3F82F7", //
},
},
},
legend: {
data: ["救助金额", "救助人数"],

View File

@ -36,13 +36,8 @@ const color = [
const option = {
tooltip: {
trigger: "axis",
formatter: "{b0}<br/> {a0}:{c0}<br/>{a1}:{c1}",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#3F82F7", //
},
},
formatter: "{b0}<br/> {a0}:{c0}<br/>{a1}:{c1}<br/>{a2}:{c2}<br/>{a3}:{c3}<br/>{a4}:{c4}",
},
legend: [
{
@ -153,6 +148,7 @@ const option = {
},
},
},
],
series: [
{

View File

@ -30,12 +30,7 @@ const option = {
tooltip: {
trigger: "axis",
formatter: "{b0}<br/> {a0}:{c0}<br/>{a1}:{c1}",
axisPointer: {
type: "cross",
label: {
backgroundColor: "#3F82F7", //
},
},
},
legend: {

View File

@ -6,10 +6,12 @@
<eP1></eP1>
<div class="t_1"></div>
<div class="t_2">
<div class="t_3" v-for="(item,index) in fl" :key="index">
<div class="top">{{item.value}}%</div>
<div :class='item.cls'></div>
<div class="right">{{item.name}}</div>
<div class="t_2_1" v-for="(item, index) in fl" :key="index">
<div class="top">{{ item.value }}%</div>
<div class="t_3">
<div :class="item.cls"></div>
<div class="right">{{ item.name }}</div>
</div>
</div>
</div>
</div>
@ -1198,10 +1200,19 @@ onBeforeMount(() => {
background-size: 100% 100%;
}
.t_2 {
margin-top: 35px;
margin-top: 5px;
padding: 0 10px;
display: flex;
justify-content: space-around;
.t_2_1 {
display: flex;
flex-direction: column;
align-items: center;
.top {
font-size: 26px;
color: #ffffff;
line-height: 30px;
}
.t_3 {
width: 135px;
height: 90px;
@ -1209,14 +1220,7 @@ onBeforeMount(() => {
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
.top {
position: absolute;
left: 38px;
top: -25px;
font-size: 26px;
color: #ffffff;
line-height: 30px;
}
.left1 {
position: absolute;
left: 15px;
@ -1274,6 +1278,7 @@ onBeforeMount(() => {
font-style: normal;
}
}
}
}
</style>
<style lang="scss">