domaincount.js 4.5 KB
// 程序名称:    时速邮件管理系统(EsMail)
// 程序版本:    V2.0
// 作    者:    深圳市科飞时速网络技术有限公司(0755-88843776)
// 版权所有:    深圳市科飞时速网络技术有限公司
// 技术支持:    Tech@21gmail.com
// 单元名称:   域总统计js文件
// 开始时间:    2013.11.1
// 程 序 员:    谢勇
// 最后修改:    2013.11.1
// 备    注:    

$(document).ready(function(){
	//查询域总统计(总发量,总点读量,总未点读量,总回复量,总订阅量,总退订量)
	findDomainCountInfo();

});

//查询统计信息
function findDomainCountInfo(){
	$.ajax({ 
		type: "post", 
		url: "yxyC_findCountDomain.action", 
		dataType:"json",
		error: function() {alert("异常");}, 
		success: function(msg) {
			$("#domain_tolnum").html(msg["sendTol"]);//总量
			$("#domain_clickTol").html(msg["clickTol"]);//点击总量
			$("#domain_NoClickTol").html(msg["noclickTol"]);//未点击总量
			$("#domain_unTol").html(msg["unTol"]);//退订量
			
			var clickBai=parseFloat((msg["clickTol"]/msg["sendTol"]));		
			if(msg["clickTol"]!=0&&msg["sendTol"]!=0){
				$("#domain_clickBai").html((clickBai*100).toFixed(2)+"%");//点击百分比
				nosendTolb=parseFloat((clickBai*100).toFixed(2));
			}	
			
			var noClickBai=parseFloat((msg["noclickTol"]/msg["sendTol"]));
			if(msg["noclickTol"]!=0&&msg["sendTol"]!=0){
				$("#domain_noClickBai").html((noClickBai*100).toFixed(2)+"%");//未点击百分比
				tdTolb=parseFloat((noClickBai*100).toFixed(2));
			}
			var UnBai=parseFloat(msg["unTol"]/msg["sendTol"]);
			if(msg["unTol"]!=0&&msg["sendTol"]!=0){
				$("#domain_unBai").html((UnBai*100).toFixed(2)+"%");//退订击百分比
				unTolb=parseFloat((UnBai*100).toFixed(2));
			}
			zhuzi();
		}
	});	
}

//柱子图
function zhuzi(){
	var pmg=$(window).height();
	$(".yx_con1").css("height",pmg);
 	var colors = Highcharts.getOptions().colors,
        categories = ['发送', '点读', '未读', '回复', '订阅', '退订'],
        data = [{
                y: sendTolb,
                color: colors[7]
            }, {
                y: nosendTolb,
                color: colors[1]
               
            }, {
                y: tdTolb,
                color: colors[2]
               
            }, {
                y: 0,
                color: colors[3]
                
            }, {
                y: 0,
                color: colors[4]
               
            },{
                y: unTolb,
                color: colors[5]
               
            }];

    function setChart(name, categories, data, color) {
	chart.xAxis[0].setCategories(categories, false);
	chart.series[0].remove(false);
	chart.addSeries({
		data: data,
		color: color || 'white'
	}, false);
	chart.redraw();
    }

    var chart = $('#homecom').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: null
        },
		credits:{
                enabled:false // 禁用版权信息
         },
        xAxis: {
            categories: categories
        },
        yAxis: {
            title: {
                text: '单位:率百分比统计'
            }
        },
        plotOptions: {
            column: {
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            var drilldown = this.drilldown;
                            if (drilldown) { // drill down
                                setChart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color);
                            } else { // restore
                                setChart(name, categories, data);
                            }
                        }
                    }
                },
                dataLabels: {
                    enabled: true,
                    color: colors[0],
                    style: {
                        fontWeight: 'bold'
                    },
                    formatter: function() {
                        return this.y +'%';
                    }
                }
            }
        },
		 legend: {
            enabled: false
        },
        tooltip: {
            formatter: function() {
                var point = this.point,
                    s = this.x +':<b>'+ this.y +'% </b><br/>';
              
                return s;
            }
        },
        series: [{
            name: name,
            data: data,
            color: 'white'
        }],
        exporting: {
            enabled: false
        }
    })
    .highcharts();

}