|
|
|
@ -1,17 +1,24 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-12 14:33:51
|
|
|
|
|
* @LastEditTime: 2021-10-13 17:24:58
|
|
|
|
|
* @LastEditTime: 2021-11-09 17:56:25
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/views/BrandInsight/weiboKol/opt.js
|
|
|
|
|
*/
|
|
|
|
|
import * as echarts from "echarts";
|
|
|
|
|
let colors = ['#3373CC', '#CC9D12', '#54BF93', '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)']
|
|
|
|
|
function createData(ds=[]) {
|
|
|
|
|
let arr = [];
|
|
|
|
|
for(let i = 0; i < ds.length; i++) {
|
|
|
|
|
let ele = ds[i];
|
|
|
|
|
let color = "";
|
|
|
|
|
if(ele.key === '正面') {
|
|
|
|
|
color = "#3373CC"
|
|
|
|
|
} else if(ele.key === '负面') {
|
|
|
|
|
color = '#CC9D12'
|
|
|
|
|
} else {
|
|
|
|
|
color = '#54BF93'
|
|
|
|
|
}
|
|
|
|
|
if(ele.value*1 > 0) {
|
|
|
|
|
let obj = { value: ele.value*1, name: ele.key, itemStyle: {
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 1, 1, 0, [{
|
|
|
|
@ -21,7 +28,7 @@ function createData(ds=[]) {
|
|
|
|
|
color: 'black'
|
|
|
|
|
}, {
|
|
|
|
|
offset: 1,
|
|
|
|
|
color: colors[i]
|
|
|
|
|
color: color
|
|
|
|
|
}])
|
|
|
|
|
}};
|
|
|
|
|
arr.push(obj)
|
|
|
|
@ -30,9 +37,9 @@ function createData(ds=[]) {
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
export default function createOpt(ds = []) {
|
|
|
|
|
const data = createData(ds, colors)
|
|
|
|
|
const data = createData(ds)
|
|
|
|
|
return {
|
|
|
|
|
legend: {
|
|
|
|
|
legend: {
|
|
|
|
|
y: 10,
|
|
|
|
|
x: 10,
|
|
|
|
|
icon: 'roundRect',
|
|
|
|
|