diff --git a/common/Drawings/Format/ChartFormat.js b/common/Drawings/Format/ChartFormat.js index eff0247f2f..b8732c4102 100644 --- a/common/Drawings/Format/ChartFormat.js +++ b/common/Drawings/Format/ChartFormat.js @@ -2329,6 +2329,13 @@ CBaseChartObject.prototype.isObjectInSmartArt = function() { return false; }; + CBaseChartObject.prototype.getParentObjects = function() { + let oChartSpace = this.getChartSpace(); + if(oChartSpace) { + return oChartSpace.getParentObjects(); + } + return null; + }; function getMinMaxFromArrPoints(aPoints) { if(Array.isArray(aPoints) && aPoints.length > 0) { @@ -4409,6 +4416,12 @@ CSeriesBase.prototype.checkSeriesAfterChangeType = function() { }; + CSeriesBase.prototype.recalculateTrendline = function() { + let oTrendline = this.trendline; + if(oTrendline) { + oTrendline.recalculate(); + } + }; CSeriesBase.prototype.asc_getName = function() { var oThis = this; return AscFormat.ExecuteNoHistory(function() { @@ -14115,6 +14128,16 @@ } this.applyStyleEntry(oChartStyle.trendline, oColors.generateColors(1), 0, bReset); }; + CTrendLine.prototype.recalculate = function() { + this.pen = null; + if(this.spPr && this.spPr.ln && this.spPr.ln.Fill) { + let oChartSpace = this.getChartSpace(); + if(oChartSpace) { + this.pen = this.spPr.ln.createDuplicate(); + this.pen.Fill.check(oChartSpace.Get_Theme(), oChartSpace.Get_ColorMap()) + } + } + }; function CUpDownBars() { CBaseChartObject.call(this); diff --git a/common/Drawings/Format/ChartSpace.js b/common/Drawings/Format/ChartSpace.js index c332e75352..fcdc5c8223 100644 --- a/common/Drawings/Format/ChartSpace.js +++ b/common/Drawings/Format/ChartSpace.js @@ -7098,7 +7098,7 @@ function(window, undefined) { var ser = series[ii]; var pts = ser.getNumPts(); this.ptsCount += pts.length; - + ser.recalculateTrendline(); ser.compiledSeriesBrush = new AscFormat.CUniFill(); ser.compiledSeriesBrush.merge(base_fills2[ser.idx]); if (ser.spPr && ser.spPr.Fill) { @@ -7368,6 +7368,7 @@ function(window, undefined) { for(var i = 0; i < series.length; ++i) { var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0]; var ser = series[i]; + ser.recalculateTrendline(); var pts = ser.getNumPts(); this.ptsCount += pts.length; if(oChart.scatterStyle === AscFormat.SCATTER_STYLE_SMOOTH || oChart.scatterStyle === AscFormat.SCATTER_STYLE_SMOOTH_MARKER) { @@ -7529,6 +7530,7 @@ function(window, undefined) { base_line_fills = getArrayFillsFromBase(style.line2, nMaxSeriesIdx); for(var i = 0; i < series.length; ++i) { var ser = series[i]; + ser.recalculateTrendline(); var compiled_brush = new AscFormat.CUniFill(); compiled_brush.merge(base_fills[ser.idx]); if(ser.spPr && ser.spPr.Fill) {