From 8c315898c7a22795044769a2ff5532937125753d Mon Sep 17 00:00:00 2001 From: "lily.zhang" Date: Mon, 1 Nov 2021 19:32:46 +0800 Subject: [PATCH] cxw-010203 --- src/utils/gol/singleColumnar.js | 19 ++++++++--- .../MarketingAnalysis/brandVolumeTOP10/opt.js | 32 ++++++++++++++++++- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/utils/gol/singleColumnar.js b/src/utils/gol/singleColumnar.js index 369badd..7c7ad3a 100644 --- a/src/utils/gol/singleColumnar.js +++ b/src/utils/gol/singleColumnar.js @@ -1,18 +1,19 @@ /* * @Author: your name * @Date: 2021-10-08 10:13:32 - * @LastEditTime: 2021-10-29 15:55:16 + * @LastEditTime: 2021-11-01 19:30:30 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/src/utils/gol/index.js */ import * as echarts from "echarts"; +import { bigNumberTransform } from "@/utils/gol/dataTool" export function createSingleColumnar(dx=[], ds=[], color='#3373CC') { return { grid: { - top: 16, + top: 20, left: 10, - right: 10, + right: '5%', bottom: 10, containLabel: true, }, @@ -59,6 +60,12 @@ export function createSingleColumnar(dx=[], ds=[], color='#3373CC') { color: "#FFF", }, }, + axisLabel: { + formatter: (value) => { + let str = bigNumberTransform(value); + return str; + } + }, splitLine: { lineStyle: { type: "dashed", // y轴分割线类型 @@ -80,7 +87,11 @@ export function createSingleColumnar(dx=[], ds=[], color='#3373CC') { textStyle: { //数值样式 color: '#fff', fontSize: 14 - } + }, + formatter: (p) => { + let str = bigNumberTransform(p.value); + return str; + } }, color: new echarts.graphic.LinearGradient( 0, diff --git a/src/views/MarketingAnalysis/brandVolumeTOP10/opt.js b/src/views/MarketingAnalysis/brandVolumeTOP10/opt.js index 626ab6e..61e7c24 100644 --- a/src/views/MarketingAnalysis/brandVolumeTOP10/opt.js +++ b/src/views/MarketingAnalysis/brandVolumeTOP10/opt.js @@ -1,11 +1,15 @@ /* * @Author: your name * @Date: 2021-10-09 11:01:19 - * @LastEditTime: 2021-10-26 10:40:34 + * @LastEditTime: 2021-11-01 19:26:21 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: /data-show/src/views/Index/spreadTheSound/opt.js */ +import * as echarts from "echarts"; +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++) { @@ -21,9 +25,29 @@ function createData(ds = []) { type: 'bar', stack: 'total', barWidth: 24, + barGap: "-100%", emphasis: { focus: 'series' }, + 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) @@ -82,6 +106,12 @@ export default function createOpt(dx=[], ds=[]) { color: "#fff", }, }, + axisLabel: { + formatter: (value) => { + let str = bigNumberTransform(value); + return str; + } + }, splitLine: { lineStyle: { type: "dashed", // y轴分割线类型