@datarailsshared/dr_renderer 1.2.240 → 1.2.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,6 +61,8 @@ workflows:
61
61
  npm-publish:
62
62
  jobs:
63
63
  - deploy:
64
+ context:
65
+ - metadata
64
66
  filters:
65
67
  branches:
66
68
  only:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.240",
3
+ "version": "1.2.242",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1438,7 +1438,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1438
1438
 
1439
1439
  let keys = [];
1440
1440
  if (value.trend === 'total') {
1441
- keys = ['Total'];
1441
+ keys = value.key;
1442
1442
  } else {
1443
1443
  _.forEach(value.key, (item) => {
1444
1444
  const findKeyByValue = Object.keys(pivotData.dateValuesDictionary || {}).find(key => pivotData.dateValuesDictionary[key] === item);
@@ -8827,6 +8827,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8827
8827
 
8828
8828
  res = highchartsRenderer.setNewFieldNames(res);
8829
8829
 
8830
+ if (widget_obj.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
8831
+ res = highchartsRenderer.addTotalsToWalkthroughRowData(widget_obj, res);
8832
+ }
8833
+
8830
8834
  let pivot = {};
8831
8835
  pivot.sorters = highchartsRenderer.getWidgetDataSorters(res, widget_obj);
8832
8836
  pivot.rowData = res;
@@ -9113,6 +9117,39 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9113
9117
  return series.name ? 'Trend Line (' + series.name + ')' : 'Trend Line';
9114
9118
  }
9115
9119
 
9120
+ highchartsRenderer.addTotalsToWalkthroughRowData = function(widget, rowDataInitial) {
9121
+ const walkthroughValues = widget.options.walkthrough_options.values.walkthrough;
9122
+ const categoryFields = widget.cols;
9123
+ const valueField = widget.vals[0];
9124
+ const rowData = lodash.cloneDeep(rowDataInitial);
9125
+ const modifiedRowData = [];
9126
+
9127
+ let sum = 0;
9128
+ lodash.forEach(walkthroughValues, (value) => {
9129
+
9130
+ // if it is not total value - then add it as rowData data row and sum it up
9131
+ // else - add total with calculated sum as new rowData data row (totals do not initially exist in BE response)
9132
+ if (value.trend !== 'total') {
9133
+ const rowIndex = lodash.findIndex(rowData, (responseRow) =>
9134
+ lodash.every(categoryFields, (field, fieldKey) => responseRow[field.name] === value.key[fieldKey])
9135
+ );
9136
+ modifiedRowData.push(rowData[rowIndex]);
9137
+ sum += rowData[rowIndex][valueField.name];
9138
+ rowData.splice(rowIndex, 1);
9139
+ } else {
9140
+ const totalRow = {};
9141
+ _.forEach(categoryFields, (field, fieldKey) => {
9142
+ totalRow[field.name] = value.key[fieldKey];
9143
+ });
9144
+ totalRow[valueField.name] = sum;
9145
+ modifiedRowData.push(totalRow);
9146
+ sum = 0;
9147
+ }
9148
+ });
9149
+
9150
+ return lodash.concat(modifiedRowData, rowData);
9151
+ }
9152
+
9116
9153
  return highchartsRenderer;
9117
9154
  };
9118
9155