Commit 82d99ea3 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix get union for sparklines

parent 38bcaf4b
...@@ -5315,10 +5315,11 @@ CellArea.prototype = { ...@@ -5315,10 +5315,11 @@ CellArea.prototype = {
if (0 === i) { if (0 === i) {
result.assign2(item.sqref); result.assign2(item.sqref);
} else { } else {
result.union(item.sqref); result.addRange();
result.getLast().assign2(item.sqref);
} }
}); });
return result; return result.getUnion();
}; };
sparklineGroup.prototype.asc_getId = function () { sparklineGroup.prototype.asc_getId = function () {
return this.Id; return this.Id;
......
...@@ -701,6 +701,28 @@ ...@@ -701,6 +701,28 @@
this.getLast().assign2(range); this.getLast().assign2(range);
} }
}; };
SelectionRange.prototype.getUnion = function () {
var result = new SelectionRange();
var unionRanges = function (ranges, res) {
ranges.forEach(function (item, i) {
if (0 === i) {
res.assign2(item);
} else {
res.union(item);
}
});
};
unionRanges(this.ranges, result);
var isUnion = true, resultTmp;
while (isUnion && !result.isSingleRange()) {
resultTmp = new SelectionRange();
unionRanges(result.ranges, resultTmp);
isUnion = result.ranges.length !== resultTmp.ranges.length;
result = resultTmp;
}
return result;
};
SelectionRange.prototype.offsetCell = function (dr, dc, fCheckSize) { SelectionRange.prototype.offsetCell = function (dr, dc, fCheckSize) {
var done, curRange, mc; var done, curRange, mc;
var lastRow = this.activeCell.row; var lastRow = this.activeCell.row;
......
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