function EchartsBase(){
	//图形容器
	EchartsBase.mainDiv=null;
	//柱图数据格式
	EchartsBase.data={"title":"本周运维告警统计",xAxis: ["监控","NVR","服务器","应用系统"],"legend":[{"name":"Doset","data":[5, 20, 36, 50],"color":"#00accb"},{"name":"Yeland","data":[51, 210, 36, 10],"color":"#fa102a"}]};
	//柱形+折线图数据格式    折线图数据格式
	//EchartsBase.data={"title":"本周运维告警统计",xAxis: ["监控","NVR","服务器","应用系统"],"legend":[{"name":"Doset","data":[5, 20, 36, 50],"color":"green"},{"name":"Yeland","data":[51, 210, 36, 10],"color":"blue"},{"name":"Yeland1","data":[21,12,13,14],"color":"red"}]};
	//饼图数据格式
	//EchartsBase.data={"title":"本周运维告警统计",data:[{name:"直接访问",value:335,color:"red"},{name:"邮件营销",value:310,color:"blue"},{name:"联盟广告",value:234,color:"green"},{name:"视频广告",value:135,color:"yellow"},{name:"搜索引擎",value:1548,color:"pink"}]};

}

EchartsBase.init=function(obj){
	EchartsBase();
	EchartsBase.mainDiv= echarts.init(document.getElementById(obj.id));
	EchartsBase.data= obj.data;
};

//柱形图
EchartsBase.barChart=function(obj){
	EchartsBase.init(obj);
	// 指定图表的配置项和数据
    var option = {
        title: {
            text: EchartsBase.data.title
        },
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:[EchartsBase.data.legend[0].name,EchartsBase.data.legend[1].name]
        },
        xAxis: {
        	type : 'category',
            data:  EchartsBase.data.xAxis
        },
 //       yAxis: [{type:"value",min:0,max:250,interval:50}],
        yAxis: [{type:"value"}],
        series: [{
            name: EchartsBase.data.legend[0].name,
            type: 'bar',
            data: EchartsBase.data.legend[0].data,
            itemStyle:{color:function(params){
           	 var color= [EchartsBase.data.legend[0].color];
           	 return color[params.dataIndex];
            }}
        },
        {
            name: EchartsBase.data.legend[1].name,
            type: 'bar',
            data: EchartsBase.data.legend[1].data,
            itemStyle:{color:function(params){
           	 var color= [EchartsBase.data.legend[1].color];
           	 return color[params.dataIndex];
            }}
        }]
    };

    // 使用刚指定的配置项和数据显示图表。
    EchartsBase.mainDiv.setOption(option);
};
