
    function 饼状图(name){  
        this.名称 = name;
        this.chartData = [];
        this.chartName = "";

        this.置可视 = function (value){
            if(value==true){
                var div = document.getElementById(this.名称);
                div.style.display="";	                
            }else{
                var div = document.getElementById(this.名称);
                div.style.display="none"; //不占位               
            }
        } 

        this.置可视2 = function (value){
            if(value==true){
                var div = document.getElementById(this.名称);
                div.style.visibility="visible";	                
            }else{
                var div = document.getElementById(this.名称);
                div.style.visibility="hidden"; //占位               
            }
        } 

        this.置图表高度 = function (value){
            var div = document.getElementById(this.名称);
            div.style.setProperty("height",value);
        } 
        
        this.初始化=function(seriesName){
            this.pieChart = echarts.init(document.getElementById(this.名称));//初始化图表
            this.chartData = [];
            this.chartName = seriesName; 
            this.pieChart.showLoading();//显示等待动画
        }

        this.添加数据=function(dataName,dataValue){
            var temp = '{ "name": dataName, "value": dataValue }';  
            temp = eval("(" + temp + ")");  //将字符串转换成json对象
            this.chartData.push(temp); //加入数组
        }

        this.添加完毕=function(){
            var option = {
                            series: [{
                                name: this.chartName,
                                type: 'pie',
                                radius: '70%',
                                center: ['50%', '50%'],
                                data: this.chartData
                            }]
                        }
            this.pieChart.hideLoading();//关闭等待动画
            this.pieChart.setOption(option); //设置图表数据    
        }

    }  


 