|
|
@ -319,6 +319,7 @@ export default { |
|
|
|
if (params.seriesIndex == 0 || params.seriesIndex == 2) { |
|
|
|
this.ageCode = '' |
|
|
|
// this.getUnitList(this.agencyId) |
|
|
|
this.getAgeList() |
|
|
|
this.$refs.ageChart.clear() |
|
|
|
this.noInit = false |
|
|
|
this.clickAgePie(0) |
|
|
@ -380,7 +381,7 @@ export default { |
|
|
|
this.clickEduPie(params.dataIndex) |
|
|
|
if (params.seriesIndex == 0 || params.seriesIndex == 2) { |
|
|
|
this.eduCode = '' |
|
|
|
// this.getUnitList(this.agencyId) |
|
|
|
this.getEduList() |
|
|
|
this.$refs.eduChart.clear() |
|
|
|
this.noEduInit = false |
|
|
|
this.clickEduPie(0) |
|
|
@ -392,131 +393,7 @@ export default { |
|
|
|
// option && this.$refs.pieChart.setOption(option); |
|
|
|
|
|
|
|
}, |
|
|
|
initChartType() { |
|
|
|
const eId = document.getElementById('echartType') |
|
|
|
let _charts = echarts.init(eId) |
|
|
|
|
|
|
|
let option = { |
|
|
|
tooltip: { |
|
|
|
trigger: 'item' |
|
|
|
}, |
|
|
|
legend: { |
|
|
|
show: true, |
|
|
|
orient: 'vertical', |
|
|
|
top: '20%', |
|
|
|
right: 0, |
|
|
|
textStyle: { |
|
|
|
width: 90, |
|
|
|
color: '#fff', |
|
|
|
rich: { |
|
|
|
a: { |
|
|
|
width: 90 |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
formatter: name => { |
|
|
|
for (let a = 0; a < this.eduItem.length; a++) { |
|
|
|
// this.data 这个数据中有名称和次数 |
|
|
|
if (this.eduItem[a].name === name) { |
|
|
|
//两个名称进行对比,取出对应的次数 |
|
|
|
let params1 = name + "\n"; //然后return你需要的legend格式即可 |
|
|
|
console.log(params1); |
|
|
|
let tmp = params1.split("\n"); |
|
|
|
let res = "" + params1; |
|
|
|
for (let i in tmp) { |
|
|
|
res = res.replace(tmp[i], ""); |
|
|
|
} |
|
|
|
return res + params1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
title: { |
|
|
|
text: '12000', //图形标题,配置在中间对应效果图的80% |
|
|
|
subtext: '总数', |
|
|
|
left: 196, |
|
|
|
top: "center", |
|
|
|
textAlign: 'center', |
|
|
|
textStyle: { |
|
|
|
color: "#fff", |
|
|
|
fontSize: 28, |
|
|
|
align: "center" |
|
|
|
}, |
|
|
|
subtextStyle: { |
|
|
|
fontSize: 16, |
|
|
|
color: '#fff', |
|
|
|
align: 'center' |
|
|
|
} |
|
|
|
}, |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
// name: 'Access From', |
|
|
|
type: 'pie', |
|
|
|
// center: ['50%', '50%'], |
|
|
|
radius: ['40%', '60%'], |
|
|
|
avoidLabelOverlap: true, |
|
|
|
// top: top + '%', |
|
|
|
// height: '80%', |
|
|
|
// left: 0, |
|
|
|
width: 400, |
|
|
|
label: { |
|
|
|
position: 'outside', |
|
|
|
alignTo: 'edge', |
|
|
|
formatter: '{a|{c}}\n{r|}\n{name|{b}}', |
|
|
|
minMargin: 5, |
|
|
|
edgeDistance: 20, |
|
|
|
lineHeight: 15, |
|
|
|
color: '#fff', |
|
|
|
fontSize: 15, |
|
|
|
rich: { |
|
|
|
name: { |
|
|
|
padding: [0, 6, 0, 6] |
|
|
|
}, |
|
|
|
a: { |
|
|
|
fontSize: 15, |
|
|
|
color: '#fff', |
|
|
|
padding: [0, 6, 0, 6] |
|
|
|
}, |
|
|
|
r: { |
|
|
|
backgroundColor: 'auto', |
|
|
|
borderRadius: 6, |
|
|
|
width: 6, |
|
|
|
height: 6, |
|
|
|
// padding: [3, 3, 0, -12] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
emphasis: { |
|
|
|
label: { |
|
|
|
show: true, |
|
|
|
fontSize: '14', |
|
|
|
fontWeight: 'bold' |
|
|
|
} |
|
|
|
}, |
|
|
|
labelLine: { |
|
|
|
show: true, |
|
|
|
length: 20, |
|
|
|
length2: 0, |
|
|
|
maxSurfaceAngle: 80 |
|
|
|
}, |
|
|
|
labelLayout: function (params) { |
|
|
|
const isLeft = params.labelRect.x < _charts.getWidth() / 2; |
|
|
|
const points = params.labelLinePoints; |
|
|
|
// Update the end point. |
|
|
|
points[2][0] = isLeft |
|
|
|
? params.labelRect.x |
|
|
|
: params.labelRect.x + params.labelRect.width; |
|
|
|
return { |
|
|
|
labelLinePoints: points |
|
|
|
}; |
|
|
|
}, |
|
|
|
data: this.eduItem |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
option && _charts.setOption(option); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
clickAgePie (seriesIndex) { |
|
|
|
let _code = '' |
|
|
|
let isClick = false |
|
|
|