Commit 24799be2 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

http://bugzserver/show_bug.cgi?id=28019 - Bug 28019 - Интервалы между...

http://bugzserver/show_bug.cgi?id=28019 - Bug 28019 - Интервалы между делениями (Interval between marks) горизонтальной оси не работают для диаграмме

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60577 954022d7-b5bf-4e40-9824-e11837661b57
parent 32637013
...@@ -6147,68 +6147,38 @@ catAxisChart.prototype = ...@@ -6147,68 +6147,38 @@ catAxisChart.prototype =
var posX = this.chartSpace.chart.plotArea.catAx.posX ? this.chartSpace.chart.plotArea.catAx.posX : this.chartSpace.chart.plotArea.catAx.xPos; var posX = this.chartSpace.chart.plotArea.catAx.posX ? this.chartSpace.chart.plotArea.catAx.posX : this.chartSpace.chart.plotArea.catAx.xPos;
var posY; var posY, posMinorY, k;
var posMinorY;
//сдвиг, если положение оси - между делениями //сдвиг, если положение оси - между делениями
var firstDiff = 0, posYtemp; var firstDiff = 0, posYtemp;
if(this.chartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN) if(this.chartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN)
firstDiff = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.chartSpace.chart.plotArea.valAx.posY) * 2; firstDiff = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.chartSpace.chart.plotArea.valAx.posY) * 2;
var tickMarkSkip = this.chartSpace.chart.plotArea.catAx.tickMarkSkip ? this.chartSpace.chart.plotArea.catAx.tickMarkSkip : 1;
if(orientation == ORIENTATION_MIN_MAX) if(orientation !== ORIENTATION_MIN_MAX)
{
for(var i = 0; i < yPoints.length; i++)
{
//основные линии
posY = yPoints[i].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 == yPoints.length - 1)
{ {
posYtemp = yPoints[i].pos - firstDiff / 2; minorStep = - minorStep;
this.paths.tickMarks[i + 1] = this._calculateLine(posX - crossMajorStep / this.chartProp.pxToMM, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp); firstDiff = - firstDiff;
} }
for(var i = 0; i < yPoints.length; i++)
//промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 0; n < this.chartProp.numhMinorlines; n++)
{ {
posMinorY = posY - n * minorStep; k = i * tickMarkSkip;
if(k >= yPoints.length)
if(posMinorY < yPoints[yPoints.length - 1].pos || posMinorY > yPoints[0].pos)
break; 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);
}
}
}
}
else
{
for(var i = yPoints.length - 1; i >= 0; i--)
{
//основные линии //основные линии
posY = yPoints[i].pos + firstDiff / 2; posY = yPoints[k].pos + firstDiff / 2;
if(!this.paths.tickMarks) if(!this.paths.tickMarks)
this.paths.tickMarks = []; this.paths.tickMarks = [];
this.paths.tickMarks[i + 1] = this._calculateLine(posX - crossMajorStep / this.chartProp.pxToMM, posY, posX + widthLine / this.chartProp.pxToMM, posY); this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY);
if(i == 0) if(((i + 1) * tickMarkSkip) === yPoints.length)//если последняя основная линия, то рисуем её
{ {
posYtemp = yPoints[i].pos - firstDiff / 2; posYtemp = yPoints[yPoints.length - 1].pos - firstDiff / 2;
this.paths.tickMarks[i] = this._calculateLine(posX - crossMajorStep / this.chartProp.pxToMM, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp); this.paths.tickMarks[i + 1] = this._calculateLine(posX - crossMajorStep / this.chartProp.pxToMM, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp);
} }
...@@ -6217,9 +6187,9 @@ catAxisChart.prototype = ...@@ -6217,9 +6187,9 @@ catAxisChart.prototype =
{ {
for(var n = 0; n < this.chartProp.numhMinorlines; n++) for(var n = 0; n < this.chartProp.numhMinorlines; n++)
{ {
posMinorY = posY - n * minorStep; posMinorY = posY - n * minorStep * tickMarkSkip;
if(posMinorY < yPoints[0].pos || posMinorY > yPoints[yPoints.length - 1].pos) 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; break;
if(!this.paths.minorTickMarks) if(!this.paths.minorTickMarks)
...@@ -6231,7 +6201,6 @@ catAxisChart.prototype = ...@@ -6231,7 +6201,6 @@ catAxisChart.prototype =
} }
} }
} }
}
}, },
_calculateHorisontalTickMarks: function(widthLine, widthMinorLine, crossMajorStep, crossMinorStep) _calculateHorisontalTickMarks: function(widthLine, widthMinorLine, crossMajorStep, crossMinorStep)
...@@ -6243,8 +6212,7 @@ catAxisChart.prototype = ...@@ -6243,8 +6212,7 @@ catAxisChart.prototype =
var minorStep = stepX / this.chartProp.numvMinorlines; var minorStep = stepX / this.chartProp.numvMinorlines;
var posY = this.chartSpace.chart.plotArea.catAx.posY ? this.chartSpace.chart.plotArea.catAx.posY : this.chartSpace.chart.plotArea.catAx.yPos; var posY = this.chartSpace.chart.plotArea.catAx.posY ? this.chartSpace.chart.plotArea.catAx.posY : this.chartSpace.chart.plotArea.catAx.yPos;
var posX; var posX, posMinorX, k;
var posMinorX;
var firstDiff = 0, posXtemp; var firstDiff = 0, posXtemp;
if(this.chartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN && this.chartProp.type != "Scatter") if(this.chartSpace.chart.plotArea.valAx.crossBetween == CROSS_BETWEEN_BETWEEN && this.chartProp.type != "Scatter")
...@@ -6255,65 +6223,40 @@ catAxisChart.prototype = ...@@ -6255,65 +6223,40 @@ catAxisChart.prototype =
firstDiff = Math.abs(this.chartSpace.chart.plotArea.valAx.posX - xPoints[0].pos) * 2; firstDiff = Math.abs(this.chartSpace.chart.plotArea.valAx.posX - xPoints[0].pos) * 2;
} }
var tickMarkSkip = this.chartSpace.chart.plotArea.catAx.tickMarkSkip ? this.chartSpace.chart.plotArea.catAx.tickMarkSkip : 1;
if(orientation == ORIENTATION_MIN_MAX) if(orientation !== ORIENTATION_MIN_MAX)
{
for(var i = 0; i < xPoints.length; i++)
{
posX = xPoints[i].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 == xPoints.length - 1)
{ {
posXtemp = xPoints[i].pos + firstDiff / 2; minorStep = - minorStep;
this.paths.tickMarks[i + 1] = this._calculateLine(posXtemp, posY - crossMajorStep / this.chartProp.pxToMM, posXtemp, posY + widthLine / this.chartProp.pxToMM); firstDiff = - firstDiff;
} }
//промежуточные линии //сам рассчёт основных и промежуточных линий
if(widthMinorLine !== 0) for(var i = 0; i < xPoints.length; i++)
{
for(var n = 0; n < this.chartProp.numvMinorlines; n++)
{ {
posMinorX = posX + n * minorStep; k = i * tickMarkSkip;
if(k >= xPoints.length)
if(posMinorX > xPoints[xPoints.length - 1].pos)
break; break;
if(!this.paths.minorTickMarks) posX = xPoints[k].pos - firstDiff / 2;
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
{
for(var i = xPoints.length - 1; i >= 0; i--)
{
posX = xPoints[i].pos - firstDiff / 2;
if(!this.paths.tickMarks) if(!this.paths.tickMarks)
this.paths.tickMarks = []; this.paths.tickMarks = [];
this.paths.tickMarks[i + 1] = this._calculateLine(posX, posY - crossMajorStep / this.chartProp.pxToMM, posX, posY + widthLine / this.chartProp.pxToMM); this.paths.tickMarks[i] = this._calculateLine(posX, posY - crossMajorStep / this.chartProp.pxToMM, posX, posY + widthLine / this.chartProp.pxToMM);
if(i == 0) if(((i + 1) * tickMarkSkip) === xPoints.length)//если последняя основная линия, то рисуем её
{ {
posXtemp = xPoints[i].pos + firstDiff / 2; posXtemp = xPoints[xPoints.length - 1].pos + firstDiff / 2;
this.paths.tickMarks[i] = this._calculateLine(posXtemp, posY - crossMajorStep / this.chartProp.pxToMM, posXtemp, posY + widthLine / this.chartProp.pxToMM);; this.paths.tickMarks[i + 1] = this._calculateLine(posXtemp, posY - crossMajorStep / this.chartProp.pxToMM, posXtemp, posY + widthLine / this.chartProp.pxToMM);
} }
//промежуточные линии //промежуточные линии
if(widthMinorLine !== 0) if(widthMinorLine !== 0)
{ {
for(var n = 0; n < this.chartProp.numvMinorlines; n++) for(var n = 1; n < this.chartProp.numvMinorlines; n++)
{ {
posMinorX = posX + n * minorStep; posMinorX = posX + n * minorStep * tickMarkSkip;
if(posMinorX < xPoints[xPoints.length - 1].pos || posMinorX > xPoints[0].pos) 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; break;
if(!this.paths.minorTickMarks) if(!this.paths.minorTickMarks)
...@@ -6325,7 +6268,6 @@ catAxisChart.prototype = ...@@ -6325,7 +6268,6 @@ catAxisChart.prototype =
} }
} }
} }
}
}, },
_calculateLine: function(x, y, x1, y1) _calculateLine: function(x, y, x1, y1)
......
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