From ea5e44b27911ef2d85a7f9234ae522559eda601a Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 10 Aug 2021 19:29:43 +0800
Subject: [PATCH] 加上在线率 7天任务不显示年
---
src/views/wel/home.vue | 138 ++++++++++++++++++++++++++-------------------
1 files changed, 79 insertions(+), 59 deletions(-)
diff --git a/src/views/wel/home.vue b/src/views/wel/home.vue
index 86fc325..eff8227 100644
--- a/src/views/wel/home.vue
+++ b/src/views/wel/home.vue
@@ -166,11 +166,17 @@
getSevenDaty().then((res) => {
var d = res.data.data.alarmData;
var t = res.data.data.times;
+ var nyt = [];
+ for (var k in t) {
+ nyt.push(t[k].slice(5));
+ }
+
// console.log(d, t);
- that.onTwoEcharts(d, t);
+ console.log(nyt);
+ that.onTwoEcharts(d, nyt, t);
});
},
- onTwoEcharts(d, t) {
+ onTwoEcharts(d, t, yt) {
var myChart = echarts.init(document.getElementById("on_two_yjy"));
var data1 = d;
// var data1 = [18, 30, 22, 20, 15, 33, 28];
@@ -189,6 +195,20 @@
axisPointer: {
type: "shadow",
},
+ formatter: (p) => {
+ // console.log(p[0]);
+ for (var k in yt) {
+ if (yt[k].slice(5) == p[0].name) {
+ var txtCon =
+ "<div style='text-align:left;' >" +
+ yt[k] +
+ "<br />任务数:" +
+ p[0].data +
+ "</div>";
+ }
+ }
+ return txtCon;
+ },
},
grid: {
borderWidth: 0,
@@ -202,7 +222,7 @@
},
legend: {
- data: ["近7天下发任务数", "注册率"],
+ data: ["近7天下发任务数"],
align: "right",
right: 10,
textStyle: {
@@ -261,7 +281,7 @@
],
series: [
{
- name: "近7天下发任务数",
+ name: "任务数",
type: "bar",
// "stack": "总量",
barMaxWidth: 35,
@@ -321,8 +341,8 @@
},
},
legend: {
- // data: ["注册量", "在线率"],
- data: ["注册量"],
+ data: ["注册量", "在线率"],
+ // data: ["注册量"],
align: "right",
right: 10,
textStyle: {
@@ -402,35 +422,35 @@
},
},
// ,
- // {
- // type: "value",
- // name: "",
- // // min: 0,
- // // max: 250,
- // // interval: 50,
- // axisLabel: {
- // formatter: "{value} %",
- // },
- // position: "right",
- // axisTick: {
- // show: false,
- // },
- // axisLine: {
- // show: false,
- // lineStyle: {
- // color: "#00c7ff",
- // width: 1,
- // type: "solid",
- // },
- // },
- // max: 100,
- // min: 0,
- // splitLine: {
- // lineStyle: {
- // color: "#063374",
- // },
- // },
- // },
+ {
+ type: "value",
+ name: "",
+ // min: 0,
+ // max: 250,
+ // interval: 50,
+ axisLabel: {
+ formatter: "{value} %",
+ },
+ position: "right",
+ axisTick: {
+ show: false,
+ },
+ axisLine: {
+ show: false,
+ lineStyle: {
+ color: "#00c7ff",
+ width: 1,
+ type: "solid",
+ },
+ },
+ max: 100,
+ min: 0,
+ splitLine: {
+ lineStyle: {
+ color: "#063374",
+ },
+ },
+ },
],
series: [
{
@@ -457,29 +477,29 @@
},
},
// ,
- // {
- // name: "在线率",
- // type: "line",
- // // data: [50, 54, 58, 55, 65, 72, 44, 55, 58],
- // // barWidth: 6,
- // // barGap: 0.4,
- // yAxisIndex: 1,
- // itemStyle: {
- // normal: {
- // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- // {
- // offset: 0,
- // color: "#c4e300",
- // },
- // {
- // offset: 1,
- // color: "#728400",
- // },
- // ]),
- // opacity: 1,
- // },
- // },
- // },
+ {
+ name: "在线率",
+ type: "line",
+ data: [50, 54, 58, 55, 65, 72, 44, 55, 58],
+ // barWidth: 6,
+ // barGap: 0.4,
+ yAxisIndex: 1,
+ itemStyle: {
+ normal: {
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+ {
+ offset: 0,
+ color: "#c4e300",
+ },
+ {
+ offset: 1,
+ color: "#728400",
+ },
+ ]),
+ opacity: 1,
+ },
+ },
+ },
],
};
that.echarts1.setOption(option);
@@ -868,7 +888,7 @@
.slice(0, 20)
),
symbolSize: function (val) {
- return val[2] / 10;
+ return 10;
},
showEffectOn: "render",
rippleEffect: {
--
Gitblit v1.9.3