You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
3.7 KiB
120 lines
3.7 KiB
/*
|
|
* @Author: your name
|
|
* @Date: 2021-10-12 09:12:13
|
|
* @LastEditTime: 2021-11-02 18:03:08
|
|
* @LastEditors: Please set LastEditors
|
|
* @Description: In User Settings Edit
|
|
* @FilePath: /data-show/src/views/BrandInsight/brandTop/opt.js
|
|
*/
|
|
import * as echarts from "echarts";
|
|
import {doStr} from "@/utils/gol/dataTool"
|
|
import { bigNumberTransform } from "@/utils/gol/dataTool"
|
|
export default function createOpt(dx,ds) {
|
|
return {
|
|
grid: {
|
|
top: "16px",
|
|
left: "16px",
|
|
right: "28px",
|
|
bottom: "16px",
|
|
containLabel: true,
|
|
},
|
|
tooltip: {
|
|
trigger: "axis",
|
|
backgroundColor: "#08182F",
|
|
color: "#fff",
|
|
borderColor: "#3373CC",
|
|
textStyle: {
|
|
color: "#fff", //设置文字颜色
|
|
},
|
|
extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;",
|
|
formatter: function (params) {
|
|
var result = "";
|
|
var dotHtml =
|
|
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#1197b8"></span>';
|
|
params.forEach(function (item) {
|
|
result += item.axisValue + "</br>" + dotHtml + item.data;
|
|
});
|
|
return result;
|
|
},
|
|
},
|
|
xAxis: {
|
|
type: "category",
|
|
axisLabel :{
|
|
interval:0,
|
|
formatter: (value) => {
|
|
let res = doStr(value, 7);
|
|
return res
|
|
}
|
|
},
|
|
axisTick: {
|
|
show: false,
|
|
},
|
|
axisLine: {
|
|
show: false,
|
|
lineStyle: {
|
|
color: "#fff",
|
|
},
|
|
},
|
|
data: dx,
|
|
},
|
|
yAxis: {
|
|
type: "value",
|
|
axisLine: {
|
|
show: false,
|
|
lineStyle: {
|
|
color: "#FFF",
|
|
},
|
|
},
|
|
axisLabel: {
|
|
formatter: (value) => {
|
|
let str = bigNumberTransform(value);
|
|
return str;
|
|
}
|
|
},
|
|
splitLine: {
|
|
lineStyle: {
|
|
type: "dashed", // y轴分割线类型
|
|
color: "#012b4b",
|
|
},
|
|
},
|
|
},
|
|
series: [
|
|
{
|
|
name: "2001",
|
|
data: ds,
|
|
type: "bar",
|
|
barWidth: 24,
|
|
itemStyle: {
|
|
normal: {
|
|
label: {
|
|
show: true, //开启显示
|
|
position: 'top', //在上方显示
|
|
textStyle: { //数值样式
|
|
color: '#fff',
|
|
fontSize: 14
|
|
}
|
|
},
|
|
color: new echarts.graphic.LinearGradient(
|
|
0,
|
|
1,
|
|
0,
|
|
0,
|
|
[
|
|
{
|
|
offset: 0,
|
|
color: "rgb(65,117,203,0.4)", // 0% 处的颜色
|
|
},
|
|
{
|
|
offset: 1,
|
|
color: "#3373CC", // 100% 处的颜色#3373CC
|
|
},
|
|
],
|
|
false
|
|
),
|
|
},
|
|
},
|
|
},
|
|
],
|
|
}
|
|
}
|