项目需求:
1、自定义icon图片样式;
2、相关数值直接显示;
解决方案:
自定义icon图片样式
data: ['家电', '服装', '数码'],
转为:
data: [{name:'家电',icon:'image://lockdatav1.png'}, {name:'服装',icon:'image://lockdatav2.png'}, {name:'数码',icon:'image://lockdatav3.png'}, ],
相关数值直接显示
formatter: function (name) { var index = 0; var labels = ['家电', '服装', '数码']; var counts = [123,234,345]; labels.forEach(function (value, i) { if (value == name) { index = i; } }); return counts[index] + "万元\n" + name; },