var echartData = [{ value: 21, name: '系列1' }, { value: 38, name: '系列2' }, { value: 35, name: '系列3' }, { value: 31, name: '系列4' }, { value: 28, name: '系列5' }] var rich = { yellow: { color: "#3bc7ff", fontSize: 8, padding: [8, 0], align: 'center' }, total: { color: "#A2C7F3", fontSize: 8, align: 'center' }, white: { color: "#a2c7f3", align: 'center', fontSize: 8, padding: [8,0 ] }, blue: { color: '#3bc7ff', fontSize: 8, align: 'center' }, hr: { borderColor: '#a2c7f3', width: '100%', borderWidth: 1, height: 0, } } pieTemplate2 = { title:{ text:"输入标题", textStyle:{ color:'#fff', fontStyle:'normal', fontWeight:'bold', fontFamily:'sans-serif',      fontSize:12 } }, textStyle:{ fontFamily: "Microsoft YaHei", fontSize: 9, fontStyle: "normal", fontWeight: "normal", color: '#fff' }, tooltip : { trigger: 'item', formatter: "{b} : {c} ({d}%)" }, color: ['#fc962c', '#d83472', '#0F9AF8', '#2B63D5', '#37a2da', '#2ECACE','#6F81DA','#8378ea'], series: [{ name: '值', type: 'pie', radius: ['42%', '50%'], hoverAnimation: false, label: { normal: { // formatter: function(params, ticket, callback) { // var total = 0; // var percent = 0; // echartData.forEach(function(value, index, array) { // total += value.value; // }); // percent = ((params.value / total) * 100).toFixed(1); // return '{white|' + params.name + ':}{yellow|' + params.value + '}'; // }, borderWidth: 20, borderRadius: 4, rich: rich, textStyle: {           fontSize: 8          } }, }, labelLine: { normal: { length:5, length2: 5, } }, data: echartData }] }; pieTemplate2Series=[{ name: '值', type: 'pie', radius: ['42%', '50%'], hoverAnimation: false, label: { normal: { // formatter: function(params, ticket, callback) { // var total = 0; // var percent = 0; // echartData.forEach(function(value, index, array) { // total += value.value; // }); // percent = ((params.value / total) * 100).toFixed(1); // return '{white|' + params.name + ':}{yellow|' + params.value + '}'; // }, borderWidth: 20, borderRadius: 4, rich: rich, textStyle: {         fontSize: 8        } }, }, labelLine: { normal: { length:5, length2: 5, } }, data: echartData }]