Commit 30689de0 authored by Alexander.Trofimov's avatar Alexander.Trofimov

union ranges for sparklines

parent d2d31572
...@@ -5288,7 +5288,7 @@ CellArea.prototype = { ...@@ -5288,7 +5288,7 @@ CellArea.prototype = {
} }
return bRemove; return bRemove;
}; };
sparklineGroup.prototype.getLocationRanges = function () { sparklineGroup.prototype.getLocationRanges = function (onlySingle) {
var result = new AscCommonExcel.SelectionRange(); var result = new AscCommonExcel.SelectionRange();
this.arrSparklines.forEach(function (item, i) { this.arrSparklines.forEach(function (item, i) {
if (0 === i) { if (0 === i) {
...@@ -5298,7 +5298,24 @@ CellArea.prototype = { ...@@ -5298,7 +5298,24 @@ CellArea.prototype = {
result.getLast().assign2(item.sqref); result.getLast().assign2(item.sqref);
} }
}); });
return result.getUnion(); var unionRange = result.getUnion();
return (!onlySingle || unionRange.isSingleRange()) ? unionRange : result;
};
sparklineGroup.prototype.getDataRanges = function () {
var isUnion = true;
var sheet = this.worksheet.getName();
var result = new AscCommonExcel.SelectionRange();
this.arrSparklines.forEach(function (item, i) {
isUnion = isUnion && sheet === item._f.sheet;
if (0 === i) {
result.assign2(item._f);
} else {
result.addRange();
result.getLast().assign2(item._f);
}
});
var unionRange = isUnion ? result.getUnion() : result;
return unionRange.isSingleRange() ? unionRange : result;
}; };
sparklineGroup.prototype.asc_getId = function () { sparklineGroup.prototype.asc_getId = function () {
return this.Id; return this.Id;
...@@ -5376,21 +5393,21 @@ CellArea.prototype = { ...@@ -5376,21 +5393,21 @@ CellArea.prototype = {
return this.colorLow ? Asc.colorObjToAscColor(this.colorLow) : this.colorLow; return this.colorLow ? Asc.colorObjToAscColor(this.colorLow) : this.colorLow;
}; };
sparklineGroup.prototype.asc_getDataRanges = function () { sparklineGroup.prototype.asc_getDataRanges = function () {
var oDataRange = new AscCommonExcel.SelectionRange();
var oLocationRange = new AscCommonExcel.SelectionRange();
//var bInit = false;
var arrResultData = []; var arrResultData = [];
var arrResultLocation = []; var arrResultLocation = [];
this.arrSparklines.forEach(function (item) { var oLocationRanges = this.getLocationRanges(true);
/*if (bInit) { var oDataRanges = oLocationRanges.isSingleRange() && this.getDataRanges();
} else { if (oLocationRanges.isSingleRange() && oDataRanges.isSingleRange()) {
bInit = true; for (var i = 0; i < oLocationRanges.ranges.length; ++i) {
oDataRange.assign2(item.sqref); arrResultData.push(oDataRanges.ranges[i].getName());
oLocationRange.assign2(); arrResultLocation.push(oLocationRanges.ranges[i].getAbsName());
}*/ }
arrResultData.push(item.f); } else {
arrResultLocation.push(item.sqref.getAbsName()); this.arrSparklines.forEach(function (item) {
}); arrResultData.push(item.f);
arrResultLocation.push(item.sqref.getAbsName());
});
}
return [arrResultData.join(AscCommon.FormulaSeparators.functionArgumentSeparator), return [arrResultData.join(AscCommon.FormulaSeparators.functionArgumentSeparator),
arrResultLocation.join(AscCommon.FormulaSeparators.functionArgumentSeparator)]; arrResultLocation.join(AscCommon.FormulaSeparators.functionArgumentSeparator)];
}; };
......
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