Commit 24ec4231 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

правка для делений(основных и промежуточных) по оси категорий

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55546 954022d7-b5bf-4e40-9824-e11837661b57
parent dceb4be7
...@@ -7245,12 +7245,26 @@ catAxisChart.prototype = ...@@ -7245,12 +7245,26 @@ catAxisChart.prototype =
{ {
widthMinorLine = - widthMinorLine; widthMinorLine = - widthMinorLine;
widthLine = - widthLine; widthLine = - widthLine;
} };
if(!(widthLine === 0 && widthMinorLine === 0)) if(!(widthLine === 0 && widthMinorLine === 0))
{ {
//исчключение для вертикальной оси
if(this.chartProp.type == "HBar") if(this.chartProp.type == "HBar")
{ {
this._calculateVerticalTickMarks(widthLine, widthMinorLine);
}
else//для горизонтальной оси
{
this._calculateHorisontalTickMarks(widthLine, widthMinorLine);
}
}
},
_calculateVerticalTickMarks: function(widthLine, widthMinorLine)
{
var orientation = this.chartSpace && this.chartSpace.chart.plotArea.catAx ? this.chartSpace.chart.plotArea.catAx.scaling.orientation : ORIENTATION_MIN_MAX;
var yPoints = this.chartSpace.chart.plotArea.catAx.yPoints; var yPoints = this.chartSpace.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 stepY = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
...@@ -7260,15 +7274,30 @@ catAxisChart.prototype = ...@@ -7260,15 +7274,30 @@ catAxisChart.prototype =
var posY; var posY;
var posMinorY; var posMinorY;
//сдвиг, если положение оси - между делениями
var firstDiff = 0, posYtemp;
if(this.chartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN)
firstDiff = Math.abs(yPoints[1].pos - yPoints[0].pos);
if(orientation == ORIENTATION_MIN_MAX)
{
for(var i = 0; i < yPoints.length; i++) for(var i = 0; i < yPoints.length; i++)
{ {
//основные линии //основные линии
posY = yPoints[i].pos; posY = yPoints[i].pos + firstDiff / 2;
if(!this.paths.tickMarks) if(!this.paths.tickMarks)
this.paths.tickMarks = []; this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY); this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY);
if(i == yPoints.length - 1)
{
posYtemp = yPoints[i].pos - firstDiff / 2;
this.paths.tickMarks[i + 1] = this._calculateLine(posX, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp);
}
//промежуточные линии //промежуточные линии
if(widthMinorLine !== 0) if(widthMinorLine !== 0)
{ {
...@@ -7287,6 +7316,43 @@ catAxisChart.prototype = ...@@ -7287,6 +7316,43 @@ catAxisChart.prototype =
} }
else else
{ {
for(var i = yPoints.length - 1; i >= 0; i--)
{
//основные линии
posY = yPoints[i].pos + firstDiff / 2;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i + 1] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY);
if(i == 0)
{
posYtemp = yPoints[i].pos - firstDiff / 2;
this.paths.tickMarks[i] = this._calculateLine(posX, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp);
}
//промежуточные линии
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, posMinorY, posX + widthMinorLine / this.chartProp.pxToMM, posMinorY);
}
}
}
}
},
_calculateHorisontalTickMarks: function(widthLine, widthMinorLine)
{
var orientation = this.chartSpace && this.chartSpace.chart.plotArea.catAx ? this.chartSpace.chart.plotArea.catAx.scaling.orientation : ORIENTATION_MIN_MAX;
var xPoints = this.chartSpace.chart.plotArea.catAx.xPoints; var xPoints = this.chartSpace.chart.plotArea.catAx.xPoints;
var stepX = xPoints[1] ? Math.abs(xPoints[1].pos - xPoints[0].pos) : Math.abs(xPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM); var stepX = xPoints[1] ? Math.abs(xPoints[1].pos - xPoints[0].pos) : Math.abs(xPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
...@@ -7295,13 +7361,26 @@ catAxisChart.prototype = ...@@ -7295,13 +7361,26 @@ catAxisChart.prototype =
var posY = this.chartProp.nullPositionOX / this.chartProp.pxToMM; var posY = this.chartProp.nullPositionOX / this.chartProp.pxToMM;
var posX; var posX;
var posMinorX; var posMinorX;
var firstDiff = 0, posXtemp;
if(this.chartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN)
firstDiff = Math.abs(xPoints[1].pos - xPoints[0].pos);
if(orientation == ORIENTATION_MIN_MAX)
{
for(var i = 0; i < xPoints.length; i++) for(var i = 0; i < xPoints.length; i++)
{ {
posX = xPoints[i].pos; posX = xPoints[i].pos - firstDiff / 2;
if(!this.paths.tickMarks) if(!this.paths.tickMarks)
this.paths.tickMarks = []; this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX, posY + widthLine / this.chartProp.pxToMM); this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX, posY + widthLine / this.chartProp.pxToMM);
if(i == xPoints.length - 1)
{
posXtemp = xPoints[i].pos + firstDiff / 2;
this.paths.tickMarks[i + 1] = this._calculateLine(posXtemp, posY, posXtemp, posY + widthLine / this.chartProp.pxToMM);
}
//промежуточные линии //промежуточные линии
if(widthMinorLine !== 0) if(widthMinorLine !== 0)
{ {
...@@ -7318,6 +7397,36 @@ catAxisChart.prototype = ...@@ -7318,6 +7397,36 @@ catAxisChart.prototype =
} }
} }
} }
else
{
for(var i = xPoints.length - 1; i >= 0; i--)
{
posX = xPoints[i].pos - firstDiff / 2;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i + 1] = this._calculateLine(posX, posY, posX, posY + widthLine / this.chartProp.pxToMM);
if(i == 0)
{
posXtemp = xPoints[i].pos + firstDiff / 2;
this.paths.tickMarks[i] = this._calculateLine(posXtemp, posY, posXtemp, 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, posMinorX, posY + widthMinorLine / this.chartProp.pxToMM);
}
}
}
} }
}, },
...@@ -7366,7 +7475,7 @@ catAxisChart.prototype = ...@@ -7366,7 +7475,7 @@ catAxisChart.prototype =
this.cChartDrawer.drawPath(path, pen); this.cChartDrawer.drawPath(path, pen);
//промежуточные линии //промежуточные линии
if(i != this.chartProp.numvlines && this.paths.minorTickMarks) if(i != this.chartProp.numvlines && this.paths.minorTickMarks && this.paths.minorTickMarks[i])
{ {
for(var n = 0; n < this.paths.minorTickMarks[i].length ; n++) for(var n = 0; n < this.paths.minorTickMarks[i].length ; n++)
{ {
......
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