var dom = document.getElementById("siyi"); var myChart = echarts.init(dom); var app = {}; var option;option = { tooltip: { trigger: 'item', //formatter: "{b} : {c} ({d}%)" formatter: "{b} :{d}%" }, legend: { show: false, top: '5%', left: 'center' }, series: [ { name: '', type: 'pie', radius: ['40%', '70%'], avoidLabelOverlap: false, label: { show: false, position: 'center' }, emphasis: { label: { show: true, fontSize: '20', fontWeight: 'normal' } }, labelLine: { show: false }, data: [{"value":"12","name":"always"},{"value":"6","name":"right"},{"value":"6","name":"straight"},{"value":"6","name":"continuously"},{"value":"6","name":"level"},{"value":"6","name":"constantly"},{"value":"6","name":"clear"},{"value":"6","name":"direct"},{"value":"6","name":"all the time"},{"value":"12","name":"all the while"},{"value":"12","name":"all through"},{"value":"12","name":"beeline"}] } ] };console.log(option); if (option && typeof option === 'object') { myChart.setOption(option); }