Commit dde4a291 authored by GoshaZotov's avatar GoshaZotov

change depth for area normal charts

parent 122efbe7
......@@ -81,6 +81,12 @@ function Processor3D(width, height, left, right, bottom, top, chartSpace, charts
this.angleOy = this.view3D && this.view3D.rotY ? (- this.view3D.rotY / 360) * (Math.PI * 2) : 0;
this.angleOz = this.view3D && this.view3D.rotZ ? (- this.view3D.rotZ / 360) * (Math.PI * 2) : 0;
/*if(this.view3D.rAngAx && this.view3D.rotX < 0)
{
this.angleOx = - this.angleOx;
this.angleOy = - this.angleOy;
}*/
this.orientationCatAx = null;
this.orientationValAx = null;
}
......@@ -181,16 +187,18 @@ Processor3D.prototype._recalculateScaleWithMaxWidth = function()
//TODO протестировать, и если не будет проблем, то убрать if-else
if(this.angleOy != 0)
{
if(this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX <= widthLine)
return;
//if(this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX <= widthLine)
//return;
//рассчитываем параметры диаграммы при оптимальной ширине
this.widthCanvas = optimalWidth + (this.left + this.right);
this.calaculate3DProperties(null, null, true);
optimalWidthLine = this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
var newDepth = Math.abs(this.depthPerspective * Math.sin(-this.angleOy));
optimalWidthLine = newDepth + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX;
kF = optimalWidthLine / widthLine;
this.aspectRatioX = widthLine / ((optimalWidthLine - this.depthPerspective*Math.sin(-this.angleOy))/kF);
this.aspectRatioX = widthLine / ((optimalWidthLine - newDepth) / kF);
this.scaleY = this.scaleY * kF;
this.scaleZ = this.scaleZ * kF;
......@@ -886,7 +894,7 @@ Processor3D.prototype._calculateDepth = function()
depth = depth * Math.sin(-this.angleOx);
}
return sinOx !== 0 ? depth / sinOx : depth;
return sinOx !== 0 ? Math.abs(depth / sinOx) : Math.abs(depth);
};
Processor3D.prototype._calculateDepthPerspective = function()
......@@ -960,8 +968,7 @@ Processor3D.prototype._calculateScaleFromDepth = function (/*isSkip*/)
var heightCanvas = this.heightCanvas;
var heightChart = heightCanvas - this.top - this.bottom;
this.scaleY = heightChart / (this.depthPerspective * Math.sin(this.angleOx) + heightChart);
this.scaleY = heightChart / (-this.depthPerspective * Math.sin(Math.abs(this.angleOx)) + heightChart);
//меняется ширина в зависимости от количества значений
//if(this.chartsDrawer.calcProp.subType == "standard")
//this.scaleX += parseInt((this.chartsDrawer.calcProp.seriesCount + 1) / 2) - 1;
......@@ -1026,9 +1033,9 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
var minMaxOx = this._getMinMaxOx(points, faces);
this._calculateCameraDiffX(minMaxOx);
//***Calculate cameraDiffY***
var minMaxOy = this._getMinMaxOy(points, faces);
this._calculateCameraDiffY(minMaxOy.top, minMaxOy.bottom);
//***Calculate cameraDiffY***
var minMaxOy = this._getMinMaxOy(points, faces);
this._calculateCameraDiffY(minMaxOy.top, minMaxOy.bottom);
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment