qc.ifish7.com/Public/Admin/js/tongji.js

289 lines
8.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//饼图/条形图统计
function pie_chart(field,url,elementid1,elementid2){
//ajax获取数据
$.get(url,{"field":field},function(result){
var status=result.status;
var info=result.info;
if(status){
//[饼图]图表代码开始
var myChart = echarts.init(document.getElementById(elementid1),"macarons");
var option={
title:{
text: '',
subtext: '',
x:'center'
},
tooltip:{
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend:{
orient : 'vertical',
x : 'left',
data:info.data_name,
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {
show: true,
type: ['pie', 'funnel'],
option: {
funnel: {
x: '25%',
width: '50%',
funnelAlign: 'left',
max: 1548
}
}
},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
series : [
{
name:'数量',
type:'pie',
radius : '55%',
center: ['50%', '60%'],
data:info.data_parmas,
}
]
};
myChart.setOption(option);
//[饼图]图表代码结束
//[条型图]图表代码开始
if(elementid2){
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById(elementid2),"macarons");
// 指定图表的配置项和数据
var option =option = {
tooltip : {
trigger: 'axis'
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
data : info.data_name
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'数量',
type:'bar',
data:info.data_values,
markPoint : {
data : [
{type : 'max', name: '最大值'},
{type : 'min', name: '最小值'}
]
},
markLine : {
data : [
{type : 'average', name: '平均值'}
]
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
//[条型图]图表代码结束
}else{
parent.layer.alert(info);
$(obj).find("button[type='submit']").attr("disabled",false);
}
},"json")
}
//饼图统计
function pie_chart2(elementid,info){
var myChart = echarts.init(document.getElementById(elementid),"macarons");
var option={
title:{
text: '',
subtext: '',
x:'center'
},
tooltip:{
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend:{
orient : 'vertical',
x : 'left',
data:info.data_name,
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {
show: true,
type: ['pie', 'funnel'],
option: {
funnel: {
x: '25%',
width: '50%',
funnelAlign: 'left',
max: 1548
}
}
},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
series : [
{
name:'数量',
type:'pie',
radius : '55%',
center: ['50%', '60%'],
data:info.data_parmas,
}
]
};
myChart.setOption(option);
}
//条形图统计
function pie_chart3(elementid,info){
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById(elementid),"macarons");
// 指定图表的配置项和数据
var option = {
tooltip : {
trigger: 'axis'
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: true},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
data : info.data_name
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'数量',
type:'bar',
data:info.data_values,
markPoint : {
data : [
{type : 'max', name: '最大值'},
{type : 'min', name: '最小值'}
]
},
markLine : {
data : [
{type : 'average', name: '平均值'}
]
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
//折现统计
function pie_chart4(elementid,info){
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById(elementid),"macarons");
// 指定图表的配置项和数据
var option = {
title : {
text: '最近30天访客统计',
subtext: ''
},
tooltip : {
trigger: 'axis'
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
boundaryGap : false,
data : info.data_name,
}
],
yAxis : [
{
type : 'value',
axisLabel : {
formatter: '{value} '
}
}
],
series : [
{
name:'',
type:'line',
data:info.data_values,
markPoint : {
data : [
{type : 'max', name: '最大值'},
{type : 'min', name: '最小值'}
]
},
markLine : {
data : [
{type : 'average', name: '平均值'}
]
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}