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,76 +7245,185 @@ catAxisChart.prototype = ...@@ -7245,76 +7245,185 @@ 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")
{ {
var yPoints = this.chartSpace.chart.plotArea.catAx.yPoints; this._calculateVerticalTickMarks(widthLine, widthMinorLine);
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.chartSpace.chart.plotArea.catAx.posX; }
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 posY; 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 posMinorY; var minorStep = stepY / this.chartProp.numhMinorlines;
for(var i = 0; i < yPoints.length; i++)
var posX = this.chartSpace.chart.plotArea.catAx.posX;
var posY;
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++)
{
//основные линии
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;
posY = yPoints[i].pos; this.paths.tickMarks[i + 1] = this._calculateLine(posX, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp);
}
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY);
//промежуточные линии
if(widthMinorLine !== 0) //промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 0; n < this.chartProp.numhMinorlines; n++)
{ {
for(var n = 0; n < this.chartProp.numhMinorlines; n++) posMinorY = posY + n * minorStep;
{ if(!this.paths.minorTickMarks)
posMinorY = posY + n * minorStep; this.paths.minorTickMarks = [];
if(!this.paths.minorTickMarks) if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks = []; this.paths.minorTickMarks[i] = [];
if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks[i] = []; this.paths.minorTickMarks[i][n] = this._calculateLine(posX, posMinorY, posX + widthMinorLine / this.chartProp.pxToMM, posMinorY);
this.paths.minorTickMarks[i][n] = this._calculateLine(posX, posMinorY, posX + widthMinorLine / this.chartProp.pxToMM, posMinorY);
}
} }
} }
} }
else }
else
{
for(var i = yPoints.length - 1; i >= 0; i--)
{ {
var xPoints = this.chartSpace.chart.plotArea.catAx.xPoints; //основные линии
posY = yPoints[i].pos + firstDiff / 2;
var stepX = xPoints[1] ? Math.abs(xPoints[1].pos - xPoints[0].pos) : Math.abs(xPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM); if(!this.paths.tickMarks)
var minorStep = stepX / this.chartProp.numvMinorlines; this.paths.tickMarks = [];
this.paths.tickMarks[i + 1] = this._calculateLine(posX, posY, posX + widthLine / this.chartProp.pxToMM, posY);
var posY = this.chartProp.nullPositionOX / this.chartProp.pxToMM; if(i == 0)
var posX;
var posMinorX;
for(var i = 0; i < xPoints.length; i++)
{ {
posX = xPoints[i].pos; posYtemp = yPoints[i].pos - firstDiff / 2;
if(!this.paths.tickMarks) this.paths.tickMarks[i] = this._calculateLine(posX, posYtemp, posX + widthLine / this.chartProp.pxToMM, posYtemp);
this.paths.tickMarks = []; }
this.paths.tickMarks[i] = this._calculateLine(posX, posY, posX, posY + widthLine / this.chartProp.pxToMM);
//промежуточные линии
if(widthMinorLine !== 0) //промежуточные линии
if(widthMinorLine !== 0)
{
for(var n = 0; n < this.chartProp.numhMinorlines; n++)
{ {
for(var n = 0; n < this.chartProp.numvMinorlines; n++) posMinorY = posY + n * minorStep;
{ if(!this.paths.minorTickMarks)
posMinorX = posX + n * minorStep; this.paths.minorTickMarks = [];
if(!this.paths.minorTickMarks) if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks = []; this.paths.minorTickMarks[i] = [];
if(!this.paths.minorTickMarks[i])
this.paths.minorTickMarks[i] = []; this.paths.minorTickMarks[i][n] = this._calculateLine(posX, posMinorY, posX + widthMinorLine / this.chartProp.pxToMM, posMinorY);
}
this.paths.minorTickMarks[i][n] = this._calculateLine(posMinorX, posY, posMinorX, posY + widthMinorLine / this.chartProp.pxToMM); }
} }
}
},
_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 stepX = xPoints[1] ? Math.abs(xPoints[1].pos - xPoints[0].pos) : Math.abs(xPoints[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
var minorStep = stepX / this.chartProp.numvMinorlines;
var posY = this.chartProp.nullPositionOX / this.chartProp.pxToMM;
var posX;
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++)
{
posX = xPoints[i].pos - firstDiff / 2;
if(!this.paths.tickMarks)
this.paths.tickMarks = [];
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)
{
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);
}
}
}
}
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