Commit 6b5a4194 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@49543 954022d7-b5bf-4e40-9824-e11837661b57
parent 1c58f931
......@@ -1119,499 +1119,7 @@ function insertChart(chart, activeWorkSheet, width, height, isNewChart) {
numSeries++;
}
}
else if(chart.series && chart.series.length !=0 && api_sheet)
{
isSeries = true;
var series = chart.series;
//var ws = chart.worksheet;
var ws = chart.range.intervalObject.worksheet;
var arrValues = [];
var max = 0;
var min = 0;
var minY = 0;
var maxY = 0;
var isSkip = [];
var skipSeries = [];
var isEn = false;
var isEnY = false;
if (chart.type == 'Scatter' && series[0].xVal.Formula != null)//в случае точечной диаграммы отдельная обработка
{
var isEnY = false
for(l = 0; l < series.length; ++l)
{
var n = 0;
arrValues[l] = [];
arrFormatAdobeLabels[l] = [];
var formula = formulaToRange(series[l].Val.Formula,ws);
var xFormula = formulaToRange(series[l].xVal.Formula,ws);
var firstCol = formula.first.col;
var firstRow = formula.first.row;
var lastCol = formula.last.col;
var lastRow = formula.last.row;
var xfirstCol = xFormula.first.col;
var xfirstRow = xFormula.first.row;
var xlastCol = xFormula.last.col;
var xlastRow = xFormula.last.row;
var isRow = false;
if(xfirstCol == xlastCol)
isRow = true;
if(!isRow)//по строкам или по столбцам будем строить
{
var row = xfirstRow;
for(col = xfirstCol; col <= xlastCol; ++col)
{
arrValues[l][n] = [];
arrFormatAdobeLabels[l][n] = [];
var cell = ws.getCell(new CellAddress(row - 1, col - 1, 0));
var cellY = ws.getCell(new CellAddress(firstRow - 1, firstCol + n - 1, 0));
if(row == xfirstRow && col == xfirstCol && chart.subType != 'stackedPer' && chart.type != 'Stock')
{
formatCell = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
if(row == firstRow && col == firstCol - 1 && chart.subType != 'stackedPer' && chart.range.rows && chart.type != 'Stock')
formatCellScOy = cell.getNumFormatStr();
else if(row == firstRow - 1 && col == firstCol && chart.subType != 'stackedPer' && !chart.range.rows && chart.type != 'Stock')
formatCellScOy = cell.getNumFormatStr();
var orValue = cell.getValue();
var orValueY = cellY.getValue();
var value = parseFloat(orValue);
var valueY = parseFloat(orValueY);
if(orValue == '')
arrValues[l][n][0] = value;
else if (isNaN(value))
arrValues[l][n][0] = 0;
else
arrValues[l][n][0] = value;
if(orValueY == '')
arrValues[l][n][1] = orValueY;
else if (isNaN(valueY))
arrValues[l][n][1] = 0;
else
arrValues[l][n][1] = valueY;
arrFormatAdobeLabels[l][n][0] = cell.getNumFormatStr();
arrFormatAdobeLabels[l][n][1] = cellY.getNumFormatStr();
if(value.toString() != '' && !isEn)
{
min = value;
max = value;
isEn = true;
}
if(valueY.toString() != '' && !isEnY)
{
minY = valueY;
maxY = valueY;
isEnY = true;
}
if(min > value && value != '')
min = value
if(max < value && value != '')
max = value
if(minY > valueY && valueY != '')
minY = valueY
if(maxY < valueY && valueY != '')
maxY = valueY
n++;
}
}
else
{
var col = xfirstCol;
for(row = xfirstRow; row <= xlastRow; ++row)
{
arrValues[l][n] = [];
arrFormatAdobeLabels[l][n] = [];
var cell = ws.getCell(new CellAddress(row - 1, col - 1, 0));
var cellY = ws.getCell(new CellAddress(firstRow + n - 1, firstCol - 1, 0));
if(row == xfirstRow && col == xfirstCol && chart.subType != 'stackedPer' && chart.type != 'Stock')
{
formatCell = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
var orValue = cell.getValue();
var orValueY = cellY.getValue();
var value = parseFloat(orValue);
var valueY = parseFloat(orValueY);
if(orValue == '')
arrValues[l][n][0] = value;
else if (isNaN(value))
arrValues[l][n][0] = 0;
else
arrValues[l][n][0] = value;
if(orValueY == '')
arrValues[l][n][1] = orValueY;
else if (isNaN(valueY))
arrValues[l][n][1] = 0;
else
arrValues[l][n][1] = valueY;
arrFormatAdobeLabels[l][n][0] = cell.getNumFormatStr();
arrFormatAdobeLabels[l][n][1] = cellY.getNumFormatStr();
if(value.toString() != '' && !isEn)
{
min = value;
max = value;
isEn = true;
}
if(valueY.toString() != '' && !isEnY)
{
minY = valueY;
maxY = valueY;
isEnY = true;
}
if(min > value && value != '')
min = value
if(max < value && value != '')
max = value
if(minY > valueY && valueY != '')
minY = valueY
if(maxY < valueY && valueY != '')
maxY = valueY
n++;
}
}
}
if(minY && maxY)
{
chart.ymin = minY;
chart.ymax = maxY;
}
var newArr = arrValues;
}
else//для всех остальных диаграмм при условии что данные приходят в виде серий
{
var numSeries = 0;
for(l = 0; l < series.length; ++l)
{
var formula = formulaToRange(series[l].Val.Formula,ws);
var firstCol = formula.first.col;
var firstRow = formula.first.row;
var lastCol = formula.last.col;
var lastRow = formula.last.row;
skipSeries[l] = true;
var isRow = false;
if(firstCol == lastCol)
isRow = true;
if(chart.worksheet && chart.worksheet.model._getRow && chart.worksheet.model._getRow(firstRow - 1).hd == true && !isRow)
{
continue;
}
else if(chart.worksheet && chart.worksheet.model._getCol && chart.worksheet.model._getCol(firstCol - 1).hd == true && isRow)
{
continue;
}
skipSeries[l] = false;
arrValues[numSeries] = [];
arrFormatAdobeLabels[numSeries] = [];
isSkip[numSeries] = true;
if(!isRow)//по строкам или по столбцам
{
var row = firstRow;
var n = 0;
for(col = firstCol; col <= lastCol; ++col)
{
if(chart.worksheet && chart.worksheet.model._getCol && chart.worksheet.model._getCol(col - 1).hd == true)
{
continue;
}
var cell = ws.getCell(new CellAddress(row - 1, col - 1, 0));
if(numSeries == 0 && col == firstCol && chart.subType != 'stackedPer' && chart.type != 'Stock')
{
formatCell = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
else if(chart.type == 'Stock' && numSeries == 0 && col == firstCol)
{
formatCellScOy = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
if(chart.type == 'Scatter')
{
if(numSeries == 1 && col == firstCol && chart.subType != 'stackedPer' && chart.type != 'Stock')
formatCellScOy = cell.getNumFormatStr();
}
formatAdobeLabel = cell.getNumFormatStr();
var orValue = cell.getValue();
if('' != orValue)
isSkip[numSeries] = false;
var value = parseFloat(orValue)
if(!isEn && !isNaN(value))
{
min = value;
max = value;
isEn = true;
}
if(!isNaN(value) && value > max)
max = value
if(!isNaN(value) && value < min)
min = value
if(isNaN(value) && orValue == '' && (((chart.type == 'Line' ) && chart.subType == 'normal') || (chart.type == 'Scatter' )))
{
value = '';
}
else if (isNaN(value))
value = 0;
if(chart.type == 'Pie')
arrValues[numSeries][n] = Math.abs(value);
else
arrValues[numSeries][n] = value;
arrFormatAdobeLabels[numSeries][n] = formatAdobeLabel;
n++;
}
}
else
{
var col = firstCol;
var n = 0;
for(row = firstRow; row <= lastRow; ++row)
{
if(chart.worksheet && chart.worksheet.model._getRow && chart.worksheet.model._getRow(row - 1).hd == true)
{
continue;
}
var cell = ws.getCell(new CellAddress(row - 1, col - 1, 0));
if(numSeries == 0 && row == firstRow && chart.subType != 'stackedPer' && chart.type != 'Stock')
{
formatCell = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
else if(chart.type == 'Stock' && row == firstRow && l == 0)
{
formatCellScOy = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
if(chart.type == 'Scatter')
{
if(numSeries == 1 && row == firstRow && chart.subType != 'stackedPer' && chart.type != 'Stock')
formatCellScOy = cell.getNumFormatStr();
}
var orValue = cell.getValue();
if('' != orValue)
isSkip[numSeries] = false;
formatAdobeLabel = cell.getNumFormatStr();
var value = parseFloat(orValue)
if(!isEn && !isNaN(value))
{
min = value;
max = value;
isEn = true;
}
if(!isNaN(value) && value > max)
max = value
if(!isNaN(value) && value < min)
min = value
if(isNaN(value) && orValue == '' && (((chart.type == 'Line' ) && chart.subType == 'normal') || (chart.type == 'Scatter' )))
{
value = '';
}
else if (isNaN(value))
value = 0;
if(chart.type == 'Pie')
arrValues[numSeries][n] = Math.abs(value);
else
arrValues[numSeries][n] = value;
arrFormatAdobeLabels[numSeries][n] = formatAdobeLabel;
n++;
}
}
numSeries++;
}
}
}
else if(chart.data)//для текстового редактора
{
var data = chart.data;
var arrValues = [];
var n = 0;
var max = 0;
var min = 0;
var isEn = false;
var isSkip = [];
var isSkipRev = [];
for (row = 0; row < data.length; ++row) {
arrValues[n] = [];
arrFormatAdobeLabels[n] = [];
var k = 0;
isSkip[row] = true;
for (col = 0; col < data[row].length; ++col) {
if(row == 0 && col == 0 && chart.subType != 'stackedPer' && chart.type != 'Stock')
{
formatCell = data[row][col].numFormatStr;
isDateTimeFormat = data[row][col].isDateTimeFormat;
}
else if(chart.type == 'Stock' && row == 0 && col == 0)
{
formatCellScOy = data[row][col].numFormatStr;
isDateTimeFormat = data[row][col].isDateTimeFormat;
}
if(row ==1 && col == 0 && chart.subType != 'stackedPer' && chart.range.rows && chart.type != 'Stock')
formatCellScOy = data[row][col].numFormatStr;
else if(row == 0 && col == 1 && chart.subType != 'stackedPer' && !chart.range.rows && chart.type != 'Stock')
formatCellScOy = data[row][col].numFormatStr;
var orValue = data[row][col].value;
var formatAdobeLabel = 'General';
if(data[row][col].numFormatStr)
formatAdobeLabel = data[row][col].numFormatStr;
var value = parseFloat(orValue);
//если все значения пустые, то в дальнейшем при отрисовке пропускаем
if(!isNaN(parseFloat(orValue)))
isSkip[row] = false;
if(!isEn && !isNaN(value))
{
min = value;
max = value;
isEn = true;
}
if(!isNaN(value) && value > max)
max = value
if(!isNaN(value) && value < min)
min = value
if(isNaN(value) && orValue == '' && (((chart.type == 'Line' ) && chart.subType == 'normal') || (chart.type == 'Scatter' )))
{
value = '';
}
else if (isNaN(value))
value = 0;
if(chart.type == 'Pie')
arrValues[n][k] = Math.abs(value);
else
arrValues[n][k] = value;
arrFormatAdobeLabels[n][k] = formatAdobeLabel;
k++;
}
n++;
}
}
else//в случае если серии приходят пустыми обрабатываем как и раньше
{
var bbox = chart.range.intervalObject.getBBox0();
var arrValues = [];
var n = 0;
var max = 0;
var min = 0;
var isEn = false;
var isSkip = [];
var isSkipRev = [];
for (row = bbox.r1; row <= bbox.r2; ++row) {
arrValues[n] = [];
var k = 0;
isSkip[row - bbox.r1] = true;
for (col = bbox.c1; col <= bbox.c2; ++col) {
var cell = chart.range.intervalObject.worksheet.getCell(new CellAddress(row, col, 0));
if(row == bbox.r1 && col == bbox.c1 && chart.subType != 'stackedPer' && chart.type != 'Stock')
{
formatCell = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
else if(chart.type == 'Stock' && row == bbox.r1 && col == bbox.c1)
{
formatCellScOy = cell.getNumFormatStr();
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
}
if(row == bbox.r1 + 1 && col == bbox.c1 && chart.subType != 'stackedPer' && chart.range.rows && chart.type != 'Stock')
formatCellScOy = cell.getNumFormatStr();
else if(row == bbox.r1 && col == bbox.c1 + 1 && chart.subType != 'stackedPer' && !chart.range.rows && chart.type != 'Stock')
formatCellScOy = cell.getNumFormatStr();
var orValue = cell.getValue();
var value = parseFloat(orValue);
//если все значения пустые, то в дальнейшем при отрисовке пропускаем
if(orValue != '')
isSkip[row - bbox.r1] = false;
if(!isEn && !isNaN(value))
{
min = value;
max = value;
isEn = true;
}
if(!isNaN(value) && value > max)
max = value
if(!isNaN(value) && value < min)
min = value
if(isNaN(value) && orValue == '' && (((chart.type == 'Line' ) && chart.subType == 'normal') || (chart.type == 'Scatter' )))
{
value = '';
}
else if (isNaN(value))
value = 0;
if(chart.type == 'Pie')
arrValues[n][k] = Math.abs(value);
else
arrValues[n][k] = value;
k++;
}
n++;
}
var arrValuesRev = [];
var n = 0;
for (row = bbox.c1; row <= bbox.c2; ++row) {
arrValuesRev[n] = [];
var k = 0;
isSkipRev[row - bbox.c1] = true;
for (col = bbox.r1; col <= bbox.r2; ++col) {
var cell = chart.range.intervalObject.worksheet.getCell(new CellAddress(col, row, 0));
var orValue = cell.getValue()
if(orValue != '')
isSkipRev[row - bbox.c1] = false;
var value = parseFloat(orValue);
if(isNaN(value) && orValue == '' && (((chart.type == 'Line' ) && chart.subType == 'normal') || (chart.type == 'Scatter' )))
{
value = '';
}
else if (isNaN(value))
value = 0;
if(chart.type == 'Pie')
arrValuesRev[n][k] = Math.abs(value);
else
arrValuesRev[n][k] = value;
k++;
}
n++;
}
}
if(isSeries)
{
......
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