Commit 4004c3e3 authored by Alexander.Trofimov's avatar Alexander.Trofimov

arrCachedSparklines -> oCacheView in sparkline

fix bug with clear all
parent 665f45a8
......@@ -4717,7 +4717,6 @@ CellArea.prototype = {
this.f = null;
this.arrSparklines = [];
this.arrCachedSparklines = {};
//for drawing preview
this.canvas = null;
......@@ -5187,21 +5186,23 @@ CellArea.prototype = {
return res;
};
sparklineGroup.prototype.addView = function (oSparklineView, index) {
this.arrCachedSparklines[index] = oSparklineView;
};
sparklineGroup.prototype.draw = function (oDrawingContext) {
var oCacheView;
var graphics = new AscCommon.CGraphics();
graphics.init(oDrawingContext.ctx, oDrawingContext.getWidth(0), oDrawingContext.getHeight(0),
oDrawingContext.getWidth(3), oDrawingContext.getHeight(3));
graphics.m_oFontManager = AscCommon.g_fontManager;
for (var i in this.arrCachedSparklines) {
this.arrCachedSparklines[i].draw(graphics);
for (var i = 0; i < this.arrSparklines.length; ++i) {
if (oCacheView = this.arrSparklines[i].oCacheView) {
oCacheView.draw(graphics);
}
}
};
sparklineGroup.prototype.cleanCache = function () {
// ToDo clean only colors (for color scheme)
this.arrCachedSparklines = {};
for (var i = 0; i < this.arrSparklines.length; ++i) {
this.arrSparklines[i].oCacheView = null;
}
};
sparklineGroup.prototype.updateCache = function (sheet, ranges) {
var sparklineRange;
......@@ -5209,7 +5210,7 @@ CellArea.prototype = {
sparklineRange = this.arrSparklines[i]._f;
for (var j = 0; j < ranges.length; ++j) {
if (sparklineRange.isIntersect(ranges[j], sheet)) {
delete this.arrCachedSparklines[i];
this.arrSparklines[i].oChacheView = null;
break;
}
}
......@@ -5227,7 +5228,6 @@ CellArea.prototype = {
for (var i = 0; i < this.arrSparklines.length; ++i) {
if (this.arrSparklines[i].checkInRange(range)) {
this.arrSparklines.splice(i, 1);
delete this.arrCachedSparklines[i];
--i;
}
}
......@@ -5536,6 +5536,7 @@ CellArea.prototype = {
//for preview
this.oCache = null;
this.oCacheView = null;
}
sparkline.prototype.clone = function () {
......
......@@ -2875,18 +2875,18 @@ function DrawingObjects() {
_this.checkSparklineGroupMinMaxVal = function(oSparklineGroup)
{
var maxVal = null, minVal = null, i, j;
var maxVal = null, minVal = null, i, j, sparkline;
if(oSparklineGroup.type !== Asc.c_oAscSparklineType.Stacked &&
(Asc.c_oAscSparklineAxisMinMax.Group === oSparklineGroup.minAxisType || Asc.c_oAscSparklineAxisMinMax.Group === oSparklineGroup.maxAxisType))
{
for(i = 0; i < oSparklineGroup.arrSparklines.length; ++i)
{
if (!oSparklineGroup.arrCachedSparklines[i]) {
var oSparklineView = new CSparklineView();
oSparklineView.initFromSparkline(oSparklineGroup.arrSparklines[i], oSparklineGroup, worksheet);
oSparklineGroup.addView(oSparklineView, i);
sparkline = oSparklineGroup.arrSparklines[i];
if (!sparkline.oCacheView) {
sparkline.oCacheView = new CSparklineView();
sparkline.oCacheView.initFromSparkline(sparkline, oSparklineGroup, worksheet);
}
var aPoints = AscFormat.getPtsFromSeries(oSparklineGroup.arrCachedSparklines[i].chartSpace.chart.plotArea.charts[0].series[0]);
var aPoints = AscFormat.getPtsFromSeries(sparkline.oCacheView.chartSpace.chart.plotArea.charts[0].series[0]);
for(j = 0; j < aPoints.length; ++j)
{
if(Asc.c_oAscSparklineAxisMinMax.Group === oSparklineGroup.maxAxisType)
......@@ -2923,7 +2923,7 @@ function DrawingObjects() {
{
for(i = 0; i < oSparklineGroup.arrSparklines.length; ++i)
{
oSparklineGroup.arrCachedSparklines[i].setMinMaxValAx(minVal, maxVal, oSparklineGroup);
oSparklineGroup.arrSparklines[i].oCacheView.setMinMaxValAx(minVal, maxVal, oSparklineGroup);
}
}
}
......@@ -2932,7 +2932,7 @@ function DrawingObjects() {
_this.drawSparkLineGroups = function(oDrawingContext, aSparklineGroups, range, offsetX, offsetY)
{
var graphics, i, j;
var graphics, i, j, sparkline;
if(oDrawingContext instanceof AscCommonExcel.CPdfPrinter)
{
graphics = oDrawingContext.DocumentRenderer;
......@@ -2956,13 +2956,14 @@ function DrawingObjects() {
_this.checkSparklineGroupMinMaxVal(oSparklineGroup);
}
for(j = 0; j < oSparklineGroup.arrSparklines.length; ++j) {
if (!oSparklineGroup.arrCachedSparklines[j]) {
var oSparklineView = new CSparklineView();
oSparklineView.initFromSparkline(oSparklineGroup.arrSparklines[j], oSparklineGroup, worksheet);
oSparklineGroup.addView(oSparklineView, j);
}
if (!oSparklineGroup.arrSparklines[j].checkInRange(range)) {
continue;
sparkline = oSparklineGroup.arrSparklines[j];
if (!sparkline.checkInRange(range)) {
continue;
}
if (!sparkline.oCacheView) {
sparkline.oCacheView = new CSparklineView();
sparkline.oCacheView.initFromSparkline(sparkline, oSparklineGroup, worksheet);
}
if(oDrawingContext instanceof AscCommonExcel.CPdfPrinter)
......@@ -2975,7 +2976,7 @@ function DrawingObjects() {
graphics.SetBaseTransform(_baseTransform);
}
oSparklineGroup.arrCachedSparklines[j].draw(graphics, _offX, _offY);
sparkline.oCacheView.draw(graphics, _offX, _offY);
if(oDrawingContext instanceof AscCommonExcel.CPdfPrinter)
{
......
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