forked from HTMLElements/smart-webcomponents-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmart.chart.waterfall.js
6 lines (4 loc) · 1.51 KB
/
smart.chart.waterfall.js
1
2
3
4
5
6
/* Smart UI v15.2.0 (2023-04-20)
Copyright (c) 2011-2023 jQWidgets.
License: https://htmlelements.com/license/ */ //
Smart.Chart&&(Smart.Chart.prototype._moduleWaterfall=!0,Smart.Chart.prototype._isSummary=function(t,e){const a=this.seriesGroups[t];for(let i=0;i<a.series.length;i++)if(void 0!==a.series[i].summary&&void 0!==this._getDataValue(e,a.series[i].summary,t))return!0;return!1},Smart.Chart.prototype._applyWaterfall=function(t,e,a,i,s,r,o,l,u){const f=this.seriesGroups[a];if(0===t.length)return t;let n=i;const N={},h=[];let m;const v=[];for(let t=0;t<f.series.length;t++)v.push(this._isSerieVisible(a,t));const c={};for(let f=0;f<e;f++){let e=i,p=0;const _=this._isSummary(a,f);for(let a=0;a<t.length;a++){if(!v[a])continue;let g=0;if(_){g=e===i?s:0,t[a][f].value=N[a],t[a][f].summary=!0,m=t[a][f].value<g,l&&(m=!m);let n=0;n=isNaN(r)?this._getDataPointOffsetDiff(t[a][f].value,g,g,NaN,o,i,l):this._getDataPointOffsetDiff(t[a][f].value+p,0===p?s:p,g||s,r,o,i,l),t[a][f].to=e+(m?n:-n),t[a][f].from=e,u&&(p+=t[a][f].value,e=t[a][f].to);continue}const y=u?-1:a;if(isNaN(t[a][f].value))continue;void 0===c[y]&&(g=s,c[y]=!0),m=t[a][f].value<g,l&&(m=!m);let D=NaN;D=u?n:0===f?i:t[a][h[a]].to;let S=0;S=isNaN(r)?this._getDataPointOffsetDiff(t[a][f].value,g,g,NaN,o,i,l):this._getDataPointOffsetDiff(t[a][f].value+(isNaN(N[y])?0:N[y]),isNaN(N[y])?s:N[y],g||s,r,o,D,l),t[a][f].to=n=D+(m?S:-S),t[a][f].from=D,isNaN(N[y])?N[y]=t[a][f].value:N[y]+=t[a][f].value,-1===y&&(isNaN(N[a])?N[a]=t[a][f].value:N[a]+=t[a][f].value),u||(h[a]=f)}}return t});