参数设置
var num = 0; var cor=''; var sta =''; if (num == 0){ cor = '#e2e2e2'; var sta ='异常'; }else{ cor = '#FF7722'; var sta ='正常'; }
配置选项
var option = { tooltip: { trigger: 'item' }, series: [ { name: '访问来源', type: 'pie', radius: ['40%', '70%'], avoidLabelOverlap: false, itemStyle: { color:cor, borderRadius: 10, borderColor: '#fff', borderWidth: 2 }, label: { show: true, position: 'center' }, emphasis: { label: { show: true, fontSize: '40', fontWeight: 'bold' } }, labelLine: { show: false }, data: [ {value: 1, name: sta} ] } ] };
lockdatav Done!