在开发过程中,得到的饼图百分比之和不为100%,但是在官网测试中得到的为100%,开发效果如左侧,直接访问的百分比为10.71%,官网中为10.72%,开发代码附上,求解决方案,急急急。
配置项如下
option = {
tooltip: {
show: false,
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
right: 'right',
y: 'bottom',
orient: 'vertical',
selectedMode: false,
label: {
normal: {
textStyle: {
color: '#c9e7f1',
fontSize: '14px',
fontFamily: 'Microsoft YaHei'
}
}
},
data: []
},
series: [{
name: '访问来源',
type: 'pie',
center: ['45%', '50%'],
radius: '50%',
label: {
normal: {
formatter: '{b}{d}%',
fontSize: '14px',
fontFamily: 'Microsoft YaHei'
}
},
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
data: [{
value: 3,
name: '直接访问'
}, {
value: 2,
name: '邮件营销'
}, {
value: 14,
name: '联盟广告'
}, {
value: 9,
name: '视频广告'
}]
}]
};
// /*function createPie(event) {
// var option = {
// tooltip: {
// show: false,
// trigger: 'item',
// formatter: "{a} <br/>{b} : {c} ({d}%)"
// },
// legend: {
// right: 'right',
// y: 'bottom',
// orient: 'vertical',
// selectedMode: false,
// label: {
// normal: {
// textStyle: {
// color: '#c9e7f1',
// fontSize: '14px',
// fontFamily: 'Microsoft YaHei'
// }
// }
// },
// data: []
// },
// series: [{
// name: '访问来源',
// type: 'pie',
// center: ['45%', '50%'],
// radius: '50%',
// label: {
// normal: {
// formatter: '{b}{d}%',
// fontSize: '14px',
// fontFamily: 'Microsoft YaHei'
// }
// },
// itemStyle: {
// emphasis: {
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowColor: 'rgba(0, 0, 0, 0.5)'
// }
// },
// data: [{
// value: 3,
// name: '直接访问'
// }, {
// value: 2,
// name: '邮件营销'
// }, {
// value: 14,
// name: '联盟广告'
// }, {
// value: 9,
// name: '视频广告'
// }]
// }]
// };
// var divPieChart = document.getElementById("divPieChart");
// var pieChart = echarts.init(divPieChart);
// pieChart.setOption(option);
// pieChart.resize();
// }*/