var classEcharts
= echarts
.init(document
.getElementById('transcation_echarts'));
var selected
= {};
var merchant_transaction_ranking_top5Key
={$merchant_transaction_ranking_top5Key
};
for(let i
=0;i
<merchant_transaction_ranking_top5Key
.length
;i
++){
if(i
<6){
selected
[merchant_transaction_ranking_top5Key
[i
]] = true;
}else{
selected
[merchant_transaction_ranking_top5Key
[i
]] = false;
}
}
var classpeOption
={
title
: {
text
: 'Top5 商户交易排行',
left
: 'center',
bottom
: 30,
textStyle
: {
color
: '#333',
fontSize
:'16',
fontWeight
:'400',
}
},
tooltip
: {
trigger
: 'item',
position
: ['50%', '50%'],
formatter
: '{a} <br/>{b}: {c} ({d}%)'
},
color
:['#21c835','#c51d1d','#5ec2f0','#e49a36','#86BF8F'],
legend
: {
width
:'100%',
type: 'scroll',
orient
: 'vertical',
left
:0,
top
:20,
bottom
:10,
data
:merchant_transaction_ranking_top5Key
,
selected
:selected
,
icon
:'circle',
itemWidth
:10,
formatter
: function
(name
) {
return echarts
.format
.truncateText(name
, 50, '12px Microsoft Yahei', '…');
},
tooltip
: {
show
: false
}
},
series
: [
{
name
: '所属占比',
type: 'pie',
radius
: ['25%', '35%'],
center
:['50%','60%'],
avoidLabelOverlap
: false,
label
: {
show
: true,
},
emphasis
: {
label
: {
show
: true,
fontSize
: '5',
fontWeight
: 'bold'
}
},
labelLine
: {
show
: true,
length
:0
},
data
: {$merchant_transaction_ranking_top5Value
}
}
]
};
classEcharts
.setOption(classpeOption
);