Jelajahi Sumber

功图等图形绘制,限制绘制点在y轴最大最小,x轴最大最小范围内

chenwen 5 bulan lalu
induk
melakukan
50ab15a169
1 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 12 0
      src/components/diagram/lib/diagram.js

+ 12 - 0
src/components/diagram/lib/diagram.js

@@ -369,12 +369,24 @@ Diagram.prototype={
 	},
 	
 	getX:function(d){
+		if(d<this.xMin){
+			d=this.xMin;
+		}
+		else if(d>this.xMax){
+			d=this.xMax;
+		}
 		return this.origin.x+(d-this.xMin)*this.xratio;
 		//window.console.log("x:"+ret);
 	
 	},
 		
 	getY:function(d){
+		if(d<this.yMin){
+			d=this.yMin;
+		}
+		else if(d>this.yMax){
+			d=this.yMax;
+		}
 		return  this.origin.y-(d-this.yMin)*this.yratio;
 		//window.console.log("y:"+ret);