Commit faaecdf7 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

delete chartStyleManager

delete c_oAscLegendMarkerType
delete OutlineColor
delete _generateColors, _generateColor, _generateColorPart
delete getLegendInfo, generateUniColors, getReverseSeries
delete _round_val, _array_exp, _array_reverse

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57074 954022d7-b5bf-4e40-9824-e11837661b57
parent 0a643cf2
......@@ -192,10 +192,8 @@ CChartsDrawer.prototype =
_calculatePositionTitle: function(chartSpace)
{
var widthGraph = chartSpace.extX;
var heightGraph = chartSpace.extY;
var widthTitle = chartSpace.chart.title.extX;
var heightTitle = chartSpace.chart.title.extY;
var standartMargin = 7;
var y = standartMargin / this.calcProp.pxToMM;
......@@ -205,8 +203,7 @@ CChartsDrawer.prototype =
},
_calculatePositionValAx: function(chartSpace)
{
var widthTitle = chartSpace.chart.plotArea.valAx.title.extX;
{
var heightTitle = chartSpace.chart.plotArea.valAx.title.extY;
var standartMargin = 13;
......@@ -308,7 +305,6 @@ CChartsDrawer.prototype =
this.calcProp.pxToMM = 1 / chartSpace.convertPixToMM(1);
var pxToMM = this.calcProp.pxToMM;
var standartMargin = 13 / pxToMM;
var isHBar = (chartSpace.chart.plotArea.chart.getObjectType() == historyitem_type_BarChart && chartSpace.chart.plotArea.chart.barDir === BAR_DIR_BAR) ? true : false;
......@@ -456,8 +452,8 @@ CChartsDrawer.prototype =
calculateTop = valAx.yPoints[0].pos;
calculateBottom = this.calcProp.heightCanvas / pxToMM - valAx.yPoints[valAx.yPoints.length - 1].pos;
}
};
};
}
}
//catAx
......@@ -477,7 +473,7 @@ CChartsDrawer.prototype =
{
calculateLeft = catAx.xPoints[catAx.xPoints.length - 1].pos;
calculateRight = this.calcProp.widthCanvas / pxToMM - catAx.xPoints[0].pos;
};
}
}
else if(isHBar && valAx && !isNaN(valAx.posY) && this.calcProp.heightCanvas != undefined)
{
......@@ -498,7 +494,7 @@ CChartsDrawer.prototype =
calculateTop = catAx.yPoints[0].pos - curBetween;
calculateBottom = this.calcProp.heightCanvas / pxToMM - (catAx.yPoints[catAx.yPoints.length - 1].pos + curBetween);
};
}
}
else if(valAx && !isNaN(valAx.posX) && this.calcProp.widthCanvas != undefined)
{
......@@ -519,9 +515,9 @@ CChartsDrawer.prototype =
calculateLeft = catAx.xPoints[catAx.xPoints.length - 1].pos - curBetween;
calculateRight = this.calcProp.widthCanvas / pxToMM - (catAx.xPoints[0].pos + curBetween);
};
};
};
}
}
}
return {calculateLeft: calculateLeft, calculateRight : calculateRight, calculateTop: calculateTop, calculateBottom: calculateBottom};
},
......@@ -587,7 +583,7 @@ CChartsDrawer.prototype =
leftDownPointY = catAx.yPoints[catAx.yPoints.length - 1].pos + Math.abs((catAx.interval) / 2);
else
leftDownPointY = catAx.yPoints[catAx.yPoints.length - 1].pos;
};
}
if(valAx.scaling.orientation == ORIENTATION_MIN_MAX)
......@@ -616,7 +612,7 @@ CChartsDrawer.prototype =
if(valAx.scaling.orientation == ORIENTATION_MIN_MAX)
rightUpPointX = valAx.xPoints[valAx.xPoints.length - 1].pos;
else
rightUpPointX = valAx.xPoints[0].pos
rightUpPointX = valAx.xPoints[0].pos;
if(catAx.labels && !catAx.bDelete)
......@@ -830,7 +826,6 @@ CChartsDrawer.prototype =
this.calcProp.min = this.calcProp.scale[0];
}
},
//****new calculate data****
_calculateStackedData2: function()
......@@ -867,7 +862,7 @@ CChartsDrawer.prototype =
this.calcProp.max = maxMinObj.max;
this.calcProp.min = maxMinObj.min;
}
};
}
if(this.calcProp.type == "Line" || this.calcProp.type == "Area")
......@@ -918,7 +913,7 @@ CChartsDrawer.prototype =
this.calcProp.min = maxMinObj.min;
this.calcProp.data = tempData;
}
};
}
},
_calculateData2: function(chart) {
......@@ -979,7 +974,7 @@ CChartsDrawer.prototype =
if('' != orValue)
isSkip[numSeries] = false;
var value = parseFloat(orValue)
var value = parseFloat(orValue);
if(!isEn && !isNaN(value))
{
min = value;
......@@ -987,9 +982,9 @@ CChartsDrawer.prototype =
isEn = true;
}
if(!isNaN(value) && value > max)
max = value
max = value;
if(!isNaN(value) && value < min)
min = value
min = value;
if(isNaN(value) && orValue == '' && (((this.calcProp.type == 'Line' ) && this.calcProp.type == 'normal')))
{
value = '';
......@@ -1045,7 +1040,7 @@ CChartsDrawer.prototype =
max = xVal;
minY = yVal;
maxY = yVal;
};
}
if(xVal < min)
min = xVal;
......@@ -1125,7 +1120,7 @@ CChartsDrawer.prototype =
{
manualMax = 2 * axisMin;
axisMax = manualMax;
};
}
//приводим к первому порядку
......@@ -1230,7 +1225,7 @@ CChartsDrawer.prototype =
{
pow --;
tempPow = tempPow * 10;
};
}
}
else
temp = Math.pow(logBase, 0);
......@@ -1251,7 +1246,7 @@ CChartsDrawer.prototype =
result[step] = temp;
pow++;
step++;
};
}
}
else
{
......@@ -1261,7 +1256,7 @@ CChartsDrawer.prototype =
result[step] = temp;
pow++;
step++;
};
}
}
return result;
......@@ -1353,7 +1348,7 @@ CChartsDrawer.prototype =
axisMax = 0;
else
axisMin = 0;
};
}
return {min: axisMin, max: axisMax};
},
......@@ -1554,13 +1549,13 @@ CChartsDrawer.prototype =
this.calcProp.type = "Scatter";
break;
}
};
}
var grouping = chartProp.chart.plotArea.chart.grouping;
if(this.calcProp.type == "Line" || this.calcProp.type == "Area")
this.calcProp.subType = (grouping === GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === GROUPING_STACKED) ? "stacked" : "normal"
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"
this.calcProp.subType = (grouping === BAR_GROUPING_PERCENT_STACKED) ? "stackedPer" : (grouping === BAR_GROUPING_STACKED) ? "stacked" : "normal";
this.calcProp.xaxispos = null;
......@@ -1579,12 +1574,6 @@ CChartsDrawer.prototype =
//отсеиваем пустые серии
this.calcProp.seriesCount = this._calculateCountSeries(chartProp);
//находим значния для осей
/*this.calcProp.scale = this._getAxisData(false, this.calcProp, this.calcProp.min, this.calcProp.max, this.calcProp.ymin, this.calcProp.ymax, chartProp);
if(this.calcProp.type == "Scatter")
this.calcProp.xScale = this._getAxisData(true, this.calcProp, this.calcProp.min, this.calcProp.max, this.calcProp.ymin, this.calcProp.ymax, chartProp);*/
if(this.calcProp.type == "Scatter")
{
this.calcProp.scale = this._getAxisData2(false, this.calcProp.ymin, this.calcProp.ymax, chartProp);
......@@ -1708,7 +1697,7 @@ CChartsDrawer.prototype =
{
path.moveTo((x - size/Math.sqrt(3)) * pathW, (y + size/3) * pathW);
path.lnTo(x * pathW, (y - (2/3)*size) * pathW);
path.lnTo((x + size/Math.sqrt(3)) * pathW, (y + size/3) * pathW)
path.lnTo((x + size/Math.sqrt(3)) * pathW, (y + size/3) * pathW);
path.lnTo((x - size/Math.sqrt(3)) * pathW, (y + size/3) * pathW);
break;
}
......@@ -1720,6 +1709,7 @@ CChartsDrawer.prototype =
path.lnTo((x + halfSize) * pathW, (y - halfSize) * pathW);
path.lnTo((x + halfSize) * pathW, (y + halfSize) * pathW);
path.lnTo((x - halfSize) * pathW, (y + halfSize) * pathW);
break;
}
case SYMBOL_DIAMOND:
......@@ -1756,7 +1746,7 @@ CChartsDrawer.prototype =
if(logBase)
{
return this._getYPositionLogBase(val, yPoints, isOx, logBase);
};
}
//позиция в заисимости от положения точек на оси OY
var result;
......@@ -1860,7 +1850,7 @@ CChartsDrawer.prototype =
if(yPoints[i].val < maxVal && yPoints[i].val > minVal)
{
startPos = yPoints[i + 1].pos;
diffPos = yPoints[i].pos - yPoints[i + 1].pos
diffPos = yPoints[i].pos - yPoints[i + 1].pos;
break;
}
}
......@@ -1878,12 +1868,12 @@ CChartsDrawer.prototype =
if(yPoints[i].val < maxVal && yPoints[i].val >= minVal)
{
startPos = yPoints[i].pos;
diffPos = yPoints[i].pos - yPoints[i + 1].pos
diffPos = yPoints[i].pos - yPoints[i + 1].pos;
break;
}
}
result = startPos - parseFloat("0." + parseVal[1]) * diffPos;
};
}
return result;
},
......@@ -2018,78 +2008,6 @@ CChartsDrawer.prototype =
return summ;
},
_round_val: function (num)
{
if(num.toString() && num.toString().indexOf('e+') == -1 && isNaN(parseFloat(num)))
return num;
var floatKoff = 100000000000;
if(num.toString() && num.toString().indexOf('e+') > -1)
{
var parseVal = num.toString().split("e+");
var roundVal = Math.round(parseFloat(parseVal[0])*floatKoff)/floatKoff;
var changeSymbol = roundVal.toString() + "e+" + parseVal[1];
num = parseFloat(changeSymbol);
}
num = Math.round(num*floatKoff)/floatKoff ;
return num;
},
_array_exp: function (arr)
{
var maxDig = 1000000000;
var minDig = 0.000000001;
var floatKoff = 100000000000;
if(typeof(arr) == 'number')
{
if(arr < 0)
maxDig = 100000000;
if(Math.abs(arr) > maxDig)
{
var tmp = Math.abs(arr);
var exp = 0;
while (tmp > 9) {
exp += 1;
tmp /= 10;
}
if(arr < 0)
tmp *= -1;
arr = tmp + "E+" + exp;
}
}
else
{
for (var i=0; i<arr.length; ++i) {
maxDig = 1000000000
if(arr[i] < 0)
maxDig = 100000000;
if(Math.abs(arr[i]) > maxDig)
{
var tmp = Math.abs(arr[i]);
var exp = 0;
while (tmp > 9) {
exp += 1;
tmp /= 10;
}
tmp = Math.round(tmp*floatKoff)/floatKoff
if(arr[i] < 0)
tmp *= -1;
arr[i] = tmp + "E+" + exp;
}
}
}
return arr;
},
_array_reverse: function (arr)
{
var newarr = [];
for (var i = arr.length - 1; i >= 0; i--) {
newarr.push(arr[i]);
}
return newarr;
},
_getFirstDegree: function(val)
{
var secPart = val.toString().split('.');
......@@ -2118,7 +2036,7 @@ CChartsDrawer.prototype =
}
numPow = Math.pow(10, num);
val = tempMax;
};
}
if(tempMax == undefined)
val = val / numPow;
......@@ -2187,18 +2105,18 @@ CChartsDrawer.prototype =
}
else if ((d02 / 6 >= d12 / 2) && (d13 / 6 >= d12 / 2))
{
bz[1] = this.XYZAdd(pts[1], this.XYZMult(this.XYZSub(pts[2], pts[0]), d12 / 2 / d02))
bz[2] = this.XYZAdd(pts[2], this.XYZMult(this.XYZSub(pts[1], pts[3]), d12 / 2 / d13))
bz[1] = this.XYZAdd(pts[1], this.XYZMult(this.XYZSub(pts[2], pts[0]), d12 / 2 / d02));
bz[2] = this.XYZAdd(pts[2], this.XYZMult(this.XYZSub(pts[1], pts[3]), d12 / 2 / d13));
}
else if((d02 / 6 >= d12 / 2))
{
bz[1] = this.XYZAdd(pts[1], this.XYZMult(this.XYZSub(pts[2], pts[0]), d12 / 2 / d02))
bz[2] = this.XYZAdd(pts[2], this.XYZMult(this.XYZSub(pts[1], pts[3]), d12 / 2 / d13 * (d13 / d02)))
bz[1] = this.XYZAdd(pts[1], this.XYZMult(this.XYZSub(pts[2], pts[0]), d12 / 2 / d02));
bz[2] = this.XYZAdd(pts[2], this.XYZMult(this.XYZSub(pts[1], pts[3]), d12 / 2 / d13 * (d13 / d02)));
}
else
{
bz[1] = this.XYZAdd(pts[1], this.XYZMult(this.XYZSub(pts[2], pts[0]), d12 / 2 / d02 * (d02 / d13)))
bz[2] = this.XYZAdd(pts[2], this.XYZMult(this.XYZSub(pts[1], pts[3]), d12 / 2 / d13))
bz[1] = this.XYZAdd(pts[1], this.XYZMult(this.XYZSub(pts[2], pts[0]), d12 / 2 / d02 * (d02 / d13)));
bz[2] = this.XYZAdd(pts[2], this.XYZMult(this.XYZSub(pts[1], pts[3]), d12 / 2 / d13));
}
//end point
......@@ -2241,12 +2159,12 @@ CChartsDrawer.prototype =
this.calcProp.ptCount = numCache.ptCount;
counter++;
};
};
}
}
return counter;
}
}
};
......@@ -2358,7 +2276,7 @@ drawBarChart.prototype =
if(tempValues[k][idx] && tempValues[k][idx] > 0)
prevVal += tempValues[k][idx];
}
};
}
tempValues[i][idx] = val;
......@@ -2421,10 +2339,10 @@ drawBarChart.prototype =
this.paths.series[i] = [];
this.paths.series[i][idx] = paths;
//}
};
}
seriesCounter++;
};
}
},
_getStartYColumnPosition: function (seriesHeight, i, j, val, yPoints, prevVal)
......@@ -2493,7 +2411,7 @@ drawBarChart.prototype =
if(curVal)
temp += Math.abs(curVal);
};
}
this.summBarVal[j] = temp;
}
......@@ -2511,7 +2429,7 @@ drawBarChart.prototype =
result += parseFloat(curVal);
else if(idxPoint && val < 0 && curVal < 0)
result += parseFloat(curVal);
};
}
return result;
},
......@@ -2724,7 +2642,7 @@ drawLineChart.prototype =
if(!points[i])
points[i] = [];
idxPoint = this.cChartDrawer.getIdxPoint(seria, n)
idxPoint = this.cChartDrawer.getIdxPoint(seria, n);
compiledMarkerSize = idxPoint && idxPoint.compiledMarker && idxPoint.compiledMarker.size ? idxPoint.compiledMarker.size : null;
compiledMarkerSymbol = idxPoint && idxPoint.compiledMarker && idxPoint.compiledMarker.symbol ? idxPoint.compiledMarker.symbol : null;
......@@ -2739,7 +2657,7 @@ drawLineChart.prototype =
points[i][n] = null;
}
}
};
}
this._calculateAllLines(points);
},
......@@ -2790,7 +2708,7 @@ drawLineChart.prototype =
this.paths.series[i][n] = this._calculateLine(points[i][n].x, points[i][n].y, points[i][n + 1].x, points[i][n + 1].y);
}
}
};
}
},
_getYPosition: function(val, yPoints)
......@@ -2933,7 +2851,7 @@ drawLineChart.prototype =
{
markerBrush = numCache.pts[k].compiledMarker ? numCache.pts[k].compiledMarker.brush : null;
markerPen = numCache.pts[k].compiledMarker ? numCache.pts[k].compiledMarker.pen : null;
};
}
//frame of point
if(this.paths.points[i][0] && this.paths.points[i][0].framePaths)
......@@ -3045,7 +2963,7 @@ drawLineChart.prototype =
return path;
}
}
};
......@@ -3124,7 +3042,7 @@ drawAreaChart.prototype =
this.points[i][n] = {x: x, y: nullPositionOX};
}
}
};
}
this._calculateAllLines();
},
......@@ -3151,7 +3069,7 @@ drawAreaChart.prototype =
if(points[i])
this.paths.series[i] = this._calculateLine(points[i], prevPoints);
};
}
},
_getPrevSeriesPoints: function(points, i)
......@@ -3165,7 +3083,7 @@ drawAreaChart.prototype =
prevPoints = points[p];
break;
}
};
}
return prevPoints;
},
......@@ -3196,7 +3114,7 @@ drawAreaChart.prototype =
{
path.lnTo(point.x * pathW, point.y * pathH);
}
};
}
//точки предыдущей серии
var nullPositionOX = this.chartProp.nullPositionOX;
......@@ -3358,7 +3276,7 @@ drawAreaChart.prototype =
brush = dataSeries[0].brush;
this.cChartDrawer.drawPath(this.paths.series[i], pen, brush);
};
}
this.cShapeDrawer.Graphics.RestoreGrState();
},
......@@ -3406,7 +3324,7 @@ drawAreaChart.prototype =
}
return val;
}
}
};
......@@ -3466,7 +3384,7 @@ drawHBarChart.prototype =
var width, startX, startY, diffYVal, val, paths, seriesHeight = [], seria, startXColumnPosition, startYPosition, newStartX, newStartY, idx, seriesCounter = 0;
for (var i = 0; i < this.chartProp.series.length; i++) {
numCache = this.chartProp.series[i].val.numRef ? this.chartProp.series[i].val.numRef.numCache : his.chartProp.series[i].val.numLit;
numCache = this.chartProp.series[i].val.numRef ? this.chartProp.series[i].val.numRef.numCache : this.chartProp.series[i].val.numLit;
if(!numCache)
continue;
......@@ -3545,11 +3463,11 @@ drawHBarChart.prototype =
this.paths.series[i] = [];
this.paths.series[i][idx] = paths;
}
};
}
seriesCounter++;
};
}
},
_getStartYColumnPosition: function (seriesHeight, j, i, val, xPoints, summBarVal)
......@@ -3608,9 +3526,9 @@ drawHBarChart.prototype =
if(curVal)
temp += Math.abs(curVal);
};
}
this.summBarVal[j] = temp;
};
}
},
_getStackedValue: function(series, i, j, val)
......@@ -3625,7 +3543,7 @@ drawHBarChart.prototype =
result += parseFloat(curVal);
else if(idxPoint && val < 0 && curVal < 0)
result += parseFloat(curVal);
};
}
return result;
},
......@@ -3796,7 +3714,7 @@ drawHBarChart.prototype =
return path;
}
}
};
......@@ -4117,11 +4035,11 @@ drawDoughnutChart.prototype =
this.paths.series[n][k] = this._calculateSegment(angle, radius, xCenter, yCenter, radius + step * (seriesCounter + 1), radius + step * seriesCounter, firstSliceAng);
else
this.paths.series[n][k] = null;
};
}
seriesCounter++;
};
}
},
_calculateSegment: function (angle, radius, xCenter, yCenter, radius1, radius2, firstSliceAng)
......@@ -4334,7 +4252,7 @@ drawRadarChart.prototype =
if(!this.paths.series)
this.paths.series = [];
if(!this.paths.series[i])
this.paths.series[i] = []
this.paths.series[i] = [];
this.paths.series[i][n] = this._calculateLine(x, y, x1, y1);
......@@ -4583,7 +4501,7 @@ drawRadarChart.prototype =
return path;
}
}
};
......@@ -4671,7 +4589,7 @@ drawScatterChart.prototype =
points[i][n] = null;
}
}
};
}
this._calculateAllLines(points);
},
......@@ -4750,7 +4668,7 @@ drawScatterChart.prototype =
points[i][n] = null;
}
}
};
}
this._calculateAllLines(points);
},
......@@ -4797,7 +4715,7 @@ drawScatterChart.prototype =
}
}
}
};
}
},
_getYVal: function(n, i)
......@@ -4847,7 +4765,7 @@ drawScatterChart.prototype =
{
markerBrush = numCache.pts[k].compiledMarker ? numCache.pts[k].compiledMarker.brush : null;
markerPen = numCache.pts[k].compiledMarker ? numCache.pts[k].compiledMarker.pen : null;
};
}
//frame of point
if(this.paths.points[i][0] && this.paths.points[i][0].framePaths)
......@@ -5596,8 +5514,8 @@ drawBubbleChart.prototype =
{
maxArea = 1 / 4 * (Math.PI * (maxDiamBubble * maxDiamBubble));
defaultSize = Math.sqrt((maxArea / diffSize) / Math.PI);
};
};
}
}
var path = new Path();
......@@ -5772,7 +5690,7 @@ gridChart.prototype =
this.paths.horisontalMinorLines[i] = [];
this.paths.horisontalMinorLines[i][n] = this._calculateLine(posX, posMinorY, posX + widthLine, posMinorY);
};
}
if(crossDiff && i == yPoints.length - 1)
......@@ -5838,7 +5756,7 @@ gridChart.prototype =
this.paths.verticalMinorLines[i] = [];
this.paths.verticalMinorLines[i][n] = this._calculateLine(posMinorX, posY, posMinorX, posY + heightLine);
};
}
if(crossDiff && i == xPoints.length - 1)
{
......@@ -5937,7 +5855,7 @@ gridChart.prototype =
}
}
}
}
};
//*****Category axis*****
......@@ -6018,7 +5936,7 @@ catAxisChart.prototype =
widthLine = 5;
break;
}
};
}
switch ( this.chartSpace.chart.plotArea.catAx.minorTickMark )
{
......@@ -6042,13 +5960,13 @@ catAxisChart.prototype =
widthMinorLine = 3;
break;
}
};
}
if(this.chartProp.type == "HBar")
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
};
}
var orientation = this.chartSpace && this.chartSpace.chart.plotArea.valAx ? this.chartSpace.chart.plotArea.valAx.scaling.orientation : ORIENTATION_MIN_MAX;
if(orientation !== ORIENTATION_MIN_MAX)
......@@ -6188,7 +6106,7 @@ catAxisChart.prototype =
firstDiff = Math.abs(xPoints[1].pos - xPoints[0].pos);
else if(this.chartSpace.chart.plotArea.valAx.posX)
firstDiff = Math.abs(this.chartSpace.chart.plotArea.valAx.posX - xPoints[0].pos) * 2;
};
}
if(orientation == ORIENTATION_MIN_MAX)
......@@ -6319,7 +6237,7 @@ catAxisChart.prototype =
}
}
}
}
};
//*****value axis*****
......@@ -6398,7 +6316,7 @@ valAxisChart.prototype =
widthLine = -5;
break;
}
};
}
switch ( this.chartSpace.chart.plotArea.valAx.minorTickMark )
{
......@@ -6422,20 +6340,20 @@ valAxisChart.prototype =
widthMinorLine = -3;
break;
}
};
}
if(this.chartProp.type == "HBar")
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
};
}
var orientation = this.chartSpace && this.chartSpace.chart.plotArea.catAx ? this.chartSpace.chart.plotArea.catAx.scaling.orientation : ORIENTATION_MIN_MAX;
if(orientation !== ORIENTATION_MIN_MAX)
{
widthMinorLine = - widthMinorLine;
widthLine = - widthLine;
};
}
if(!(widthLine === 0 && widthMinorLine === 0))
{
......@@ -6565,7 +6483,7 @@ valAxisChart.prototype =
}
}
}
}
};
//*****all area of chart*****
......@@ -6632,7 +6550,7 @@ allAreaChart.prototype =
var brush = this.chartSpace.brush;
this.cChartDrawer.drawPath(this.paths, pen, brush);
}
}
};
//*****Area of chart*****
function areaChart()
......@@ -6706,14 +6624,14 @@ areaChart.prototype =
var brush = this.chartSpace.chart.plotArea.brush;
this.cChartDrawer.drawPath(this.paths, pen, brush);
}
}
};
//********************************3D******************************************
var angleOx = 0//- Math.PI/6;
var angleOy = 0//- Math.PI/6;
var angleOz = 0//- Math.PI/6;
var angleOx = 0;//- Math.PI/6;
var angleOy = 0;//- Math.PI/6;
var angleOz = 0;//- Math.PI/6;
//*****3d LINE CHART*****
function drawLine3DChart()
......@@ -6763,7 +6681,7 @@ drawLine3DChart.prototype =
var cX1, cY1, cZ1, cX2, cY2, cZ2, cX3, cY3, cZ3, cX4, cY4, cZ4, convertObj, z, turnResult;
for (i = 0; i < this.chartProp.series.length; i++) {
for (var i = 0; i < this.chartProp.series.length; i++) {
var seria = this.chartProp.series[i];
......@@ -6787,7 +6705,7 @@ drawLine3DChart.prototype =
if(!this.paths.series)
this.paths.series = [];
if(!this.paths.series[i])
this.paths.series[i] = []
this.paths.series[i] = [];
z = 50;
......@@ -6846,7 +6764,7 @@ drawLine3DChart.prototype =
var pen;
var dataSeries;
var seria;
for (i = 0; i < this.chartProp.series.length; i++) {
for (var i = 0; i < this.chartProp.series.length; i++) {
seria = this.chartProp.series[i];
brush = seria.brush;
pen = seria.pen;
......@@ -6931,7 +6849,7 @@ drawLine3DChart.prototype =
{
return {x: 0, y: 0};
}
}
};
......@@ -6991,7 +6909,7 @@ drawBar3DChart.prototype =
//затемнение боковых сторон
if(k != 5)
{
var props = this.chartSpace.getParentObjects()
var props = this.chartSpace.getParentObjects();
var duplicateBrush = brush.createDuplicate();
var cColorMod = new CColorMod;
cColorMod.val = 80000;
......@@ -7025,7 +6943,7 @@ drawBar3DChart.prototype =
//затемнение боковых сторон
if(k != 5)
{
var props = this.chartSpace.getParentObjects()
var props = this.chartSpace.getParentObjects();
var duplicateBrush = brush.createDuplicate();
var cColorMod = new CColorMod;
cColorMod.val = 80000;
......@@ -7376,7 +7294,7 @@ drawBar3DChart.prototype =
{
return {x: 0, y: 0};
}
}
};
//*****3D GRID*****
......@@ -7457,19 +7375,19 @@ grid3DChart.prototype =
q = 0;
r = global3DPersperctive ? global3DPersperctive / 10000 : 0.002;
convertResult = this.cShapeDrawer._convert3DTo2D(x1, y1, z1, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x1, y1, z1, p, q, r);
x1n = convertResult.x + diff;
y1n = convertResult.y + heightLine/2;
convertResult = this.cShapeDrawer._convert3DTo2D(x2, y2, z2, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x2, y2, z2, p, q, r);
x2n = convertResult.x + diff;
y2n = convertResult.y + heightLine/2;
convertResult = this.cShapeDrawer._convert3DTo2D(x3, y3, z3, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x3, y3, z3, p, q, r);
x3n = convertResult.x + diff;
y3n = convertResult.y + heightLine/2;
convertResult = this.cShapeDrawer._convert3DTo2D(x4, y4, z4, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x4, y4, z4, p, q, r);
x4n = convertResult.x + diff;
y4n = convertResult.y + heightLine/2;
......@@ -7477,9 +7395,9 @@ grid3DChart.prototype =
if(!this.paths.horisontalLines)
this.paths.horisontalLines = [];
if(i == 0)
this.paths.horisontalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n, x4n, y4n)
this.paths.horisontalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n, x4n, y4n);
else
this.paths.horisontalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n)
this.paths.horisontalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n);
}
......@@ -7541,19 +7459,19 @@ grid3DChart.prototype =
q = 0;
r = global3DPersperctive ? global3DPersperctive / 10000 : 0.002;
convertResult = this.cShapeDrawer._convert3DTo2D(x1, y1, z1, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x1, y1, z1, p, q, r);
x1n = convertResult.x + diff;
y1n = convertResult.y + heightLine/2;
convertResult = this.cShapeDrawer._convert3DTo2D(x2, y2, z2, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x2, y2, z2, p, q, r);
x2n = convertResult.x + diff;
y2n = convertResult.y + heightLine/2;
convertResult = this.cShapeDrawer._convert3DTo2D(x3, y3, z3, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x3, y3, z3, p, q, r);
x3n = convertResult.x + diff;
y3n = convertResult.y + heightLine/2;
convertResult = this.cShapeDrawer._convert3DTo2D(x4, y4, z4, p, q, r)
convertResult = this.cShapeDrawer._convert3DTo2D(x4, y4, z4, p, q, r);
x4n = convertResult.x + diff;
y4n = convertResult.y + heightLine/2;
......@@ -7561,9 +7479,9 @@ grid3DChart.prototype =
if(!this.paths.verticalLines)
this.paths.verticalLines = [];
if(i == 0)
this.paths.verticalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n, x4n, y4n)
this.paths.verticalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n, x4n, y4n);
else
this.paths.verticalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n)
this.paths.verticalLines[i] = this._calculateLine(x1n, y1n, x2n, y2n, x3n, y3n);
}
},
......@@ -7633,7 +7551,7 @@ grid3DChart.prototype =
this.cChartDrawer.drawPath(path, pen);
}
}
}
};
......
......@@ -255,7 +255,6 @@ asc_CChart.prototype = {
ser.asc_setMarkerSize(object.series[i].Marker.Size);
ser.asc_setMarkerSymbol(object.series[i].Marker.Symbol);
}
ser.asc_setOutlineColor(object.series[i].OutlineColor);
ser.asc_setFormatCode(object.series[i].FormatCode);
this.series.push(ser);
......@@ -320,39 +319,7 @@ asc_CChart.prototype = {
asc_setSeria: function(seriaObj) { if (seriaObj) this.series.push(seriaObj); },
asc_removeSeries: function() { this.series = []; },
_generateColorPart: function (val, percent) {
// Negative outputs are shades, and positive outputs are tints.
if ( percent >= 0 )
return Math.min( 255, ((255 - val) * percent + val) >> 0 );
else
return Math.max( 0, (val * (1 + percent)) >> 0 );
},
_generateColor: function (oColor, percent) {
return new CColor(this._generateColorPart(oColor.r, percent),
this._generateColorPart(oColor.g, percent), this._generateColorPart(oColor.b, percent));
},
_generateColors: function (countColors, arrayBaseColors) {
var arrayColors = [];
var countBase = arrayBaseColors.length;
var needCreate = parseInt(countColors / countBase) + 1;
for (var i = 0; i < needCreate; i++) {
for (var j = 0; j < countBase; j++) {
// Для равномерного затухания: percent = i / needCreate
var percent = (-70 + 140 * ( (i + 1) / (needCreate + 1) )) / 100.0; // ECMA-376 Part 1
var color = this._generateColor(arrayBaseColors[j], percent);
arrayColors.push( color );
}
}
arrayColors.splice(countColors, arrayColors.length - countColors);
return arrayColors;
},
initDefault: function() {
// Обновлены тестовые данные для новой диаграммы
function createItem(value) {
return { numFormatStr: "General", isDateTimeFormat: false, val: value, isHidden: false };
......@@ -367,12 +334,10 @@ asc_CChart.prototype = {
this.yAxis.title = "Medals";
this.series = [];
var uniColors = this.generateUniColors(3);
var seria = new asc_CChartSeria();
seria.Val.Formula = "Sheet1!B2:B7";
seria.Val.NumCache = [ createItem(46), createItem(38), createItem(24), createItem(29), createItem(11), createItem(7) ];
seria.OutlineColor = uniColors[0];
seria.TxCache.Formula = "Sheet1!B1";
seria.TxCache.Tx = "Gold";
if ( this.type != c_oAscChartType.scatter )
......@@ -384,7 +349,6 @@ asc_CChart.prototype = {
seria = new asc_CChartSeria();
seria.Val.Formula = "Sheet1!C2:C7";
seria.Val.NumCache = [ createItem(29), createItem(27), createItem(26), createItem(17), createItem(19), createItem(14) ];
seria.OutlineColor = uniColors[1];
seria.TxCache.Formula = "Sheet1!C1";
seria.TxCache.Tx = "Silver";
if ( this.type != c_oAscChartType.scatter )
......@@ -396,7 +360,6 @@ asc_CChart.prototype = {
seria = new asc_CChartSeria();
seria.Val.Formula = "Sheet1!D2:D7";
seria.Val.NumCache = [ createItem(29), createItem(23), createItem(32), createItem(19), createItem(14), createItem(17) ];
seria.OutlineColor = uniColors[2];
seria.TxCache.Formula = "Sheet1!D1";
seria.TxCache.Tx = "Bronze";
if ( this.type != c_oAscChartType.scatter )
......@@ -452,11 +415,7 @@ asc_CChart.prototype = {
var ws = _t.range.intervalObject.worksheet;
// Save old series colors
var i, oldSeriaData = [];
for (i = 0; !isIgnoreColors && (i < _t.series.length); ++i) {
if ( _t.series[i].OutlineColor && !_t.series[i].OutlineColor.isCustom )
oldSeriaData[i] = _t.series[i].OutlineColor;
}
var i;
_t.series = [];
function getNumCache(c1, c2, r1, r2) {
......@@ -639,114 +598,6 @@ asc_CChart.prototype = {
nameIndex++;
}
}
// Colors
var seriaUniColors = _t.generateUniColors(_t.series.length);
if ( _t.type == c_oAscChartType.hbar )
seriaUniColors = OfficeExcel.array_reverse(seriaUniColors);
// Restore old series colors
for (i = 0; i < _t.series.length; ++i) {
if ( oldSeriaData[i] )
_t.series[i].OutlineColor = oldSeriaData[i];
else
_t.series[i].OutlineColor = seriaUniColors[i];
}
},
getReverseSeries: function() {
var revSeries = [];
var serLen = this.series.length;
var i, j, aData = [];
for (j = 0; j < this.series.length; j++) {
aData.push(this.series[j].Val.NumCache.length);
aData.push(this.series[j].xVal.NumCache.length);
aData.push(this.series[j].Cat.NumCache.length);
}
var maxDataLen = Math.max.apply(Math, aData);
var emptyItem = { numFormatStr: "General", isDateTimeFormat: false, val: "", isHidden: false };
for (j = 0; j < this.series.length; j++) {
if ( this.series[j].Val.NumCache.length ) {
while ( this.series[j].Val.NumCache.length < maxDataLen )
this.series[j].Val.NumCache.push(emptyItem);
}
if ( this.series[j].xVal.NumCache.length ) {
while ( this.series[j].xVal.NumCache.length < maxDataLen )
this.series[j].xVal.NumCache.push(emptyItem);
}
if ( this.series[j].Cat.NumCache.length ) {
while ( this.series[j].Cat.NumCache.length < maxDataLen )
this.series[j].Cat.NumCache.push(emptyItem);
}
}
if ( serLen ) {
for (i = 0; i < this.series[0].Val.NumCache.length; i++) {
var seria = new asc_CChartSeria();
for (j = 0; j < this.series.length; j++) {
seria.Val.NumCache.push(this.series[j].Val.NumCache[i]);
if ( this.series[j].TxCache.Formula && this.series[j].TxCache.Tx )
seria.Cat.NumCache.push( {val: this.series[j].TxCache.Tx} );
if ( this.series[j].Cat.Formula && this.series[j].Cat.NumCache.length )
seria.TxCache.Tx = this.series[j].Cat.NumCache[i].val;
else
seria.TxCache.Tx = (i + 1);
}
revSeries.push(seria);
}
}
// Colors
var seriaUniColors = this.generateUniColors(revSeries.length);
for (i = 0; i < revSeries.length; i++) {
revSeries[i].OutlineColor = seriaUniColors[i];
}
return revSeries;
},
generateUniColors: function(count) {
var uniColors = [];
var api_doc = window["editor"];
var api_sheet = window["Asc"]["editor"];
var api = api_sheet ? api_sheet : api_doc;
if ( count > 0 ) {
if ( !api.chartStyleManager.isReady() )
api.chartStyleManager.init();
var baseColors = api.chartStyleManager.getBaseColors( parseInt(this.styleId) );
var colors = this._generateColors(count, baseColors);
for ( var i = 0; i < colors.length; i++ ) {
var uniColor = CreateUniColorRGB(colors[i].r, colors[i].g, colors[i].b);
uniColor.isCustom = true;
uniColors.push(uniColor);
}
}
return uniColors;
},
getLegendInfo: function() {
var aInfo = [];
function legendInfo() { return { text: null, color: null, marker: null } }
for ( var i = 0; i < this.series.length; i++ ) {
var info = new legendInfo();
info.text = this.series[i].asc_getTitle();
info.color = this.series[i].asc_getOutlineColor();
info.marker = c_oAscLegendMarkerType.Line;
aInfo.push(info);
}
return aInfo;
},
Get_Id: function() {
......@@ -1436,7 +1287,6 @@ function asc_CChartSeria() {
this.Cat = { Formula: "", NumCache: [] };
this.TxCache = { Formula: "", Tx: "" };
this.Marker = { Size: 0, Symbol: "" };
this.OutlineColor = null;
this.FormatCode = "";
this.isHidden = false;
this.bShowValue = false;
......@@ -1465,14 +1315,6 @@ asc_CChartSeria.prototype = {
asc_getMarkerSymbol: function() { return this.Marker.Symbol; },
asc_setMarkerSymbol: function(symbol) { this.Marker.Symbol = symbol; },
asc_getOutlineColor: function() { return this.OutlineColor; },
asc_setOutlineColor: function(color) {
if ( color instanceof CUniColor ) {
this.OutlineColor = color.createDuplicate();
this.OutlineColor.isCustom = color.isCustom;
}
},
asc_getFormatCode: function() { return this.FormatCode; },
asc_setFormatCode: function(format) { this.FormatCode = format; }
};
......@@ -1503,9 +1345,6 @@ prot["asc_setMarkerSize"] = prot.asc_setMarkerSize;
prot["asc_getMarkerSymbol"] = prot.asc_getMarkerSymbol;
prot["asc_setMarkerSymbol"] = prot.asc_setMarkerSymbol;
prot["asc_getOutlineColor"] = prot.asc_getOutlineColor;
prot["asc_setOutlineColor"] = prot.asc_setOutlineColor;
prot["asc_getFormatCode"] = prot.asc_getFormatCode;
prot["asc_setFormatCode"] = prot.asc_setFormatCode;
//}
......
"use strict";
function ChartStyleManager() {
var _this = this;
var bReady = false;
_this.colorMap = [];
_this.baseColors = [];
//-----------------------------------------------------------------------------------
// Methods
//-----------------------------------------------------------------------------------
_this.init = function(options) {
/** proprietary begin **/
_this.colorMap = [];
var api_doc = window["editor"];
var api_sheet = window["Asc"]["editor"];
var themeColors = [];
if ( api_sheet )
themeColors = api_sheet.GuiControlColorsMap;
else
themeColors = getDocColors(api_doc, options);
function getDocColors(api, options) {
var _theme = api.WordControl.m_oLogicDocument.theme;
var _clrMap = api.WordControl.m_oLogicDocument.clrSchemeMap ? api.WordControl.m_oLogicDocument.clrSchemeMap.color_map : undefined;
var arr_colors = new Array(10);
var rgba = {R:0, G:0, B:0, A:255};
// bg1,tx1,bg2,tx2,accent1 - accent6
var array_colors_types = [6, 15, 7, 16, 0, 1, 2, 3, 4, 5];
var _count = array_colors_types.length;
var color = new CUniColor();
color.color = new CSchemeColor();
for (var i = 0; i < _count; ++i)
{
color.color.id = array_colors_types[i];
if(!options)
color.Calculate(_theme, _clrMap, rgba);
else
color.Calculate(options.theme, options.slide, options.layout, options.master, {R:0, G:0, B:0, A:255});
var _rgba = color.RGBA;
arr_colors[i] = new CColor(_rgba.R, _rgba.G, _rgba.B);
}
return arr_colors;
};
_this.colorMap[1] = [ new CColor(85, 85, 85), new CColor(158, 158, 158), new CColor(114, 114, 114), new CColor(70, 70, 70), new CColor(131, 131, 131), new CColor(193, 193, 193) ];
_this.colorMap[2] = [ themeColors[4], themeColors[5], themeColors[6], themeColors[7], themeColors[8], themeColors[9] ];
_this.colorMap[3] = [ themeColors[4] ];
_this.colorMap[4] = [ themeColors[5] ];
_this.colorMap[5] = [ themeColors[6] ];
_this.colorMap[6] = [ themeColors[7] ];
_this.colorMap[7] = [ themeColors[8] ];
_this.colorMap[8] = [ themeColors[9] ];
for (var i = 0; i < themeColors.length; i++) {
_this.baseColors.push(themeColors[i]);
}
bReady = true;
/** proprietary end **/
}
_this.isReady = function() {
return bReady;
}
_this.getBaseColors = function(styleId) {
if ( styleId && (typeof(styleId) == 'number') ) {
if ( styleId % 8 === 0 )
return _this.colorMap[8];
else
return _this.colorMap[styleId % 8];
}
else
return _this.colorMap[2];
}
}
function ChartPreviewManager() {
var _this = this;
......
......@@ -109,8 +109,6 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Режим вставки диаграмм в редакторе документов
this.isChartEditor = false;
if(typeof ChartStyleManager !== "undefined")
this.chartStyleManager = new ChartStyleManager();
if(typeof ChartPreviewManager !== "undefined")
this.chartPreviewManager = new ChartPreviewManager();
......
......@@ -195,11 +195,6 @@ var c_oAscGraphicOption = {
ChangePosition : 4
};
var c_oAscLegendMarkerType = {
Line : 0,
Square : 1
};
var c_oAscHyperlinkType = {
WebLink : 1,
RangeLink : 2
......
......@@ -1876,12 +1876,6 @@ CGraphicObjects.prototype = {
History.TurnOff();
var ret = new CChartAsGroup();
ret.setAscChart(new asc_CChart());
var options = {};
options.slide = this.slide;
options.layout = this.slide.Layout;
options.master = this.slide.Layout.Master;
options.theme = this.slide.Layout.Master.Theme;
editor.chartStyleManager.init(options);
var presentation = editor.WordControl.m_oLogicDocument;
var chart_width = 0.264583*c_oAscChartDefines.defaultChartWidth;
......
......@@ -126,10 +126,6 @@ function asc_docs_api(name)
this.canSave = true; //Флаг нужен чтобы не происходило сохранение пока не завершится предыдущее сохранение
if(typeof ChartStyleManager !== "undefined")
this.chartStyleManager = new ChartStyleManager();
else
this.chartStyleManager = null;
if(typeof ChartPreviewManager !== "undefined")
this.chartPreviewManager = new ChartPreviewManager();
else
......@@ -671,15 +667,15 @@ asc_docs_api.prototype.sync_BeginCatchSelectedElements = function()
}
asc_docs_api.prototype.sync_EndCatchSelectedElements = function(options)
{
if ( this.chartStyleManager && this.chartPreviewManager && ( !this.chartStyleManager.isReady() ))
// ToDo chartStyleManager уже нет, когда будут правиться презентации - поправить!!!
if ( /*this.chartStyleManager && */ this.chartPreviewManager /*&& ( !this.chartStyleManager.isReady() )*/)
{
for ( var i = 0; i < this.SelectedObjectsStack.length; i++ )
{
if ( this.SelectedObjectsStack[i].Value.ChartProperties )
{
this.chartStyleManager.init(options);
this.chartPreviewManager.init(options); // ToDo этой функции уже нет, когда будут правиться презентации - поправить!!!
//this.chartStyleManager.init(options);
//this.chartPreviewManager.init(options); // ToDo этой функции уже нет, когда будут правиться презентации - поправить!!!
this.asc_fireCallback("asc_onUpdateChartStyles");
break;
}
......
......@@ -630,11 +630,7 @@ function asc_docs_api(name)
this.DocumentReaderMode = null;
this.isChartEditor = false;
if(typeof ChartStyleManager != "undefined")
this.chartStyleManager = new ChartStyleManager();
else
this.chartStyleManager = null;
if(typeof ChartPreviewManager != "undefined")
this.chartPreviewManager = new ChartPreviewManager();
else
......
......@@ -10,8 +10,7 @@
this.WordControl = new CEditorPage(this);
this.WordControl.m_oLogicDocument = new CDocument(this.WordControl.m_oDrawingDocument);
this.WordControl.m_oDrawingDocument.m_oLogicDocument = this.WordControl.m_oLogicDocument;
this.chartStyleManager = new ChartStyleManager();
this.chartPreviewManager = new ChartPreviewManager();
}
......
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