You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.1 KiB
111 lines
2.1 KiB
|
|
/**
|
|
* 显示好评, 中评, 差评--饼状图
|
|
*/
|
|
function queryCriticismRatio(data){
|
|
var dom = document.getElementById("criticism_ratio");
|
|
var criticism_ratio_chart = echarts.init(dom);
|
|
|
|
var option = {
|
|
tooltip : {
|
|
trigger : 'item',
|
|
formatter : "{a} <br/>{b} : {c} ({d}%)"
|
|
},
|
|
color : [ '#D6624E', '#CA942F', '#2EB4C7' ],
|
|
series : [
|
|
{
|
|
name : '评论占比',
|
|
type : 'pie',
|
|
radius : [ '30%', '60%' ],
|
|
label: {
|
|
normal: {
|
|
formatter : "{b} : {c}\n {d}%",
|
|
},
|
|
},
|
|
data : data,
|
|
}
|
|
]
|
|
};
|
|
if (option && typeof option === "object") {
|
|
criticism_ratio_chart.setOption(option, true);
|
|
// echarts点击事件
|
|
criticism_ratio_chart.on('click', function(params) {
|
|
var ctype = params.data.text;
|
|
$("#ctype").val(ctype);
|
|
onSearch('', 'all');
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 显示好评, 中评, 差评--饼状图
|
|
*/
|
|
function queryCriticismNum(data, total) {
|
|
var dom = document.getElementById("criticism_num");
|
|
var criticism_num_chart = echarts.init(dom);
|
|
|
|
var option = {
|
|
tooltip : {
|
|
show : false
|
|
},
|
|
xAxis : [ {
|
|
show : false,
|
|
type : 'category',
|
|
} ],
|
|
yAxis : [ {
|
|
show : false,
|
|
},{
|
|
show : false,
|
|
} ],
|
|
grid:{
|
|
x : '100%',
|
|
y : '170',
|
|
x2 : '100%',
|
|
y2 : '170',
|
|
},
|
|
series : [ {
|
|
name : '数据',
|
|
type : 'bar',
|
|
barWidth : '50%',
|
|
label : {
|
|
normal : {
|
|
show : true,
|
|
position : 'top'
|
|
}
|
|
},
|
|
itemStyle : {
|
|
normal : {
|
|
color : function(params) {
|
|
var colorList = [ '#D6624E', '#CA942F', '#2EB4C7' ];
|
|
return colorList[params.dataIndex]
|
|
}
|
|
},
|
|
},
|
|
data : data
|
|
},
|
|
{
|
|
name : '背景',
|
|
type : 'bar',
|
|
barWidth : '50%',
|
|
barGap : '-100%',
|
|
data : [ total, total, total ],
|
|
itemStyle : {
|
|
normal : {
|
|
color : 'rgba(255,255,255,0.1)'
|
|
}
|
|
},
|
|
},
|
|
]
|
|
}
|
|
|
|
if (option && typeof option === "object") {
|
|
criticism_num_chart.setOption(option, true);
|
|
// echarts点击事件
|
|
criticism_num_chart.on('click', function(params) {
|
|
var ctype = params.data.text;
|
|
$("#ctype").val(ctype);
|
|
onSearch('', 'all');
|
|
});
|
|
}
|
|
}
|
|
|
|
|