@datarailsshared/dr_renderer 1.2.127 → 1.2.128

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.128",
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