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 ...@@ -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.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; 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.orientationCatAx = null;
this.orientationValAx = null; this.orientationValAx = null;
} }
...@@ -181,16 +187,18 @@ Processor3D.prototype._recalculateScaleWithMaxWidth = function() ...@@ -181,16 +187,18 @@ Processor3D.prototype._recalculateScaleWithMaxWidth = function()
//TODO протестировать, и если не будет проблем, то убрать if-else //TODO протестировать, и если не будет проблем, то убрать if-else
if(this.angleOy != 0) if(this.angleOy != 0)
{ {
if(this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX <= widthLine) //if(this.depthPerspective * Math.sin(-this.angleOy) + ((this.widthCanvas - (this.left + this.right)) / this.aspectRatioX) / this.scaleX <= widthLine)
return; //return;
//рассчитываем параметры диаграммы при оптимальной ширине //рассчитываем параметры диаграммы при оптимальной ширине
this.widthCanvas = optimalWidth + (this.left + this.right); this.widthCanvas = optimalWidth + (this.left + this.right);
this.calaculate3DProperties(null, null, true); 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; 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.scaleY = this.scaleY * kF;
this.scaleZ = this.scaleZ * kF; this.scaleZ = this.scaleZ * kF;
...@@ -886,7 +894,7 @@ Processor3D.prototype._calculateDepth = function() ...@@ -886,7 +894,7 @@ Processor3D.prototype._calculateDepth = function()
depth = depth * Math.sin(-this.angleOx); 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() Processor3D.prototype._calculateDepthPerspective = function()
...@@ -960,8 +968,7 @@ Processor3D.prototype._calculateScaleFromDepth = function (/*isSkip*/) ...@@ -960,8 +968,7 @@ Processor3D.prototype._calculateScaleFromDepth = function (/*isSkip*/)
var heightCanvas = this.heightCanvas; var heightCanvas = this.heightCanvas;
var heightChart = heightCanvas - this.top - this.bottom; 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") //if(this.chartsDrawer.calcProp.subType == "standard")
//this.scaleX += parseInt((this.chartsDrawer.calcProp.seriesCount + 1) / 2) - 1; //this.scaleX += parseInt((this.chartsDrawer.calcProp.seriesCount + 1) / 2) - 1;
...@@ -1026,9 +1033,9 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/) ...@@ -1026,9 +1033,9 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
var minMaxOx = this._getMinMaxOx(points, faces); var minMaxOx = this._getMinMaxOx(points, faces);
this._calculateCameraDiffX(minMaxOx); this._calculateCameraDiffX(minMaxOx);
//***Calculate cameraDiffY*** //***Calculate cameraDiffY***
var minMaxOy = this._getMinMaxOy(points, faces); var minMaxOy = this._getMinMaxOy(points, faces);
this._calculateCameraDiffY(minMaxOy.top, minMaxOy.bottom); 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