This commit is contained in:
2023-07-10 10:15:00 +08:00
parent f9f0ca1ddb
commit e3b4116993

View File

@@ -315,8 +315,9 @@ export default {
// 饼图: // 饼图:
getPie(){ getPie(){
var that = this; var that = this;
that.licensesNum = JSON.parse(JSON.stringify(that.showData).replace(/license/g,"name")); let tmp = that.licensesNum;
that.licensesNum = JSON.parse(JSON.stringify(that.showData).replace(/count/g,"value")) tmp = JSON.parse(JSON.stringify(tmp).replace(/license/g,"name"));
tmp = JSON.parse(JSON.stringify(tmp).replace(/count/g,"value"))
that.MyOption = { that.MyOption = {
tooltip: { tooltip: {
trigger: 'item', //item数据项图形触发主要在散点图饼图等无类目轴的图表中使用。 trigger: 'item', //item数据项图形触发主要在散点图饼图等无类目轴的图表中使用。
@@ -328,11 +329,10 @@ export default {
}, },
series: [{ series: [{
type: 'pie', type: 'pie',
data: that.licensesNum, data: tmp,
label: {//饼图文字的显示 label: {//饼图文字的显示
show: true, //默认 显示文字 show: true, //默认 显示文字
formatter: function (arg) { formatter: function (arg) {
console.log(arg);
return arg.name + ' 项目 ' + arg.value + " 个 " +'\n'+ arg.percent + "%" return arg.name + ' 项目 ' + arg.value + " 个 " +'\n'+ arg.percent + "%"
} }
}, },