From 79bd0cd3d6b32ac2feb3249a856c3c149d122815 Mon Sep 17 00:00:00 2001 From: zx <604444282@qq.com> Date: Thu, 4 Nov 2021 17:16:00 +0800 Subject: [PATCH] =?UTF-8?q?zx-=E5=BE=AE=E5=8D=9A=E8=AF=A6=E6=83=85-?= =?UTF-8?q?=E5=BE=AE=E5=8D=9A=E7=94=A8=E6=88=B7=E6=B4=BB=E8=B7=83=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weiboUserActiveArea/index.vue | 10 ++-- .../WeiboDetails/weiboUserActiveArea/opt1.js | 16 ++++-- .../WeiboDetails/weiboUserActiveArea/opt2.js | 54 ++++--------------- 3 files changed, 29 insertions(+), 51 deletions(-) diff --git a/src/views/WeiboDetails/weiboUserActiveArea/index.vue b/src/views/WeiboDetails/weiboUserActiveArea/index.vue index 47420ca..3e504eb 100644 --- a/src/views/WeiboDetails/weiboUserActiveArea/index.vue +++ b/src/views/WeiboDetails/weiboUserActiveArea/index.vue @@ -51,13 +51,15 @@ export default { this.arr = this.toArr(data); let dx = []; //省份 let ds = []; //数据 + let dm = this.arr //省份和数据 this.arr.forEach((ele) => { - let key = ele.key; + let name = ele.name; let value = ele.value; - dx.push(key); + dx.push(name); ds.push(value); }); this.opt1 = createOptD1(dx, ds); + this.opt2 = createOptD2(dm); }); console.log(); }, @@ -66,8 +68,8 @@ export default { let arr = []; for (let key in obj) { let o = { - key: key, - value: obj[key], + name: key, + value: obj[key] * 1, }; arr.push(o); } diff --git a/src/views/WeiboDetails/weiboUserActiveArea/opt1.js b/src/views/WeiboDetails/weiboUserActiveArea/opt1.js index 74ec961..3fd7054 100644 --- a/src/views/WeiboDetails/weiboUserActiveArea/opt1.js +++ b/src/views/WeiboDetails/weiboUserActiveArea/opt1.js @@ -9,12 +9,13 @@ * @FilePath: /data-show/src/views/Index/tailInsight/opt.js */ import * as echarts from "echarts"; +import { bigNumberTransform } from "@/utils/gol/dataTool" export default function createOptD1(dx=[],ds=[]) { return { grid: { - left: '4%', - right: '4%', - bottom: '4%', + left: 16, + right: '5%', + bottom: 10, top: "1%", containLabel: true }, @@ -36,6 +37,12 @@ export default function createOptD1(dx=[],ds=[]) { color: "#fff", }, }, + axisLabel: { + formatter: (value) => { + let str = bigNumberTransform(value); + return str; + } + }, splitLine: { lineStyle: { type: "dashed", // y轴分割线类型 @@ -55,12 +62,13 @@ export default function createOptD1(dx=[],ds=[]) { color: "#fff", }, }, + inverse: true }, series: [ { name: '2011', type: 'bar', - barWidth: 24, + barWidth: 20, data: ds, color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, diff --git a/src/views/WeiboDetails/weiboUserActiveArea/opt2.js b/src/views/WeiboDetails/weiboUserActiveArea/opt2.js index 178233f..1226e1d 100644 --- a/src/views/WeiboDetails/weiboUserActiveArea/opt2.js +++ b/src/views/WeiboDetails/weiboUserActiveArea/opt2.js @@ -6,16 +6,16 @@ * @Description: In User Settings Edit * @FilePath: /data-show/src/views/WeiboDetails/weiboUserActiveArea/opt2.js */ -const ini_data = [];//初始化省份数组 -const provArr = ['河北', '河南', '云南', '辽宁', '黑龙江', '湖南', '安徽', '山东']; -//正则省份,将省与市的字眼去掉,框架不识别 -for (var i = 0; i < provArr.length; i++) { - var str = provArr[i]; - var re = /省|市/g; //全局匹配 - var str2 = { name: str.replace(re, ''), value: 5 };//拼接对象数组 - ini_data.push(str2); -} -export default function createOptD2() { +// const ini_data = [];//初始化省份数组 +// const provArr = ['河北', '河南', '云南', '辽宁', '黑龙江', '湖南', '安徽', '山东']; +// //正则省份,将省与市的字眼去掉,框架不识别 +// for (var i = 0; i < provArr.length; i++) { +// var str = provArr[i]; +// var re = /省|市/g; //全局匹配 +// var str2 = { name: str.replace(re, ''), value: 5 };//拼接对象数组 +// ini_data.push(str2); +// } +export default function createOptD2(dm) { return { tooltip: { trigger: "item", @@ -95,39 +95,7 @@ export default function createOptD2() { // areaColor: '#3edffe' // } // }, - data: [ - { - name: "河北省", - value: 1000, - // selected: true, - }, - { - name: "浙江省", - value: 1100, - // selected: true - }, - { - name: "山东省", - value: 1200, - // selected: true - }, - { - name: "山西省", - value: 1300, - // selected: true - }, - { - name: "上海市", - value: 1400, - // selected: true - }, - { - name: "江苏省", - value: 1500, - // selected: true - } - ] - + data: dm } ] }