1、根据wiki增加宏代码如下:
function main(chartView) {
var chart = chartView.getChartObject().getChart();
var option = chartView.getChartObject().getOptions();
var series = option.series[0].data;
// 遍历所有标签
for (var i in series) {
series.label = series.label || {};
series.label.normal = series.label.normal || {};
series.label.normal.formatter = function(data) {
// debugger;
var name = data.name;
var value = data.value;
// 此处可设置标签格式 例:name:value
return name + "" + data.percent + "%)\n";
};
}
chart.setOption(option);
}