@datarailsshared/dr_renderer 1.2.127 → 1.2.130

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.127",
3
+ "version": "1.2.130",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -422,6 +422,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
422
422
  }
423
423
 
424
424
  const labelOptions = lodash.get(opts.chartOptions, 'label') || lodash.get(opts.chartOptions, 'label_pie');
425
+ const othersName = opts.total_value_options ?
426
+ lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others' :
427
+ undefined;
428
+ var drOthersInColumn = lodash.find(pivotData.getColKeys(), keys => keys.length && (keys.includes('DR_Others') || keys.includes(othersName)));
425
429
 
426
430
  var func = function () {
427
431
  var value = parseFloat(this.y);
@@ -447,8 +451,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
447
451
  cols = this.point.name;
448
452
  }
449
453
 
450
- var drOthersInColumn = lodash.find(pivotData.getColKeys(), keys => keys.length && lodash.includes(keys, 'DR_Others')) || [];
451
- if (!lodash.isArray(cols) && drOthersInColumn[0] !== 'DR_Others') {
454
+ if (drOthersInColumn) {
455
+ if (!lodash.isArray(cols) && othersName === cols) {
456
+ cols = ['DR_Others'];
457
+ } else if (lodash.isArray(cols)) {
458
+ var index = cols.indexOf(othersName);
459
+
460
+ if (index !== -1) {
461
+ cols[index] = 'DR_Others';
462
+ }
463
+ }
464
+ }
465
+
466
+ if (!lodash.isArray(cols)) {
452
467
  cols = [cols];
453
468
  }
454
469
 
@@ -1109,7 +1124,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1109
1124
  ob.dataLabels = {
1110
1125
  allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
1111
1126
  enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
1112
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, {'chartOptions': additionOptions}),
1127
+ formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, {'chartOptions': additionOptions, total_value_options: opts.total_value_options}),
1113
1128
  style: highchartsRenderer.getDataLabelsStyle(additionOptions)
1114
1129
  }
1115
1130
 
@@ -3563,6 +3578,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3563
3578
  if (this.ignoreValue) {
3564
3579
  return null;
3565
3580
  }
3581
+ if (useTotalsCalculation) {
3582
+ return this.sum;
3583
+ }
3566
3584
  return this.sum / this.len;
3567
3585
  },
3568
3586
  format: function (x, only_formats) {
@@ -7873,6 +7891,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7873
7891
  return sorters;
7874
7892
  };
7875
7893
 
7894
+ highchartsRenderer.getSorters = function (field, values) {
7895
+ if (field.sorting && field.sorting.type === 'DateString') {
7896
+ return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
7897
+ } else if (field.sorting && field.sorting.type === 'largestToSmallest') {
7898
+ if (field.sorting.is_absolute)
7899
+ return $.pivotUtilities.largeToSmallSortByAbsolute;
7900
+
7901
+ return $.pivotUtilities.largeToSmallSort;
7902
+ } else {
7903
+ return $.pivotUtilities.sortAs(values);
7904
+ }
7905
+ };
7906
+
7876
7907
  //highchartsRenderer.getGraphOptions(scope.data, override_values, res, scope.dataModel.templatesWithOutData, scope.openDrillDownList, drillDownFunction)
7877
7908
  highchartsRenderer.getGraphOptions = function (widget_obj, override_values, row_data, templates, openDrillDownListFunction, drillDownFunction) {
7878
7909
  let res = highchartsRenderer.updateSelectedOverrideValues(widget_obj, override_values, row_data);