Echarts 饼图图形上的文本标签 formatter rich

avatar
作者
猴君
阅读量:0

在这里插入图片描述

 option: {         tooltip: {           // show: false,           trigger: 'item'         },         color: ['#00F4FF', '#04F5BB', '#02A6FC', '#BAE649', '#ffffff'],         series: [           {             name: '今日告警',             type: 'pie',             radius: ['47%', '50%'],             avoidLabelOverlap: false,             itemStyle: {               borderRadius: 10,               // borderColor: '#fff',               borderWidth: 5             },             label: {               show: true,               position: 'outside',               formatter: data => `{a|${data.name} ${data.percent.toFixed(0)}%} \n {b|${data.value}}`,               rich: {                 a: {                   color: '#ffffff',                   fontSize: 12,                   lineHeight: 18,                   fontFamily: 'MicrosoftYaHeiUI'                 },                 b: {                   fontSize: 12,                   color: '#6EDDD3',                   lineHeight: 20,                   fontFamily: 'D-DIN'                 },               },               // 这4个参数依次对应右/下/左/上四个方位。而0 0 1 0则代表渐变色从正左方开始               backgroundColor: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, color: 'rgba(255,255,255,0.06)' }, { offset: 1, color: 'rgba(255,255,255,0.12)' }]),               padding: [4, 10],               borderRadius: 4             },             emphasis: {               // disabled: true,               // label: {               //   show: true,               //   fontSize: 40,               //   fontWeight: 'bold'               // }             },             labelLine: {               show: true             },             data: [               { value: 0, name: '聚集' },               { value: 0, name: '打架' },               { value: 0, name: '倒地' },               { value: 0, name: '楼道拥堵' },               { value: 0, name: '充电桩起火' },             ]           }         ]       }, 

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!