@datarailsshared/dr_renderer 1.2.238-dragons → 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.238-dragons",
3
+ "version": "1.2.240",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1042,7 +1042,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1042
1042
  if (row_n_value && row_n_value.length > 0) {
1043
1043
  ob.name = row_n_value.join(highchartsRenderer.delimer).replace('DR_Others', othersName);
1044
1044
  }
1045
-
1046
1045
  lodash.forEach(col_n_keys, function (col_n_value, index) {
1047
1046
  var agg = pivotData.getAggregator(row_n_value, col_n_value);
1048
1047
  var val = agg.value();
@@ -1259,7 +1258,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1259
1258
  if (opts.trendLine) {
1260
1259
  const a = ((ySum * squareXSum) - (xSum * xySum)) / ((n * squareXSum) - (xSum * xSum));
1261
1260
  const b = ((n * xySum) - (xSum* ySum)) / ((n * squareXSum) - (xSum * xSum));
1262
-
1263
1261
  const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
1264
1262
  trendSeries.className = 'trendSeries';
1265
1263
  trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
@@ -1270,7 +1268,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1270
1268
  if (colors && colors[i]) {
1271
1269
  trendSeries.color = colors[i];
1272
1270
  }
1273
-
1274
1271
  trendSerieses.push(trendSeries);
1275
1272
  }
1276
1273
  i++;
@@ -1287,7 +1284,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1287
1284
  }
1288
1285
 
1289
1286
  let weights = { line: 2,spline: 3 ,area:-2, areaspline: -1, scatter:4, column: 1 };
1290
-
1291
1287
  if (opts.comboOptions && lodash.includes(chartType,'combo') && !lodash.isEqual(row_n_keys, EMPTY_ROW_N_KEYS)) {
1292
1288
  chart_series.forEach((series, seriesIndex) => {
1293
1289
  const savedSeriesOption = lodash.find(opts.comboOptions.seriesOptions, {series: series.name});
@@ -3362,7 +3358,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3362
3358
 
3363
3359
  highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
3364
3360
  let chartOptions = {};
3365
- const waterfallOptions = opts?.walkthrough_options;
3361
+ const waterfallOptions = lodash.get(opts, 'walkthrough_options');
3366
3362
  const additionOptions = opts.chartOptions
3367
3363
  ? opts.chartOptions
3368
3364
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
@@ -3458,7 +3454,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3458
3454
  chartOptions.legend.labelFormatter = function() {
3459
3455
  const name = this.options.className ? 'Total': this.name;
3460
3456
  const findTotal = _.find(this.options.data, {isTotal: true});
3461
- const color = findTotal?.color ? findTotal.color : this.color;
3457
+ const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3462
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>';
3463
3459
  }
3464
3460
 
@@ -5382,7 +5378,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5382
5378
  fields: [],
5383
5379
  },
5384
5380
  dataType: {
5385
- regex: /data[_\s]type[_\s]by/i,
5381
+ regex: /^(data[_\s]type[_\s]by|data[_\s]type)$/i,
5386
5382
  allowedFieldTypes: ['Text'],
5387
5383
  fields: [],
5388
5384
  },
@@ -8680,6 +8676,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8680
8676
  lodash.forEach(rowsAndCols, function (field) {
8681
8677
  const fieldToSort = lodash.find(widget.options.sortingFields, element => element.id === field.id);
8682
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
+ }
8683
8692
  });
8684
8693
  }
8685
8694