Commit 7c8340d9 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

различные правки для диаграмм(bar chart)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61001 954022d7-b5bf-4e40-9824-e11837661b57
parent b06b7208
......@@ -7047,8 +7047,6 @@ drawBar3DChart.prototype =
var brush, pen, seria;
for (var i = 0; i < this.chartProp.ptCount; i++) {
for (var j = 0; j < this.paths.series.length; ++j) {
seria = this.chartProp.series[j];
brush = seria.brush;
......@@ -7064,20 +7062,17 @@ drawBar3DChart.prototype =
for(var k = 0; k < this.paths.series[j][i].length; k++)
{
if(this.paths.series[j][i][k].ArrPathCommand && this.paths.series[j][i][k].ArrPathCommand[0] && this.paths.series[j][i][k].ArrPathCommand[0].X > pointChangeDirection)
break;
if(this.paths.series[j][i][k].ArrPathCommand && this.paths.series[j][i][k].ArrPathCommand[0] && parseInt(this.paths.series[j][i][k].ArrPathCommand[0].X) >= parseInt(pointChangeDirection))
continue;
this._drawBar(this.paths.series[j][i][k], pen, brush, k);
}
}
}
//вторую половину с конца рисуем
var brush, pen, seria;
for (var i = this.chartProp.ptCount - 1; i >= 0; i--) {
for (var j = this.paths.series.length - 1; j >= 0; j--) {
seria = this.chartProp.series[j];
brush = seria.brush;
......@@ -7093,69 +7088,13 @@ drawBar3DChart.prototype =
for(var k = 0; k < this.paths.series[j][i].length; k++)
{
if(this.paths.series[j][i][k].ArrPathCommand && this.paths.series[j][i][k].ArrPathCommand[0] && this.paths.series[j][i][k].ArrPathCommand[0].X <= pointChangeDirection)
if(this.paths.series[j][i][k].ArrPathCommand && this.paths.series[j][i][k].ArrPathCommand[0] && parseInt(this.paths.series[j][i][k].ArrPathCommand[0].X) < parseInt(pointChangeDirection))
break;
this._drawBar(this.paths.series[j][i][k], pen, brush, k);
}
}
}
return;
//рисуем половину от нуля
var brush, pen, seria;
for (var i = 0; i < this.paths.series.length; i++) {
seria = this.chartProp.series[i];
brush = seria.brush;
pen = seria.pen;
if(!this.paths.series[j][i] || !seria.val.numRef.numCache.pts[i])
continue;
for (var j = 0; j < this.paths.series[i].length; ++j) {
if(seria.val.numRef.numCache.pts[j].pen)
pen = seria.val.numRef.numCache.pts[j].pen;
if(seria.val.numRef.numCache.pts[j].brush)
brush = seria.val.numRef.numCache.pts[j].brush;
if(!this.paths.series[i][j])
continue;
for(var k = 0; k < this.paths.series[i][j].length; k++)
{
if(this.paths.series[i][j][k].ArrPathCommand && this.paths.series[i][j][k].ArrPathCommand[0] && this.paths.series[i][j][k].ArrPathCommand[0].X > pointChangeDirection)
break;
this._drawBar(this.paths.series[i][j][k], pen, brush, k);
}
}
}
//вторую половину с конца рисуем
var brush, pen, seria;
for (var i = this.paths.series.length - 1; i >= 0; i--) {
seria = this.chartProp.series[i];
brush = seria.brush;
pen = seria.pen;
for (var j = this.paths.series[i].length - 1; j >= 0; j--) {
if(seria.val.numRef.numCache.pts[j].pen)
pen = seria.val.numRef.numCache.pts[j].pen;
if(seria.val.numRef.numCache.pts[j].brush)
brush = seria.val.numRef.numCache.pts[j].brush;
if(!this.paths.series[i][j])
continue;
for(var k = 0; k < this.paths.series[i][j].length; k++)
{
if(this.paths.series[i][j][k].ArrPathCommand && this.paths.series[i][j][k].ArrPathCommand[0] && this.paths.series[i][j][k].ArrPathCommand[0].X <= pointChangeDirection)
break;
this._drawBar(this.paths.series[i][j][k], pen, brush, k);
}
}
}
},
_drawBar: function(path, pen, brush, k)
......@@ -7723,7 +7662,7 @@ grid3DChart.prototype =
y1 = turnResult.y;
z1 = turnResult.z;
var convertObj = this.cChartDrawer._convert3DTo2D(x1, y1, z1, p, q , r);
var convertObj = this.cChartDrawer._convert3DTo2D(x1, y1, z1, p, q, r);
x1 = convertObj.x + widthLine;
y1 = convertObj.y + heightLine;
return {x: x1, y: y1}
......@@ -7731,6 +7670,670 @@ grid3DChart.prototype =
};
//*****value axis*****
function valAxis3DChart()
{
this.chartProp = null;
this.cChartSpace = null;
this.cChartDrawer = null;
this.paths = {};
}
valAxis3DChart.prototype =
{
draw : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartSpace = chartsDrawer.cChartSpace;
this.cChartDrawer = chartsDrawer;
this._drawAxis();
this._drawTickMark();
},
reCalculate : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartSpace = chartsDrawer.cChartSpace;
this.cChartDrawer = chartsDrawer;
this.paths = {};
if(this.cChartSpace.chart.plotArea.valAx.bDelete != true)
{
this._calculateAxis();
this._calculateTickMark();
}
},
_calculateAxis : function()
{
var nullPoisition = this.cChartSpace.chart.plotArea.valAx.posX != undefined ? this.cChartSpace.chart.plotArea.valAx.posX : this.cChartSpace.chart.plotArea.valAx.xPos;
if(this.chartProp.type == "HBar")
{
nullPoisition = this.cChartSpace.chart.plotArea.valAx.posY;
this.paths.axisLine = this._calculateLine( this.chartProp.chartGutter._left / this.chartProp.pxToMM, nullPoisition, (this.chartProp.widthCanvas - this.chartProp.chartGutter._right) / this.chartProp.pxToMM, nullPoisition );
}
else
{
this.paths.axisLine = this._calculateLine( nullPoisition, this.chartProp.chartGutter._top / this.chartProp.pxToMM, nullPoisition, (this.chartProp.heightCanvas - this.chartProp.chartGutter._bottom) / this.chartProp.pxToMM );
}
},
_calculateTickMark : function()
{
var widthLine = 0, widthMinorLine = 0;
var crossMajorStep = 0;
var crossMinorStep = 0;
switch ( this.cChartSpace.chart.plotArea.valAx.majorTickMark )
{
case TICK_MARK_CROSS:
{
widthLine = 5;
crossMajorStep = 5;
break;
}
case TICK_MARK_IN:
{
widthLine = 5;
break;
}
case TICK_MARK_NONE:
{
widthLine = 0;
break;
}
case TICK_MARK_OUT:
{
widthLine = -5;
break;
}
}
switch ( this.cChartSpace.chart.plotArea.valAx.minorTickMark )
{
case TICK_MARK_CROSS:
{
widthMinorLine = 3;
crossMinorStep = 3;
break;
}
case TICK_MARK_IN:
{
widthMinorLine = 3;
break;
}
case TICK_MARK_NONE:
{
widthMinorLine = 0;
break;
}
case TICK_MARK_OUT:
{
widthMinorLine = -3;
break;
}
}
if(this.chartProp.type == "HBar")
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
crossMajorStep = - crossMajorStep;
crossMinorStep = - crossMinorStep;
}
var orientation = this.cChartSpace && this.cChartSpace.chart.plotArea.catAx ? this.cChartSpace.chart.plotArea.catAx.scaling.orientation : ORIENTATION_MIN_MAX;
if(orientation !== ORIENTATION_MIN_MAX)
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
crossMajorStep = - crossMajorStep;
crossMinorStep = - crossMinorStep;
}
if(!(widthLine === 0 && widthMinorLine === 0))
{
if(this.chartProp.type == "HBar")
{
var yPoints = this.cChartSpace.chart.plotArea.valAx.xPoints;
var stepX = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[1].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
var minorStep = stepX / this.chartProp.numvMinorlines;
var posY = this.cChartSpace.chart.plotArea.valAx.posY;
var posX;
var posMinorX;
for(var i = 0; i < yPoints.length; i++)
{
posX = yPoints[i].pos;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX, posY - crossMajorStep / this.chartProp.pxToMM, posX, posY + widthLine / this.chartProp.pxToMM);
//промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 0; n < this.chartProp.numvMinorlines; n++)
{
posMinorX = posX + n * minorStep;
if(!this.paths.minorTickMarks)
this.paths.minorTickMarks = [];
if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks[i] = [];
this.paths.minorTickMarks[i][n] = this._calculateLine(posMinorX, posY - crossMinorStep / this.chartProp.pxToMM, posMinorX, posY + widthMinorLine / this.chartProp.pxToMM);
}
}
}
}
else
{
var yPoints = this.cChartSpace.chart.plotArea.valAx.yPoints;
var stepY = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
var minorStep = stepY / this.chartProp.numhMinorlines;
var posX = this.cChartSpace.chart.plotArea.valAx.posX ? this.cChartSpace.chart.plotArea.valAx.posX : this.cChartSpace.chart.plotArea.valAx.xPos;
var posY;
var posMinorY;
for(var i = 0; i < yPoints.length; i++)
{
//основные линии
posY = yPoints[i].pos;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX - crossMajorStep / this.chartProp.pxToMM, posY, posX + widthLine / this.chartProp.pxToMM, posY);
//промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 0; n < this.chartProp.numhMinorlines; n++)
{
posMinorY = posY - n * minorStep;
if(!this.paths.minorTickMarks)
this.paths.minorTickMarks = [];
if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks[i] = [];
this.paths.minorTickMarks[i][n] = this._calculateLine(posX - crossMinorStep / this.chartProp.pxToMM, posMinorY, posX + widthMinorLine / this.chartProp.pxToMM, posMinorY);
}
}
}
}
}
},
_calculateLine: function(x, y, x1, y1)
{
var path = new Path();
var pathH = this.chartProp.pathH;
var pathW = this.chartProp.pathW;
var gdLst = [];
var convertResult, x1n, y1n, x2n, y2n;
var rPerspective = this.chartProp.rPerspective;
var view3DProp = this.cChartSpace.chart.view3D;
var angleOx = view3DProp && view3DProp.rotX ? (- view3DProp.rotX / 360) * (Math.PI * 2) : 0;
var angleOy = view3DProp && view3DProp.rotY ? (- view3DProp.rotY / 360) * (Math.PI * 2) : 0;
var angleOz = 0;
var p = 0;
var q = 0;
var r = rPerspective;
path.pathH = pathH;
path.pathW = pathW;
gdLst["w"] = 1;
gdLst["h"] = 1;
convertResult = this._convertAndTurnPoint(x * this.chartProp.pxToMM, y * this.chartProp.pxToMM, 0, angleOx, angleOy, angleOz, p, q, r);
x = convertResult.x / this.chartProp.pxToMM;
y = convertResult.y / this.chartProp.pxToMM;
convertResult = this._convertAndTurnPoint(x1 * this.chartProp.pxToMM, y1 * this.chartProp.pxToMM, 0, angleOx, angleOy, angleOz, p, q, r);
x1 = convertResult.x / this.chartProp.pxToMM;
y1 = convertResult.y / this.chartProp.pxToMM;
path.moveTo(x * pathW, y * pathH);
path.lnTo(x1 * pathW, y1 * pathH);
path.recalculate(gdLst);
return path;
},
_drawAxis: function()
{
var pen;
var path;
pen = this.cChartSpace.chart.plotArea.catAx.compiledLn;
path = this.paths.axisLine;
this.cChartDrawer.drawPath(path, pen);
},
_drawTickMark: function()
{
var pen, path;
if(!this.paths.tickMarks)
return;
for(var i = 0; i < this.paths.tickMarks.length; i++)
{
pen = this.cChartSpace.chart.plotArea.valAx.compiledTickMarkLn;
path = this.paths.tickMarks[i];
this.cChartDrawer.drawPath(path, pen);
//промежуточные линии
if(i != (this.paths.tickMarks.length - 1) && this.paths.minorTickMarks)
{
for(var n = 0; n < this.paths.minorTickMarks[i].length ; n++)
{
path = this.paths.minorTickMarks[i][n];
this.cChartDrawer.drawPath(path, pen);
}
}
}
},
_convertAndTurnPoint: function(x1, y1, z1, angleOx, angleOy, angleOz, p, q, r)
{
//координаты центра проектирования
var widthLine = (this.chartProp.widthCanvas - (this.chartProp.chartGutter._left + this.chartProp.chartGutter._right)) / 2 + this.chartProp.chartGutter._left;
var heightLine = (this.chartProp.heightCanvas - (this.chartProp.chartGutter._top + this.chartProp.chartGutter._bottom)) / 2 + this.chartProp.chartGutter._top;
x1 = x1 - widthLine;
y1 = y1 - heightLine;
var turnResult = this.cChartDrawer._turnCoords(x1, y1, z1, angleOx, angleOy, angleOz);
x1 = turnResult.x;
y1 = turnResult.y;
z1 = turnResult.z;
var convertObj = this.cChartDrawer._convert3DTo2D(x1, y1, z1, p, q, r);
x1 = convertObj.x + widthLine;
y1 = convertObj.y + heightLine;
return {x: x1, y: y1}
}
};
//*****Category axis*****
function catAxis3DChart()
{
this.chartProp = null;
this.cChartSpace = null;
this.cChartDrawer = null;
this.paths = {};
}
catAxis3DChart.prototype =
{
draw : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartSpace = chartsDrawer.cChartSpace;
this.cChartDrawer = chartsDrawer;
this._drawAxis();
this._drawTickMark();
},
reCalculate : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartSpace = chartsDrawer.cChartSpace;
this.cChartDrawer = chartsDrawer;
this.paths = {};
if(this.cChartSpace.chart.plotArea.catAx.bDelete != true)
{
this._calculateAxis();
this._calculateTickMark();
}
},
_calculateAxis : function()
{
var nullPoisition = this.chartProp.nullPositionOX;
var axisPos;
if(this.chartProp.type == "HBar")
{
axisPos = this.cChartSpace.chart.plotArea.catAx.posX;
this.paths.axisLine = this._calculateLine( axisPos, this.chartProp.chartGutter._top / this.chartProp.pxToMM, axisPos, (this.chartProp.heightCanvas - this.chartProp.chartGutter._bottom) / this.chartProp.pxToMM);
}
else
{
//TODO сделать по аналогии с HBAR
axisPos = this.cChartSpace.chart.plotArea.catAx.posY ? this.cChartSpace.chart.plotArea.catAx.posY : this.cChartSpace.chart.plotArea.catAx.yPos;
this.paths.axisLine = this._calculateLine( this.chartProp.chartGutter._left / this.chartProp.pxToMM, axisPos, (this.chartProp.widthCanvas - this.chartProp.chartGutter._right) / this.chartProp.pxToMM, axisPos);
}
},
_calculateTickMark : function()
{
var widthLine = 0, widthMinorLine = 0;
var crossMajorStep = 0, crossMinorStep = 0;
switch ( this.cChartSpace.chart.plotArea.catAx.majorTickMark )
{
case TICK_MARK_CROSS:
{
widthLine = 5;
crossMajorStep = 5;
break;
}
case TICK_MARK_IN:
{
widthLine = -5;
break;
}
case TICK_MARK_NONE:
{
widthLine = 0;
break;
}
case TICK_MARK_OUT:
{
widthLine = 5;
break;
}
}
switch ( this.cChartSpace.chart.plotArea.catAx.minorTickMark )
{
case TICK_MARK_CROSS:
{
widthMinorLine = 3;
crossMinorStep = 3;
break;
}
case TICK_MARK_IN:
{
widthMinorLine = -3;
break;
}
case TICK_MARK_NONE:
{
widthMinorLine = 0;
break;
}
case TICK_MARK_OUT:
{
widthMinorLine = 3;
break;
}
}
if(this.chartProp.type == "HBar")
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
crossMajorStep = - crossMajorStep;
crossMinorStep = - crossMinorStep;
}
var orientation = this.cChartSpace && this.cChartSpace.chart.plotArea.valAx ? this.cChartSpace.chart.plotArea.valAx.scaling.orientation : ORIENTATION_MIN_MAX;
if(orientation !== ORIENTATION_MIN_MAX)
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
crossMajorStep = - crossMajorStep;
crossMinorStep = - crossMinorStep;
}
if(!(widthLine === 0 && widthMinorLine === 0))
{
//исчключение для вертикальной оси
if(this.chartProp.type == "HBar")
{
this._calculateVerticalTickMarks(widthLine, widthMinorLine, crossMajorStep, crossMinorStep);
}
else//для горизонтальной оси
{
this._calculateHorisontalTickMarks(widthLine, widthMinorLine, crossMajorStep, crossMinorStep);
}
}
},
_calculateVerticalTickMarks: function(widthLine, widthMinorLine, crossMajorStep, crossMinorStep)
{
var orientation = this.cChartSpace && this.cChartSpace.chart.plotArea.catAx ? this.cChartSpace.chart.plotArea.catAx.scaling.orientation : ORIENTATION_MIN_MAX;
var yPoints = this.cChartSpace.chart.plotArea.catAx.yPoints;
var stepY = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
var minorStep = stepY / this.chartProp.numhMinorlines;
var posX = this.cChartSpace.chart.plotArea.catAx.posX ? this.cChartSpace.chart.plotArea.catAx.posX : this.cChartSpace.chart.plotArea.catAx.xPos;
var posY, posMinorY, k;
//сдвиг, если положение оси - между делениями
var firstDiff = 0, posYtemp;
if(this.cChartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN)
firstDiff = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posY) * 2;
var tickMarkSkip = this.cChartSpace.chart.plotArea.catAx.tickMarkSkip ? this.cChartSpace.chart.plotArea.catAx.tickMarkSkip : 1;
if(orientation !== ORIENTATION_MIN_MAX)
{
minorStep = - minorStep;
firstDiff = - firstDiff;
}
for(var i = 0; i < yPoints.length; i++)
{
k = i * tickMarkSkip;
if(k >= yPoints.length)
break;
//основные линии
posY = yPoints[k].pos + firstDiff / 2;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY);
if(((i + 1) * tickMarkSkip) === yPoints.length)//если последняя основная линия, то рисуем её
{
posYtemp = yPoints[yPoints.length - 1].pos - firstDiff / 2;
this.paths.tickMarks[i + 1] = this._calculateLine(posX - crossMajorStep / this.chartProp.pxToMM, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp);
}
//промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 1; n < this.chartProp.numhMinorlines; n++)
{
posMinorY = posY - n * minorStep * tickMarkSkip;
if(((posMinorY < yPoints[yPoints.length - 1].pos - firstDiff / 2) && orientation == ORIENTATION_MIN_MAX) || ((posMinorY > yPoints[yPoints.length - 1].pos - firstDiff / 2) && orientation !== ORIENTATION_MIN_MAX))
break;
if(!this.paths.minorTickMarks)
this.paths.minorTickMarks = [];
if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks[i] = [];
this.paths.minorTickMarks[i][n] = this._calculateLine(posX - crossMinorStep / this.chartProp.pxToMM, posMinorY, posX + widthMinorLine / this.chartProp.pxToMM, posMinorY);
}
}
}
},
_calculateHorisontalTickMarks: function(widthLine, widthMinorLine, crossMajorStep, crossMinorStep)
{
var orientation = this.cChartSpace && this.cChartSpace.chart.plotArea.catAx ? this.cChartSpace.chart.plotArea.catAx.scaling.orientation : ORIENTATION_MIN_MAX;
var xPoints = this.cChartSpace.chart.plotArea.catAx.xPoints;
var stepX = xPoints[1] ? Math.abs(xPoints[1].pos - xPoints[0].pos) : Math.abs(xPoints[0].pos - this.cChartSpace.chart.plotArea.catAx.posX) * 2;
var minorStep = stepX / this.chartProp.numvMinorlines;
var posY = this.cChartSpace.chart.plotArea.catAx.posY ? this.cChartSpace.chart.plotArea.catAx.posY : this.cChartSpace.chart.plotArea.catAx.yPos;
var posX, posMinorX, k;
var firstDiff = 0, posXtemp;
if(this.cChartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN && this.chartProp.type != "Scatter")
{
if(xPoints[1])
firstDiff = Math.abs(xPoints[1].pos - xPoints[0].pos);
else if(this.cChartSpace.chart.plotArea.valAx.posX)
firstDiff = Math.abs(this.cChartSpace.chart.plotArea.valAx.posX - xPoints[0].pos) * 2;
}
var tickMarkSkip = this.cChartSpace.chart.plotArea.catAx.tickMarkSkip ? this.cChartSpace.chart.plotArea.catAx.tickMarkSkip : 1;
if(orientation !== ORIENTATION_MIN_MAX)
{
minorStep = - minorStep;
firstDiff = - firstDiff;
}
//сам рассчёт основных и промежуточных линий
for(var i = 0; i < xPoints.length; i++)
{
k = i * tickMarkSkip;
if(k >= xPoints.length)
break;
posX = xPoints[k].pos - firstDiff / 2;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX, posY - crossMajorStep / this.chartProp.pxToMM, posX, posY + widthLine / this.chartProp.pxToMM);
if(((i + 1) * tickMarkSkip) === xPoints.length)//если последняя основная линия, то рисуем её
{
posXtemp = xPoints[xPoints.length - 1].pos + firstDiff / 2;
this.paths.tickMarks[i + 1] = this._calculateLine(posXtemp, posY - crossMajorStep / this.chartProp.pxToMM, posXtemp, posY + widthLine / this.chartProp.pxToMM);
}
//промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 1; n < this.chartProp.numvMinorlines; n++)
{
posMinorX = posX + n * minorStep * tickMarkSkip;
if(((posMinorX > xPoints[xPoints.length - 1].pos + firstDiff / 2) && orientation == ORIENTATION_MIN_MAX) || ((posMinorX < xPoints[xPoints.length - 1].pos + firstDiff / 2) && orientation !== ORIENTATION_MIN_MAX))
break;
if(!this.paths.minorTickMarks)
this.paths.minorTickMarks = [];
if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks[i] = [];
this.paths.minorTickMarks[i][n] = this._calculateLine(posMinorX, posY - crossMinorStep / this.chartProp.pxToMM, posMinorX, posY + widthMinorLine / this.chartProp.pxToMM);
}
}
}
},
_calculateLine: function(x, y, x1, y1)
{
var path = new Path();
var pathH = this.chartProp.pathH;
var pathW = this.chartProp.pathW;
var gdLst = [];
var convertResult, x1n, y1n, x2n, y2n;
var rPerspective = this.chartProp.rPerspective;
var view3DProp = this.cChartSpace.chart.view3D;
var angleOx = view3DProp && view3DProp.rotX ? (- view3DProp.rotX / 360) * (Math.PI * 2) : 0;
var angleOy = view3DProp && view3DProp.rotY ? (- view3DProp.rotY / 360) * (Math.PI * 2) : 0;
var angleOz = 0;
var p = 0;
var q = 0;
var r = rPerspective;
path.pathH = pathH;
path.pathW = pathW;
gdLst["w"] = 1;
gdLst["h"] = 1;
convertResult = this._convertAndTurnPoint(x * this.chartProp.pxToMM, y * this.chartProp.pxToMM, 0, angleOx, angleOy, angleOz, p, q, r);
x = convertResult.x / this.chartProp.pxToMM;
y = convertResult.y / this.chartProp.pxToMM;
convertResult = this._convertAndTurnPoint(x1 * this.chartProp.pxToMM, y1 * this.chartProp.pxToMM, 0, angleOx, angleOy, angleOz, p, q, r);
x1 = convertResult.x / this.chartProp.pxToMM;
y1 = convertResult.y / this.chartProp.pxToMM;
path.moveTo(x * pathW, y * pathH);
path.lnTo(x1 * pathW, y1 * pathH);
path.recalculate(gdLst);
return path;
},
_drawAxis: function()
{
var pen;
var path;
pen = this.cChartSpace.chart.plotArea.catAx.compiledLn;
path = this.paths.axisLine;
this.cChartDrawer.drawPath(path, pen);
},
_drawTickMark: function()
{
var pen, path;
if(this.paths.tickMarks)
{
for(var i = 0; i < this.paths.tickMarks.length; i++)
{
pen = this.cChartSpace.chart.plotArea.catAx.compiledTickMarkLn;
path = this.paths.tickMarks[i];
this.cChartDrawer.drawPath(path, pen);
//промежуточные линии
if(this.paths.minorTickMarks && this.paths.minorTickMarks[i])
{
for(var n = 0; n < this.paths.minorTickMarks[i].length ; n++)
{
path = this.paths.minorTickMarks[i][n];
this.cChartDrawer.drawPath(path, pen);
}
}
}
}
},
_convertAndTurnPoint: function(x1, y1, z1, angleOx, angleOy, angleOz, p, q, r)
{
//координаты центра проектирования
var widthLine = (this.chartProp.widthCanvas - (this.chartProp.chartGutter._left + this.chartProp.chartGutter._right)) / 2 + this.chartProp.chartGutter._left;
var heightLine = (this.chartProp.heightCanvas - (this.chartProp.chartGutter._top + this.chartProp.chartGutter._bottom)) / 2 + this.chartProp.chartGutter._top;
x1 = x1 - widthLine;
y1 = y1 - heightLine;
var turnResult = this.cChartDrawer._turnCoords(x1, y1, z1, angleOx, angleOy, angleOz);
x1 = turnResult.x;
y1 = turnResult.y;
z1 = turnResult.z;
var convertObj = this.cChartDrawer._convert3DTo2D(x1, y1, z1, p, q, r);
x1 = convertObj.x + widthLine;
y1 = convertObj.y + heightLine;
return {x: x1, y: y1}
}
};
//****another functions and classes***
function CGeometry2()
......
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