Commit 278a3897 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

Теперь при восстановлении диапазона чарта в iframe учитывается Cat серий

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49354 954022d7-b5bf-4e40-9824-e11837661b57
parent 1df85d46
...@@ -277,24 +277,24 @@ asc_CChart.prototype = { ...@@ -277,24 +277,24 @@ asc_CChart.prototype = {
var _t = this; var _t = this;
var bbox = _t.range.intervalObject.getBBox0(); var bbox = _t.range.intervalObject.getBBox0();
for (var i = bbox.r1; i <= bbox.r2; i++) { for (var i = bbox.r1 + 1; i <= bbox.r2; i++) {
var cell = _t.range.intervalObject.worksheet.getCell( new CellAddress(i, bbox.c1, 0) ); var cell = _t.range.intervalObject.worksheet.getCell( new CellAddress(i, bbox.c1, 0) );
var value = cell.getValue(); var value = cell.getValue();
if ( !isNumber(value) && (value != "") ) if ( !isNumber(value) && (value != "") )
cntLeft++; cntLeft++;
} }
if ( (cntLeft > 0) && (cntLeft > bbox.r2 - bbox.r1) ) if ( (cntLeft > 0) && (cntLeft >= bbox.r2 - bbox.r1) )
headers.bLeft = true; headers.bLeft = true;
for (var i = bbox.c1; i <= bbox.c2; i++) { for (var i = bbox.c1 + 1; i <= bbox.c2; i++) {
var cell = _t.range.intervalObject.worksheet.getCell( new CellAddress(bbox.r1, i, 0) ); var cell = _t.range.intervalObject.worksheet.getCell( new CellAddress(bbox.r1, i, 0) );
var value = cell.getValue(); var value = cell.getValue();
if ( !isNumber(value) && (value != "") ) if ( !isNumber(value) && (value != "") )
cntTop++; cntTop++;
} }
if ( (cntTop > 0) && (cntTop > bbox.c2 - bbox.c1) ) if ( (cntTop > 0) && (cntTop >= bbox.c2 - bbox.c1) )
headers.bTop = true; headers.bTop = true;
return headers; return headers;
...@@ -3385,35 +3385,29 @@ function DrawingObjects() { ...@@ -3385,35 +3385,29 @@ function DrawingObjects() {
var colArray = []; var colArray = [];
var rowArray = []; var rowArray = [];
if ( graphicObject.chart.series[0].TxCache.Formula ) { function parseDataFormula(data, bMinimum) {
var range = convertFormula(graphicObject.chart.series[0].TxCache.Formula, worksheet); if ( data && data.Formula ) {
if ( range ) { var range = convertFormula(data.Formula, worksheet);
colArray.push(range.bbox.c1); if ( range ) {
rowArray.push(range.bbox.r1); if ( bMinimum ) {
} colArray.push(range.bbox.c1);
} rowArray.push(range.bbox.r1);
if ( graphicObject.chart.series[0].xVal.Formula ) { }
var range = convertFormula(graphicObject.chart.series[0].xVal.Formula, worksheet); else {
if ( range ) { colArray.push(range.bbox.c2);
colArray.push(range.bbox.c1); rowArray.push(range.bbox.r2);
rowArray.push(range.bbox.r1); }
} }
}
if ( graphicObject.chart.series[0].Val.Formula ) {
var range = convertFormula(graphicObject.chart.series[0].Val.Formula, worksheet);
if ( range ) {
colArray.push(range.bbox.c1);
rowArray.push(range.bbox.r1);
} }
} }
if ( graphicObject.chart.series[seriesCount - 1].Val.Formula ) { parseDataFormula(graphicObject.chart.series[0].Val, true);
var range = convertFormula(graphicObject.chart.series[seriesCount - 1].Val.Formula, worksheet); parseDataFormula(graphicObject.chart.series[seriesCount - 1].Val, false);
if ( range ) {
colArray.push(range.bbox.c2); parseDataFormula(graphicObject.chart.series[0].TxCache, true);
rowArray.push(range.bbox.r2); parseDataFormula(graphicObject.chart.series[0].xVal, true);
} parseDataFormula(graphicObject.chart.series[0].Cat, true);
}
var c1 = Math.min.apply(null, colArray); var c1 = Math.min.apply(null, colArray);
var r1 = Math.min.apply(null, rowArray); var r1 = Math.min.apply(null, rowArray);
var c2 = Math.max.apply(null, colArray); var c2 = Math.max.apply(null, colArray);
...@@ -3441,6 +3435,34 @@ function DrawingObjects() { ...@@ -3441,6 +3435,34 @@ function DrawingObjects() {
// Заполняем таблицу // Заполняем таблицу
if ( graphicObject.chart.series.length ) { if ( graphicObject.chart.series.length ) {
function restoreDataRange(data, bRows) {
if ( data && data.Formula && data.NumCache.length ) {
var range = convertFormula(data.Formula, worksheet);
if ( range ) {
if ( bRows ) {
var index = 0;
for (var j = range.bbox.c1; j <= range.bbox.c2; j++) {
var cell = graphicObject.chart.range.intervalObject.worksheet.getCell(new CellAddress(range.bbox.r1, j, 0));
cell.setNumFormat(data.NumCache[index].numFormatStr);
cell.setValue(data.NumCache[index].val);
}
}
else {
var index = 0;
for (var j = range.bbox.r1; j <= range.bbox.r2; j++) {
var cell = graphicObject.chart.range.intervalObject.worksheet.getCell(new CellAddress(j, range.bbox.c1, 0));
cell.setNumFormat(data.NumCache[index].numFormatStr);
cell.setValue(data.NumCache[index].val);
index++;
}
}
}
}
}
for (var i = 0; i < seriesCount; i++) { for (var i = 0; i < seriesCount; i++) {
if ( graphicObject.chart.series[i].TxCache.Formula ) { if ( graphicObject.chart.series[i].TxCache.Formula ) {
...@@ -3452,28 +3474,9 @@ function DrawingObjects() { ...@@ -3452,28 +3474,9 @@ function DrawingObjects() {
} }
} }
var range = convertFormula(graphicObject.chart.series[i].Val.Formula, worksheet); restoreDataRange(graphicObject.chart.series[i].Val, graphicObject.chart.range.rows);
if ( range ) { restoreDataRange(graphicObject.chart.series[i].xVal, graphicObject.chart.range.rows);
if ( graphicObject.chart.range.rows ) { restoreDataRange(graphicObject.chart.series[i].Cat, graphicObject.chart.range.rows);
var index = 0;
for (var j = range.bbox.c1; j <= range.bbox.c2; j++) {
var cell = graphicObject.chart.range.intervalObject.worksheet.getCell(new CellAddress(range.bbox.r1, j, 0));
cell.setNumFormat(graphicObject.chart.series[i].Val.NumCache[index].numFormatStr);
cell.setValue(graphicObject.chart.series[i].Val.NumCache[index].val);
}
}
else {
var index = 0;
for (var j = range.bbox.r1; j <= range.bbox.r2; j++) {
var cell = graphicObject.chart.range.intervalObject.worksheet.getCell(new CellAddress(j, range.bbox.c1, 0));
cell.setNumFormat(graphicObject.chart.series[i].Val.NumCache[index].numFormatStr);
cell.setValue(graphicObject.chart.series[i].Val.NumCache[index].val);
index++;
}
}
}
} }
} }
else { else {
......
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