Echarts餅狀圖預設顯示lable
阿新 • • 發佈:2018-12-17
Echarts餅狀圖預設顯示指定lable
// 基於準備好的dom,初始化echarts例項 var myChart = echarts.init(document.getElementById('graph-donut')); // 指定圖表的配置項和資料 option = { series: [ { name:'訪問來源', type:'pie', radius: ['50%', '75%'], avoidLabelOverlap: false, label: { normal: { show: false, position: 'center' }, emphasis: { show: false, textStyle: { fontSize: '5', fontWeight: 'bold' } } }, labelLine: { normal: { show: false } }, data:[ {value:335, name:'直接訪問', label: {show: true , fontSize: '8', fontWeight: 'bold'}}, {value:310, name:'郵件營銷'}, {value:234, name:'聯盟廣告'} ] } ] }; // 使用剛指定的配置項和資料顯示圖表。 myChart.setOption(option);