var myChart = echarts.init(document.getElementById("pie-chart")); myChart.setOption({ title: { text: '动作次数分布', subtext: '数据来自 result.json' }, tooltip : { trigger: 'item', formatter: "{a} <br/>{b} : {c} ({d}%)" }, series : [{ name: '动作', type: 'pie', radius: '55%', center: ['50%', '60%'], data: value, itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } }] }); });改为图例显示中文购买、收藏、加购
时间: 2024-04-26 21:24:44 浏览: 101
var myChart = echarts.init(document.getElementById("pie-chart"));
myChart.setOption({
title: {
text: '动作次数分布',
subtext: '数据来自 result.json'
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['购买', '收藏', '加购']
},
series: [{
name: '动作',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: value,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
label: {
show: true,
formatter: '{b} : {c} ({d}%)'
}
}]
});
阅读全文