Commit 18b1c274 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@54088 954022d7-b5bf-4e40-9824-e11837661b57
parent 1986e5d8
......@@ -144,7 +144,7 @@ CChartsDrawer.prototype =
};
var grouping = chartProp.chart.plotArea.chart.grouping;
if(this.calcProp.type == "Line")
if(this.calcProp.type == "Line" || this.calcProp.type == "Area")
this.calcProp.subType = (grouping === GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === GROUPING_STACKED) ? "stacked" : "normal"
else
this.calcProp.subType = (grouping === BAR_GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === BAR_GROUPING_STACKED) ? "stacked" : "normal"
......@@ -2629,18 +2629,18 @@ drawAreaChart.prototype =
seria = this.chartProp.series[i];
var dataSeries = seria.val.numRef.numCache.pts;
var y, y1, x, x1, val, prevVal, tempVal;
for(var n = 1; n < dataSeries.length; n++)
var y, y1, x, x1, val, nextVal, tempVal;
for(var n = 0; n < dataSeries.length - 1; n++)
{
//рассчитываем значения
prevVal = this._getYVal(n - 1, i) - min;
val = this._getYVal(n, i) - min;
nextVal = this._getYVal(n, i) - min;
val = this._getYVal(n + 1, i) - min;
y = trueHeight - (prevVal)*koffY + this.chartProp.chartGutter._top;
y = trueHeight - (nextVal)*koffY + this.chartProp.chartGutter._top;
y1 = trueHeight - (val)*koffY + this.chartProp.chartGutter._top;
x = this.chartProp.chartGutter._left + (n - 1)*koffX;
x1 = this.chartProp.chartGutter._left + n*koffX;
x = this.chartProp.chartGutter._left + n*koffX;
x1 = this.chartProp.chartGutter._left + (n + 1)*koffX;
if(!this.paths.series)
this.paths.series = [];
......@@ -2652,6 +2652,82 @@ drawAreaChart.prototype =
}
},
_calculateDLbl: function(chartSpace, ser, val)
{
var point = this.chartProp.series[ser].val.numRef.numCache.pts[val];
var path;
if(val == this.chartProp.series[ser].val.numRef.numCache.pts.length - 1)
path = this.paths.series[ser][val - 1].ArrPathCommand[1];
else
path = this.paths.series[ser][val].ArrPathCommand[0];
var x = path.X;
var y = path.Y;
var pxToMm = this.chartProp.pxToMM;
var constMargin = 5 / pxToMm;
var width = point.compiledDlb.extX;
var height = point.compiledDlb.extY;
var centerX = x - width/2;
var centerY = y - height/2;
//TODO высчитать позиции, как в екселе + ограничения
switch ( point.compiledDlb.dLblPos )
{
case DLBL_POS_B:
{
centerY = centerY + height/2 + constMargin;
break;
}
case DLBL_POS_BEST_FIT:
{
//centerY = centerY + 27 / pxToMm;
break;
}
case DLBL_POS_CTR:
{
break;
}
case DLBL_POS_IN_BASE:
{
//centerY = centerY + 27 / pxToMm;
break;
}
case DLBL_POS_IN_END:
{
//centerY = centerY + 27 / pxToMm;
break;
}
case DLBL_POS_L:
{
centerX = centerX - width/2 - constMargin;
break;
}
case DLBL_POS_OUT_END:
{
//centerY = centerY + 27 / pxToMm;
break;
}
case DLBL_POS_R:
{
centerX = centerX + width/2 + constMargin;
break;
}
case DLBL_POS_T:
{
centerY = centerY - height/2 - constMargin;
break;
}
}
if(centerX < 0)
centerX = 0;
return {x: centerX, y: centerY};
},
_drawLines: function (/*isSkip*/)
{
//для цветов серий
......@@ -2674,7 +2750,7 @@ drawAreaChart.prototype =
pen = seria.pen;
dataSeries = seria.val.numRef.numCache.pts;
for(var n = 1; n < dataSeries.length; n++)
for(var n = 0; n < dataSeries.length - 1; n++)
{
if(seria.val.numRef.numCache.pts[n].pen)
pen = seria.val.numRef.numCache.pts[n].pen;
......
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