@datarailsshared/dr_renderer 1.2.239 → 1.2.240

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.239",
3
+ "version": "1.2.240",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -3358,7 +3358,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3358
3358
 
3359
3359
  highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
3360
3360
  let chartOptions = {};
3361
- const waterfallOptions = opts?.walkthrough_options;
3361
+ const waterfallOptions = lodash.get(opts, 'walkthrough_options');
3362
3362
  const additionOptions = opts.chartOptions
3363
3363
  ? opts.chartOptions
3364
3364
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
@@ -3454,7 +3454,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3454
3454
  chartOptions.legend.labelFormatter = function() {
3455
3455
  const name = this.options.className ? 'Total': this.name;
3456
3456
  const findTotal = _.find(this.options.data, {isTotal: true});
3457
- const color = findTotal?.color ? findTotal.color : this.color;
3457
+ const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3458
3458
  return '<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: '+ color + '; width: 12px; height: 12px; border-radius: 50%"></span><span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">' + name + '</span>';
3459
3459
  }
3460
3460
 
@@ -8676,6 +8676,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8676
8676
  lodash.forEach(rowsAndCols, function (field) {
8677
8677
  const fieldToSort = lodash.find(widget.options.sortingFields, element => element.id === field.id);
8678
8678
  field.sorting = fieldToSort ? fieldToSort.sorting : field.sorting;
8679
+
8680
+ // if it is breakdown widget - redefine sorting according to breakdown_options
8681
+ // TODO: remove this when BE sort will be implemented
8682
+ if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
8683
+ const waterfallFieldType = field.id === widget.cols[0].id ? 'totals' : 'breakdown';
8684
+ field.sorting = {
8685
+ type: "CustomOrder",
8686
+ values: lodash.map(
8687
+ widget.options.breakdown_options.values[waterfallFieldType],
8688
+ value => value.key
8689
+ ),
8690
+ };
8691
+ }
8679
8692
  });
8680
8693
  }
8681
8694