浏览代码

Fix bar size

tentone 4 年之前
父节点
当前提交
c5cf1355a6
共有 2 个文件被更改,包括 4 次插入6 次删除
  1. 2 3
      build/escher.js
  2. 2 3
      source/objects/chart/BarGraph.js

+ 2 - 3
build/escher.js

@@ -4636,9 +4636,8 @@
 		{
 			var y = this.box.max.y - ((this.data[i] - this.min) / gamma) * height;
 
-
-			context.moveTo(this.box.min.x + s, y);
-			context.rect(this.box.min.x + s - barHalfWidth, y, barWidth, height);
+			context.moveTo(this.box.min.x + s - barHalfWidth, y);
+			context.rect(this.box.min.x + s - barHalfWidth, y, barWidth, this.box.max.y - y);
 		}
 
 		if(this.strokeStyle !== null)

+ 2 - 3
source/objects/chart/BarGraph.js

@@ -47,9 +47,8 @@ BarGraph.prototype.draw = function(context, viewport, canvas)
 	{
 		var y = this.box.max.y - ((this.data[i] - this.min) / gamma) * height;
 
-
-		context.moveTo(this.box.min.x + s, y);
-		context.rect(this.box.min.x + s - barHalfWidth, y, barWidth, height);
+		context.moveTo(this.box.min.x + s - barHalfWidth, y);
+		context.rect(this.box.min.x + s - barHalfWidth, y, barWidth, this.box.max.y - y);
 	}
 
 	if(this.strokeStyle !== null)