function DrawLinesClass(){ //画折线图类
	
	var L2=50;   //数据处理 的目标取样点数
	var L1=parseInt(L2*0.75);   //对数据处理结果的需要扩展的数组.
	this.width=500;   //默认作图区域的宽度.
	this.height=400;  //默认作图区域的高度.
	var lWidth=(this.width-this.width%L2)/L2;  //每个采样点由几个象素构成
	var maxY=0;
	var mapObj;
	var l=45;
	var b=30;
	this.NodeType=1;  //是否把数字标注上去   1要标， 0 不标
	this.Xunit="X";   //横坐标单位
	this.Yunit="Y";   //纵坐标单位
	this.xTextWidth=24;  //横坐标上的字的宽度.
	this.bgColor="#efefef"; //背景色
	this.color="#000000";   //折线的默认颜色
	this.NodeWidth=30;      //文本节点宽度
	
	

	this.setNode=function(l){ //设置采样点个数
		L2=l;
		L1=parseInt(L2*0.75);
	}
	
	this.setLeft=function(left){ //设置左边距
		l=left;
	}
	
	this.create=function(data,data1,obj,fun){ //开始画图, DATA是传入的包含折线信息的数组, data1 是横坐标显示的名称,fun 给标点要执行的方法
		  if (data.length>L2){
			  data=this.loadData40(data);
		  }else if (data.length<L1){
			data=this.loadData30(data)  ;
		  }else{
			data= this.loadData30to40(data);
		  }
		  
		  maxY=this.readMaxY(data); //取出最大值
		  if (maxY==0){
		    return;
		  }
		  	
		  if (data1!=null){
			  if (data1.length>L2){
				  data1=this.loadData40(data1);
			  }else if (data1.length<L1){
				data1=this.loadData30(data1)  ;
			  }else{
				data1= this.loadData30to40(data1);
			  }
		   }
		   
		   if (fun!=null){
		      if (fun.length>L2){
				  fun=this.loadData40(fun);
			  }else if (fun.length<L1){
				fun=this.loadData30(fun)  ;
			  }else{
				fun= this.loadData30to40(fun);
			  }
		   }
		   //数据采样完成
		   
		var  objID="n"+create_id();
	  	var newPoint= document.createElement("<div id='"+objID+"' style='width:"+this.width+"px;height:"+this.height+"px;background-color:"+this.bgColor+"; overflow:hidden;  ' ></div>");
		var newObj=obj.insertBefore(newPoint);
		newObj.innerHTML="<v:group ID='"+objID+"_1' style='WIDTH:"+this.width+"px;HEIGHT:"+this.height+"px; overflow:hidden;position: absolute; top:0px;left:0px;' coordsize ='"+this.width+","+this.height+"'></v:group>";
		mapObj=$(objID+"_1");
		this.PolyLine(data);
		switch (this.NodeType){
			case 1:  //标注文字
				this.Text(data,data1,fun);
				break;
			case 2:  //标注圆点
				this.oval(data,data1,fun)
				break;
			default:
				break;
		}
		
		this.Line(); //画坐标系统
		//折线和坐标绘制完成
		
		if (data1!=null){
			  this.Xtext(data1); // 画横坐标刻度
		}
		
		this.Ytext();  //画纵坐标刻度
		
	

	}
	
    this.PolyLine=function(data){ //画好折线
		var xy=this.GetXY(data);
		//alert(this.color)
		var strElement="<v:PolyLine  strokeColor='"+this.color+"' filled='false' Points='"+xy+"' style='position:relative;top:0;left:0;'/></v:PolyLine>";
		var newPoint = document.createElement(strElement);
		var newObj=mapObj.insertBefore(newPoint);
	}
	
	this.Text=function(data,data1,fun){ //写入文字
		var x="";
		var y="";
		var t="";
		var clickStr="";
		for (var i=0;i<data.length;i++){
			x=this.X(i)-10;
			y=this.Y(data[i])-10; //文字框左移
			if (y!=null & data[i]!=-1){
				if (data1!=null){
					t=data1[i]+"\n"+data[i]
				}else{
					t=data[i]
				}
				if (fun!=null){
				    clickStr=" onclick=\""+fun[i]+"\"";
				}
			//	alert(clickStr);
				var strElement="<v:RoundRect "+clickStr+" title='"+t+"' style='top:"+y+";left:"+x+";width:"+this.NodeWidth+";height:15;background-color:#ffffff'>"
  				strElement+="</v:RoundRect>";
				var newPoint = document.createElement(strElement);
				strElement="<v:TextBox inset='0pt,0pt,0pt,0pt' style='font-size:12px;color:#000000;text-align:center' >"+data[i]+"</v:TextBox>";
				var newObj=mapObj.insertBefore(newPoint);
				newObj.innerHTML=strElement;
			}
		}
	}
	
	this.oval=function(data,data1,fun){ //标注圆点
		var x="";
		var y="";
		var t="";
		var clickStr="";
		for (var i=0;i<data.length;i++){
			x=this.X(i)-3;
			y=this.Y(data[i])-3; //圆点
			if (y!=null & data[i]!=-1){
				if (data1!=null){
					t=data1[i]+"\n"+data[i]
				}else{
					t=data[i];
				}
				if (fun!=null){
				    clickStr=" onclick=\""+fun[i]+"\"";
				}
				var strElement="<v:oval "+clickStr+"  strokeColor='"+this.color+"' title='"+t+"' style='position:relative;left:"+x+";top:"+y+";width:6;height:6'/>"
  				strElement+="</v:oval>";
				var newPoint = document.createElement(strElement);
				var newObj=mapObj.insertBefore(newPoint);
			}
		}
	
	
	}

	
	
	this.Line=function(){ //画坐标系
		 var x1=l-12;
		 var y1=this.height-b+10;
		 var x2=this.width-5;
		 var y2=y1;
		 var strElement="<v:line  style='position:relative' from='"+x1+","+y1+"' to='"+x2+","+y2+"' /></v:line>";
		var newPoint = document.createElement(strElement);
		newPoint.innerHTML="<v:stroke EndArrow='Classic'/>";
		var newObj=mapObj.insertBefore(newPoint);
		
	    var xa1=l-12;
		var ya1=this.height-b+10;
		var xa2=x1
		var ya2=2;
		strElement="<v:line  style='position:relative' from='"+xa1+","+ya1+"' to='"+xa2+","+ya2+"' /></v:line>";
		newPoint = document.createElement(strElement);
		newPoint.innerHTML="<v:stroke EndArrow='Classic'/>";
		newObj=mapObj.insertBefore(newPoint);
		
		this.createText(3,y1-12,"0",l-18);
		this.createText(3,5,this.Yunit,l-19);
		this.createText(x2-this.xTextWidth,y2+4,this.Xunit,this.xTextWidth);
	
		
	
//		  Xunit

		 
	}
	
	this.Xtext=function(data){  //写横坐标上的刻度文字
		var x=0;
		var x1=0;
		var y=this.height-18;
		for (var i=0;i<L2;i++){
			x=this.X(i);
			if (x-x1>40 && data[i]!=-1){
				this.createText(x-(this.xTextWidth/2),y,data[i],this.xTextWidth)
				x1=x;
			}else{
				
			}
		}
		
	}
	
	
	this.Ytext=function(){ //画纵坐标刻度
		var f=this.height-b-20;
		f=f/30;  //30/15
		f=parseInt(maxY/f);
		if (f>10){
			f=f.toString();
			
			var l0=f.length;
		
			var l1="";
			for (var i=1;i<l0;i++){
				l1+="0";
			}
		
			f=f.substring(0,1);
			switch(parseInt(f)){
				case 3:
					f="4";
					break;
				case 4:
				case 6:
					f="5";
					break;
				case 7:
				case 8:
				case 9:
					 f="10";
					 break;
				default:
					break;
				
			}
			
			f=parseInt(f+l1);
		}else{
			if (f==0){f=5;}
			//f=10;
		}
		//alert(l+"f:"+f);
//		if (f<10 & f>5){
//			f=10;
//		}else if (f>1 & f<5){
//			f=5;
//		}
		var y=0;
		//if (f==0){f=2;}
		//alert(l+"f:"+f);
		//return;
		//
		for (var i=0;i<maxY;i=i+f){
			if (i!=0){
				y=this.Y(i)-9;
				if (y<20){y=20;}
				this.createText(3,y,i,l-18);
			}
		}
		
	}
	
	
	
	this.createText=function(x,y,txt,w){ //在指定位置写入文字
		var strElement="<v:RoundRect  fillcolor='"+this.bgColor+"' strokeColor='"+this.bgColor+"' style='font-size:12px;top:"+y+";left:"+x+";width:"+w+";height:12;text-align:center;'>"
		strElement+="</v:RoundRect>";
		var newPoint = document.createElement(strElement);
		strElement=""+txt+"";
		var newObj=mapObj.insertBefore(newPoint);
		newObj.innerHTML=strElement;
	}
	
	
	
	this.GetXY=function(data){ //获取坐标系列
		var xy="";
		var x="";
		var y="";
		for (var i=0;i<data.length;i++){
			x=this.X(i);
			y=this.Y(data[i]);
			if (y!=null){
				xy+=x+","+y+" ";
			}
		}
	 
		return xy;
	}
	
	
	this.Y=function(y){ //取纵坐标
	    if (y==-1){
			return null;
		}
		var y1=0;
		switch (this.NodeType){
			case 1:
				 y1=this.height-((this.height-b-20)/maxY*y)-b+4; //文字
				 break;
			case 2:
				 y1=this.height-((this.height-b-20)/maxY*y)-b+6;//圆点
				break;
			default:
				 y1=this.height-((this.height-b-20)/maxY*y)-b+9;//无
				break;
		}
		return parseInt(y1);
	}
	
	this.X=function(x){ //取横坐标
		switch (this.NodeType){
			case 2:
				return parseInt(((this.width-l-45)/L2)*x+l-8); //圆点
				break;
			case 1:
				return parseInt(((this.width-l-45)/L2)*x+l-1);  //文字
				break;
			default:
				return parseInt(((this.width-l-45)/L2)*x+l-11); //无
				break;
		}
	}
	
	
	
	this.readMaxY=function(data){ //取最大值
		var m=0;
		for (var i=0;i<data.length;i++){
			if (data[i]>m && !isNaN(data[i])){
				m=data[i];
			}
		}

		return m;
	}
	
	
	
	
	this.loadData40=function (data){ // 如果大于40的数组, 对数据作抽样
		var st=data.length/L2;
		var outData=new Array();
		
		for (var i=0;i<L2;i++){
			var x=parseInt(i*st);
			outData[i]=data[x];
		}
			return outData;
	}
	
	
	this.loadData30=function(data){ //如果小于30的数组, 对数据作扩展
		var st=data.length/L2;
		var xBak=-1;
		var outData=new Array();
		for (var i=0;i<L2;i++){
			var x=parseInt(i*st);
			if (x==xBak){
				outData[i]=-1;
			}else{
				outData[i]=data[x];
				xBak=x;
			}
		}
		return outData;
	}
	
	this.loadData30to40=function(data){ //如果30到40的数组,对数据作补充
		var outData=new Array();
		for (var i=0;i<L2;i++){
			if (i<data.length)	{
				outData[i]=data[i];
			}else{
				outData[i]=-1;
			}
		}
		return outData;
		
	}
}