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.
73 lines
1.9 KiB
73 lines
1.9 KiB
/*
|
|
* @Author: your name
|
|
* @Date: 2021-10-12 14:33:51
|
|
* @LastEditTime: 2021-10-29 19:20:12
|
|
* @LastEditors: Please set LastEditors
|
|
* @Description: In User Settings Edit
|
|
* @FilePath: /data-show/src/views/BrandInsight/weiboKol/opt.js
|
|
*/
|
|
import * as echarts from "echarts";
|
|
function createData(ds=[], colors=[]) {
|
|
let arr = [];
|
|
for(let i = 0; i < ds.length; i++) {
|
|
let ele = ds[i];
|
|
if(ele.value*1 > 0) {
|
|
let obj = { value: ele.value*1, name: ele.key, itemStyle: {
|
|
color: colors[index]
|
|
}};
|
|
arr.push(obj)
|
|
}
|
|
}
|
|
return arr;
|
|
}
|
|
export default function createOpt(ds = [], colors= []) {
|
|
const data = createData(ds, colors)
|
|
return {
|
|
series: [
|
|
{
|
|
name: 'Access From0',
|
|
type: 'pie',
|
|
radius: ['62%', '74%'],
|
|
avoidLabelOverlap: false,
|
|
label: {
|
|
show: false,
|
|
position: 'center',
|
|
lineHeight: 30
|
|
},
|
|
emphasis: {
|
|
label: {
|
|
show: true,
|
|
fontSize: '20',
|
|
color: "#ffff",
|
|
fontWeight: 'bold',
|
|
formatter: function (p) {
|
|
return `${p.data.name}\n${p.percent}%\n${p.data.value}`
|
|
}
|
|
}
|
|
},
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
data: data,
|
|
|
|
},
|
|
{
|
|
name: 'Access From1',
|
|
type: 'pie',
|
|
radius: ['79%', '86%'],
|
|
avoidLabelOverlap: false,
|
|
label: {
|
|
show: false,
|
|
position: 'center'
|
|
},
|
|
labelLine: {
|
|
show: false
|
|
},
|
|
center: ['50%', '50%'],//边框位置
|
|
data: data,
|
|
|
|
}
|
|
]
|
|
}
|
|
}
|