function viewSingleDistribution(odata,pieChart) {
var chartDom = document.getElementById('viewSingleDistribution');
var myChart = echarts.init(chartDom);
var option;
option = {
tooltip: {
trigger: 'item',
formatter:function(data){
return data.name+ " : " + data.value + "题 <br/>"+ " ("+ roundFun(data.percent, 1)+"%)";
}
},
color:['#4cf100', '#00bdff', '#ffb500', '#ddd'],
series: [
{
type: 'pie',
radius: '40%',
center:['50%','50%'],
label: {
formatter:function(data){
return data.name+ " : " + data.value + "题 \n"+ " ("+ roundFun(data.percent, 1)+"%)";
}
},
data: pieChart.series[0].customData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
}
]
};
option && myChart.setOption(option);
}
data测试数据
completionCharts:{
"type":"pie",
"series":[
{
"type":"pie",
"customData":[
{
"name":"掌握",
"value":2
},
{
"name":"熟悉",
"value":1
},
{
"name":"了解",
"value":0
},
{
"name":"未作答",
"value":0
}
]
}
]
},