|
|
|
@ -1,27 +1,121 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-15 15:15:27
|
|
|
|
|
* @LastEditTime: 2021-11-12 09:59:54
|
|
|
|
|
* @LastEditTime: 2021-11-12 14:37:32
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/views/BrandComparison/channelDistribution/opt.js
|
|
|
|
|
*/
|
|
|
|
|
export default function createOpt() {
|
|
|
|
|
import { bigNumberTransform } from "@/utils/gol/dataTool"
|
|
|
|
|
import * as echarts from "echarts";
|
|
|
|
|
let colors = [new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#3373CC'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#071a32'
|
|
|
|
|
}
|
|
|
|
|
], false), new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#63AECC'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#071a32'
|
|
|
|
|
}
|
|
|
|
|
], false), new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#54BF93'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#071a32'
|
|
|
|
|
}
|
|
|
|
|
], false), new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#CC9D12'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#071a32'
|
|
|
|
|
}
|
|
|
|
|
], false), new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#CC7733'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#071a32'
|
|
|
|
|
}
|
|
|
|
|
], false), new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
{
|
|
|
|
|
offset: 0,
|
|
|
|
|
color: '#CC5B41'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: '#071a32'
|
|
|
|
|
}
|
|
|
|
|
], false)]
|
|
|
|
|
function createData(dataList = [], dx=[]) {
|
|
|
|
|
/*series: [
|
|
|
|
|
{
|
|
|
|
|
name: '奥迪',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barGap: 0,
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [320, 332, 301, 334, 390, 400]
|
|
|
|
|
},*/
|
|
|
|
|
let arr = [];
|
|
|
|
|
dataList.forEach(e => {
|
|
|
|
|
let a = [];
|
|
|
|
|
let Data = e.Data || {};
|
|
|
|
|
dx.forEach(e => {
|
|
|
|
|
a.push(Data[e])
|
|
|
|
|
})
|
|
|
|
|
let o = {
|
|
|
|
|
name: e.Name,
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
barGap: '9%',
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: a
|
|
|
|
|
};
|
|
|
|
|
arr.push(o)
|
|
|
|
|
})
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
export default function createOpt(dataList = [],dx = []) {
|
|
|
|
|
let info = createData(dataList, dx);
|
|
|
|
|
return {
|
|
|
|
|
grid: {
|
|
|
|
|
top: "56px",
|
|
|
|
|
top: 56,
|
|
|
|
|
left: 10,
|
|
|
|
|
right: "5%",
|
|
|
|
|
bottom: 10,
|
|
|
|
|
containLabel: true,
|
|
|
|
|
},
|
|
|
|
|
color: colors,
|
|
|
|
|
legend: {
|
|
|
|
|
data: ['奥迪', '宝马', '奔驰', '吉利', '大众', '别克'],
|
|
|
|
|
textStyle: { //图例文字的样式
|
|
|
|
|
color: '#fff'
|
|
|
|
|
color: '#fff',
|
|
|
|
|
fontSize: 10
|
|
|
|
|
},
|
|
|
|
|
y: 12,
|
|
|
|
|
x: 16
|
|
|
|
|
x: 16,
|
|
|
|
|
itemWidth: 12,
|
|
|
|
|
itemHeight: 12
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: "axis",
|
|
|
|
@ -45,7 +139,7 @@ export default function createOpt() {
|
|
|
|
|
color: "#fff",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
data: ['新闻', '论坛', '微信', 'APP', '微博', "其他"]
|
|
|
|
|
data: dx
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis: [
|
|
|
|
@ -57,6 +151,12 @@ export default function createOpt() {
|
|
|
|
|
color: "#FFF",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
formatter: (value) => {
|
|
|
|
|
let str = bigNumberTransform(value);
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
splitLine: {
|
|
|
|
|
lineStyle: {
|
|
|
|
|
type: "dashed", // y轴分割线类型
|
|
|
|
@ -65,62 +165,6 @@ export default function createOpt() {
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: '奥迪',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barGap: 0,
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [320, 332, 301, 334, 390, 400]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '宝马',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [220, 182, 191, 234, 290, 300]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '奔驰',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [150, 232, 201, 154, 190, 200]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '吉利',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [98, 77, 101, 99, 40, 44]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '大众',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [198, 177, 101, 199, 140, 145]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '别克',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 16,
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [298, 277, 201, 299, 240, 250]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
series: info
|
|
|
|
|
}
|
|
|
|
|
}
|