From c61fe01f5e9fca46e6ea09f4bda27521d608d67c Mon Sep 17 00:00:00 2001 From: ansaraidarbek Date: Thu, 19 Oct 2023 18:01:17 +0600 Subject: [PATCH] chartsdrawer: unit tests for power trendlines added --- common/Charts/ChartsDrawer.js | 85 +++---- .../spreadsheet-calculation/ChartsDrawTest.js | 239 +++++++----------- 2 files changed, 127 insertions(+), 197 deletions(-) diff --git a/common/Charts/ChartsDrawer.js b/common/Charts/ChartsDrawer.js index 6462449c84..966c7ac977 100644 --- a/common/Charts/ChartsDrawer.js +++ b/common/Charts/ChartsDrawer.js @@ -16130,10 +16130,11 @@ CColorObj.prototype = this.coordinates[oSeries.parent.Id] = {}; } if (!this.coordinates[oSeries.parent.Id][oSeries.Id]) { - this.coordinates[oSeries.parent.Id][oSeries.Id] = { coords: [], path: [] }; + this.coordinates[oSeries.parent.Id][oSeries.Id] = { coords: {xVals:[], yVals:[]}, path: [] }; } - - this.coordinates[oSeries.parent.Id][oSeries.Id].coords.push({ xVal: xVal + 1, yVal: yVal }); + + this.coordinates[oSeries.parent.Id][oSeries.Id].coords.xVals.push(xVal + 1); + this.coordinates[oSeries.parent.Id][oSeries.Id].coords.yVals.push(yVal); }, recalculate: function (charts) { @@ -16169,12 +16170,18 @@ CColorObj.prototype = return types[type] }, - _findSuppletiables: function (coordinates, mapping) { + _findSuppletiables: function (size, xVals, yVals, mapping) { + + const _mapper = function(prop, obj, index){ + if(mapping.hasOwnProperty(prop)){ + obj[index] = mapping[prop](obj[index]) + } + } const _mapCoordinates = function(){ - for(let i=0; i