1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| export default class { constructor(echarts, id, seriesdata, answerTotal) { console.log(seriesdata) this.echarts = echarts; let option = this.getOption(seriesdata, answerTotal) var myChart = this.echarts.init(document.getElementById(id)); myChart.setOption(option);
}
getOption(seriesdata, answerTotal) { let option = { title: { text: answerTotal + "人", left: "center", top: "50%", textStyle: { color: "#27D9C8", fontSize: 18, align: "center" } }, graphic: { type: "text", left: "center", top: "40%", style: { text: "实测", textAlign: "center", fill: "#333", fontSize: 18, fontWeight: 700 } }, legend: { show: false, }, series: [ { type: 'pie', radius: ['40%', '60%'], center: ['50%', '50%'],
label: { alignTo: 'edge', formatter: '{name|{b}}\n{time|{c} 人}', minMargin: 5, edgeDistance: 10, lineHeight: 15, rich: { time: { fontSize: 10, color: '#999' } } }, itemStyle: { normal: { color: function (colors) { var colorList = ['#FF8400', '#EEC23A', '#EEE93A', '#CCCCCC']; return colorList[colors.dataIndex] } }, shadowBlur: 200, shadowColor: 'rgba(0, 0, 0, 0.5)' }, data: seriesdata,
} ]
};
return option; } }
|