diff --git a/public/index.html b/public/index.html index 0ad6cdb..d09e2e5 100644 --- a/public/index.html +++ b/public/index.html @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/src/views/Index/spreadTheSound/opt.js b/src/views/Index/spreadTheSound/opt.js index d872d6d..c0a6a0c 100644 --- a/src/views/Index/spreadTheSound/opt.js +++ b/src/views/Index/spreadTheSound/opt.js @@ -1,14 +1,15 @@ /* * @Author: your name * @Date: 2021-10-09 11:01:19 - * @LastEditTime: 2021-10-29 11:12:46 + * @LastEditTime: 2021-10-29 15:52:04 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/src/views/Index/spreadTheSound/opt.js */ import * as echarts from "echarts"; -let colors = ['#CC7733', '#CC9D12','#54BF93','#63AECC','#3373CC', "#c1c487", '#46914a', '#3fbfc5'] - +import { bigNumberTransform } from "@/utils/gol/dataTool" +let colors = ['rgba(203,118,58,1)', 'rgba(202,156,17,1)', 'rgba(90,203,156,1)', 'rgba(99,173,204,1)', 'rgba(55,113,190,1)', "rgba(138,191,66,1)", 'rgba(181,191,67,1)', 'rgba(203,91,65,1)'] +let colors2 = ['rgba(203,118,58,0.6)', 'rgba(202,156,17,0.6)', 'rgba(90,203,156,0.6)', 'rgba(99,173,204,0.6)', 'rgba(55,113,190,0.6)', "rgba(138,191,66,0.6)", 'rgba(181,191,67,0.6)', 'rgba(203,91,65,0.6)'] function createData(ds = []) { let arr = []; for (let i = 0; i < ds.length; i++) { @@ -17,35 +18,36 @@ function createData(ds = []) { let n = arr.findIndex(ele => { return ele.name === arr1[j].key; }) - if(n === -1) { + if (n === -1) { let obj = { name: arr1[j].key, type: 'bar', stack: 'total', - barWidth: 20, + barWidth: 22, + barGap: "-100%", emphasis: { focus: 'series' }, - itemStyle:{ - normal:{ - //柱体的颜色 - //右,下,左,上(1,0,0,0)表示从正右开始向左渐变 - color: function(params){ - return new echarts.graphic.LinearGradient(0,0,0,1,[ - { - offset:0, - color:params.color - }, - { - offset:1, - color:'#000' - } - ],false); - } - } - - }, + itemStyle: { + normal: { + //柱体的颜色 + //右,下,左,上(1,0,0,0)表示从正右开始向左渐变 + color: function () { + return new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 0, + color: colors[j] + }, + { + offset: 1, + color: colors2[j] + } + ], false); + } + } + + }, data: [arr1[j].value] } arr.push(obj) @@ -61,9 +63,9 @@ export default function createOpt(dx = [], ds = []) { return { grid: { left: 10, - right: 40, + right: 10, bottom: 10, - top: 60, + top: 46, containLabel: true }, tooltip: { @@ -79,12 +81,13 @@ export default function createOpt(dx = [], ds = []) { color: colors, legend: { textStyle: { //图例文字的样式 - color: '#fff' + color: '#fff', + fontSize:10 }, - y: 'top', - x: 0, - itemWidth: 12, - itemHeight: 12 + y: 10, + x: 10, + itemWidth: 10, + itemHeight: 10, }, xAxis: { type: 'category', @@ -107,6 +110,12 @@ export default function createOpt(dx = [], ds = []) { color: "#fff", }, }, + axisLabel: { + formatter: (value) => { + let str = bigNumberTransform(value); + return str; + } + }, splitLine: { lineStyle: { type: "dashed", // y轴分割线类型 diff --git a/src/views/Index/tailInsight/index.vue b/src/views/Index/tailInsight/index.vue index 1436187..a06c467 100644 --- a/src/views/Index/tailInsight/index.vue +++ b/src/views/Index/tailInsight/index.vue @@ -1,7 +1,7 @@