@datarailsshared/dr_renderer 1.2.215-dragons → 1.2.217

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.215-dragons",
3
+ "version": "1.2.217",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1,6 +1,5 @@
1
1
  const SERIES_CLASSNAMES = {
2
2
  WATERFALL_BREAKDOWN: 'waterfallBreakdown',
3
- WATERFALL_WALKTHROUGH: 'waterfallWalkthrough',
4
3
  TOTAL_SERIES: 'totalSeries',
5
4
  TREND_SERIES: 'trendSeries',
6
5
  };
@@ -26,7 +25,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
26
25
  const textColor = "#151a41";
27
26
  const chartLabelColor = "#cfd7dd";
28
27
  const HIGHCHARTS_FONT_FAMILY = 'Poppins';
29
- let firstBarColor = null;
30
28
 
31
29
  if(!Highcharts){
32
30
  Highcharts = {
@@ -84,16 +82,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
84
82
  KPI_WIDGET: 'kpi-widget',
85
83
  TEXT_WIDGET: 'text-widget',
86
84
  WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
87
- WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
88
85
  PUBLISHED_ITEM: 'published_item',
89
86
  RICH_TEXT: 'rich_text',
90
87
  EXCEL_VIEWER: 'excel_viewer',
91
88
  };
92
89
 
93
- highchartsRenderer.VIRTUAL_FIELDS = {
94
- WATERFALL_VARIANCE: 'DR_WATERFALL_BREAKDOWN_VARIANCE',
95
- };
96
-
97
90
  highchartsRenderer.highcharts_theme = {
98
91
  "colors": highchartsRenderer.defaults_colors,
99
92
  "chart": {
@@ -469,7 +462,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
469
462
  highchartsRenderer.getOthersName(opts) :
470
463
  undefined;
471
464
  var drOthersInColumn = lodash.find(
472
- pivotData.getColKeys(),
465
+ pivotData.getColKeys(),
473
466
  keys => keys.length && (lodash.includes(keys, 'DR_Others') || lodash.includes(keys, othersName))
474
467
  );
475
468
 
@@ -489,7 +482,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
489
482
  rows = [];
490
483
  }
491
484
 
492
- var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
485
+ var cols = this.key;
493
486
  if (typeof (cols) == 'object' && cols.name) {
494
487
  cols = cols.name;
495
488
  }
@@ -497,7 +490,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
497
490
  if (!cols && is_drill_down_pie) {
498
491
  cols = this.point.name;
499
492
  }
500
-
493
+
501
494
  if (drOthersInColumn) {
502
495
  if (!lodash.isArray(cols) && othersName === cols) {
503
496
  cols = ['DR_Others'];
@@ -635,8 +628,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
635
628
  || this.series.options.className === 'trendSeries') {
636
629
  rows = [];
637
630
  }
638
-
639
- var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
631
+ var cols = this.key;
640
632
  if (!cols && is_drill_down_pie) {
641
633
  cols = this.name;
642
634
  }
@@ -659,9 +651,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
659
651
  rows = temp;
660
652
  }
661
653
 
662
- var category_text = `<span style="font-weight: bold;">
663
- ${ lodash.get(this, 'point.options.colsForTotal') ? cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
664
- </span>`;
654
+ var category_text = `<span style="font-weight: bold;">${ cols }${ isWaterfallBreakdown ? ': ' : ' ' }</span>`;
665
655
  if (this.category) {
666
656
  category_text = '';
667
657
  }
@@ -678,7 +668,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
678
668
  const modifiedRowsAndCols = highchartsRenderer.transformRowsAndColsForBreakdown(rows, cols, this.point, opts);
679
669
  rows = modifiedRowsAndCols.rows;
680
670
  cols = modifiedRowsAndCols.cols;
681
- }
671
+ }
682
672
 
683
673
  var aggr = pivotData.getAggregator(rows, cols);
684
674
 
@@ -1354,6 +1344,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1354
1344
  const chart_series = [];
1355
1345
  const row_n_keys = pivotData.getRowKeys();
1356
1346
  const col_n_keys = pivotData.getColKeys();
1347
+ const hasBreakdownValues = lodash.get(opts, 'breakdown_options.values.breakdown.length');
1357
1348
 
1358
1349
  let resultObject = {
1359
1350
  data: [],
@@ -1372,6 +1363,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1372
1363
  lodash.forEach(col_n_keys, function(col_n_value, col_index) {
1373
1364
 
1374
1365
  const totalColumnValue = pivotData.getAggregator([], col_n_value).value();
1366
+ const nextTotalColumnKey = col_n_keys[col_index + 1];
1367
+ const nextTotalColumnValue = nextTotalColumnKey ? pivotData.getAggregator([], nextTotalColumnKey).value() : null;
1375
1368
  resultObject.data.push({
1376
1369
  y: totalColumnValue,
1377
1370
  name: lodash.unescape(col_n_value).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
@@ -1383,7 +1376,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1383
1376
  if (col_index !== col_n_keys.length - 1) {
1384
1377
  lodash.forEach(row_n_keys, function (row_n_value) {
1385
1378
  const agg = pivotData.getAggregator(row_n_value, col_n_value);
1386
- let val = agg.value();
1379
+ let val = hasBreakdownValues
1380
+ ? agg.value()
1381
+ : nextTotalColumnValue - totalColumnValue;
1387
1382
 
1388
1383
  val = $.isNumeric(val) ? parseFloat(val) : 0;
1389
1384
  if (val) {
@@ -1394,7 +1389,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1394
1389
  if (tmoobj.name) {
1395
1390
  tmoobj.name = tmoobj.name.replace('DR_Others', highchartsRenderer.getOthersName(opts));
1396
1391
  }
1397
-
1398
1392
  if (lodash.isEmpty(String(tmoobj.name))) {
1399
1393
  tmoobj.name = lodash.unescape(col_n_value);
1400
1394
  tmoobj.visible = false;
@@ -1404,12 +1398,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1404
1398
  tmoobj.colKeys = [lodash.unescape(col_n_keys[col_index - 1]), lodash.unescape(col_n_value)];
1405
1399
  resultObject.data.push(tmoobj);
1406
1400
  }
1407
-
1408
1401
  });
1409
1402
  }
1410
1403
  });
1411
1404
 
1412
1405
  chart_series.push(resultObject);
1406
+
1413
1407
  opts.chart_series = [];
1414
1408
  if (!lodash.isEqual(row_n_keys, EMPTY_ROW_N_KEYS)) {
1415
1409
  chart_series.forEach(series => {
@@ -1420,85 +1414,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1420
1414
  return chart_series;
1421
1415
  }
1422
1416
 
1423
- highchartsRenderer.ptCreateWaterfallWalkthroughSeries = function (pivotData, onlyNumbers, additionOptions, opts) {
1424
- const waterfallOptions = opts.walkthrough_options;
1425
- const chart_series = [];
1426
- let resultObject = {
1427
- data: [],
1428
- dataLabels: {
1429
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
1430
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
1431
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, {'chartOptions': additionOptions, total_value_options: opts.total_value_options}),
1432
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
1433
- },
1434
- upColor: waterfallOptions.colors.increase,
1435
- color: waterfallOptions.colors.decrease,
1436
- className: SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH
1437
- };
1438
- resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
1439
- lodash.forEach(waterfallOptions.values.walkthrough, function(value, index) {
1440
-
1441
- let keys = [];
1442
- if (value.trend === 'total') {
1443
- keys = ['Total'];
1444
- } else {
1445
- _.forEach(value.key, (item) => {
1446
- const findKeyByValue = Object.keys(pivotData.dateValuesDictionary || {}).find(key => pivotData.dateValuesDictionary[key] === item);
1447
- keys.push(findKeyByValue ? findKeyByValue : item);
1448
- })
1449
- }
1450
-
1451
- const agg = pivotData.getAggregator([], keys);
1452
- let val = agg.value();
1453
-
1454
- if (val != null && $.isNumeric(val)) {
1455
- val = parseFloat(val);
1456
- } else if (onlyNumbers) {
1457
- val = NaN;
1458
- } else {
1459
- val = 0;
1460
- }
1461
-
1462
- const name = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
1463
- let color = '';
1464
- if (value.trend !== 'total') {
1465
- if (index === 0 && !firstBarColor) {
1466
- color = waterfallOptions.colors.total;
1467
- firstBarColor = waterfallOptions.colors.total;
1468
- } else {
1469
- color = value.color
1470
- }
1471
- } else {
1472
- color = waterfallOptions.colors.total;
1473
- }
1474
-
1475
- resultObject.data.push({
1476
- y: val,
1477
- name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1478
- isSum: value.trend === 'total',
1479
- isTotal: value.trend === 'total',
1480
- color,
1481
- colsForTotal: value.trend === 'total' ? keys : null,
1482
- });
1483
- });
1484
- chart_series.push(resultObject);
1485
- chart_series.push(
1486
- {
1487
- name: 'Increase',
1488
- visible: false,
1489
- color: waterfallOptions.colors.increase
1490
- });
1491
-
1492
- chart_series.push(
1493
- {
1494
- name: 'Decrease',
1495
- visible: false,
1496
- color: waterfallOptions.colors.decrease
1497
- });
1498
-
1499
- return chart_series;
1500
- }
1501
-
1502
1417
  highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
1503
1418
  const types = {
1504
1419
  'line-chart': 'line',
@@ -1702,7 +1617,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1702
1617
  highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
1703
1618
  let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
1704
1619
 
1705
- if (!result.dataLabels) return {};
1620
+ if (!result.dataLabels) return {};
1706
1621
  return {
1707
1622
  activeDataLabelStyle: {
1708
1623
  color: result.dataLabels.color,
@@ -3258,7 +3173,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3258
3173
 
3259
3174
  highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
3260
3175
  let chartOptions = {};
3261
- const additionOptions = opts.chartOptions
3176
+ const additionOptions = opts.chartOptions
3262
3177
  ? opts.chartOptions
3263
3178
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
3264
3179
 
@@ -3357,122 +3272,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3357
3272
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3358
3273
  };
3359
3274
 
3360
- highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
3361
- let chartOptions = {};
3362
- const waterfallOptions = opts?.walkthrough_options;
3363
- const additionOptions = opts.chartOptions
3364
- ? opts.chartOptions
3365
- : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
3366
-
3367
- chartOptions.chart = {
3368
- type: 'waterfall',
3369
- zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
3370
- };
3371
- if (disableAnimation) {
3372
- chartOptions.chart.animation = false;
3373
- }
3374
- const walkthroughFieldIsNotSet = lodash.some(pivotData.getRowKeys(), rowKey => !rowKey || lodash.isArray(rowKey) && !rowKey.length);
3375
-
3376
- chartOptions.xAxis = {
3377
- type: 'category',
3378
- crosshair: true,
3379
- min: 0,
3380
- title: {
3381
- text : additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
3382
- },
3383
- uniqueNames: walkthroughFieldIsNotSet,
3384
- };
3385
-
3386
- highchartsRenderer.setTitleAndSubTitle(chartOptions, opts, additionOptions);
3387
-
3388
- chartOptions.yAxis = {
3389
- min: null,
3390
- max: null,
3391
- title: {
3392
- text: additionOptions && additionOptions.axisY ? additionOptions.axisY.name : '',
3393
- autoylabel: additionOptions && additionOptions.axisY ? additionOptions.axisY.autoylabel : ''
3394
- },
3395
- labels: {
3396
- formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
3397
- },
3398
- };
3399
- if (additionOptions) {
3400
- highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
3401
- }
3402
-
3403
- chartOptions.tooltip = {
3404
- formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
3405
- valueDecimals: 2,
3406
- };
3407
-
3408
- highchartsRenderer.handleGridLines(additionOptions, chartOptions);
3409
-
3410
- if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
3411
- const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
3412
- chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
3413
- } else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
3414
- chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
3415
- }
3416
- chartOptions.series = highchartsRenderer
3417
- .ptCreateWaterfallWalkthroughSeries(pivotData, null, additionOptions, opts);
3418
-
3419
- chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3420
- chartOptions.plotOptions = {
3421
- waterfall: {
3422
- pointPadding: 0.2,
3423
- borderWidth: 0,
3424
- borderRadius: 1,
3425
- lineWidth: 0,
3426
- },
3427
- series: {
3428
- animation: !disableAnimation,
3429
- cropThreshold: 1000,
3430
- dataLabels: {
3431
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
3432
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
3433
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
3434
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
3435
- inside: false
3436
- },
3437
- events: {
3438
- legendItemClick: () => {
3439
- return false;
3440
- }
3441
- }
3442
- }
3443
- };
3444
-
3445
- if (opts.drillDownListFunc) {
3446
- chartOptions.plotOptions.series.cursor = 'pointer';
3447
- chartOptions.plotOptions.series.point = {
3448
- events: {
3449
- click: opts.drillDownListFunc
3450
- }
3451
- };
3452
- }
3453
- if (waterfallOptions.colors) {
3454
- chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
3455
- chartOptions.legend.useHTML = true;
3456
- chartOptions.legend.labelFormatter = function() {
3457
- const name = this.options.className ? 'Total': this.name;
3458
- const findTotal = _.find(this.options.data, {isTotal: true});
3459
- const color = findTotal?.color ? findTotal.color : this.color;
3460
- 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>';
3461
- }
3462
-
3463
- chartOptions.legend.symbolPadding = 0;
3464
- chartOptions.legend.symbolWidth = 0;
3465
- chartOptions.legend.symbolHeight = 0;
3466
- chartOptions.legend.squareSymbol = false;
3467
- } else {
3468
- chartOptions.legend = {
3469
- enabled: false
3470
- }
3471
- }
3472
-
3473
- return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3474
- }
3475
-
3476
3275
  highchartsRenderer.formatFieldValue = function (field, value) {
3477
3276
  let currentType = '';
3478
3277
  let format = field.format;
@@ -4541,17 +4340,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4541
4340
  }
4542
4341
  };
4543
4342
 
4544
- highchartsRenderer.waterfallConstants = {
4545
- [highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
4546
- minCategoriesCount: 2,
4547
- maxCategoriesCount: 5,
4548
- },
4549
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
4550
- minCategoriesCount: 2,
4551
- maxCategoriesCount: 10,
4552
- }
4553
- };
4554
-
4555
4343
  highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
4556
4344
  if (!rowData || !rowData) {
4557
4345
  if (options.onlyOptions) {
@@ -4560,15 +4348,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4560
4348
  return null;
4561
4349
  }
4562
4350
 
4563
- const isWaterfall = widget
4564
- && (
4565
- widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN
4566
- || widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH
4567
- );
4568
-
4569
- if (isWaterfall) {
4570
- const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
4571
- const minCategories = highchartsRenderer.waterfallConstants[widget.chart_type].minCategoriesCount;
4351
+ if (widget && widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
4352
+ const breakdownSettings = widget.options.breakdown_options.settings;
4353
+ const maxCategories = breakdownSettings.maxCategoriesCount;
4354
+ const minCategories = breakdownSettings.minCategoriesCount;
4572
4355
  const uniqueCategories = lodash.filter(
4573
4356
  lodash.uniq(
4574
4357
  lodash.map(rowData, row => row[widget.cols[0].name])
@@ -4578,13 +4361,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4578
4361
 
4579
4362
  if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
4580
4363
  options.error_has_occurred = true;
4581
- const isDateField = widget.cols[0].type === 'Date';
4582
- const commonMessagePart = `This chart support a selection of ${minCategories}-${maxCategories} items from the category section. `;
4583
4364
  options.error_params = {
4584
4365
  title: 'Data Conflict',
4585
4366
  text: `Please adjust your dashboard's reference date and filter selections as \
4586
4367
  the quantity of data doesn't match the chart's ${ minCategories }-${ maxCategories } value limit.`,
4587
- class: uniqueCategories.length < minCategories ? 'waterfall-nodata' : 'waterfall-too-much-data',
4368
+ class: 'nodata',
4588
4369
  }
4589
4370
  return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
4590
4371
  }
@@ -4828,25 +4609,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4828
4609
  return highchartsRenderer.getWeekNumber(dateObj);
4829
4610
  };
4830
4611
 
4831
- highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
4832
- let vals_not_convert = [];
4612
+ highchartsRenderer.check_value_not_for_convert = function (currentgraph, field_name) {
4613
+ let val_not_convert = null;
4833
4614
  if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
4834
4615
  let delta_options = currentgraph.options.chartOptions.delta_column;
4835
4616
  if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
4836
4617
  currentgraph.rows[0].name == field_name) {
4837
- vals_not_convert = [delta_options.name];
4618
+ val_not_convert = delta_options.name;
4838
4619
  } else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
4839
4620
  currentgraph.cols[0].name == field_name) {
4840
- vals_not_convert = [delta_options.name];
4621
+ val_not_convert = delta_options.name;
4841
4622
  }
4842
- } else if (currentgraph.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
4843
- lodash.forEach(currentgraph.options.walkthrough_options.values.walkthrough, value => {
4844
- if (value.trend === 'total') {
4845
- vals_not_convert.push(value.key[0]);
4846
- }
4847
- });
4848
4623
  }
4849
- return vals_not_convert;
4624
+ return val_not_convert;
4850
4625
  };
4851
4626
 
4852
4627
  highchartsRenderer.updateFiltersShowNames = function (filters) {
@@ -4866,8 +4641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4866
4641
  })
4867
4642
  };
4868
4643
 
4869
- highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
4870
- if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
4644
+ highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, val_not_for_convert) {
4645
+ if (val_not_for_convert && val_not_for_convert == value) {
4871
4646
  return value;
4872
4647
  }
4873
4648
 
@@ -5179,28 +4954,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5179
4954
  }
5180
4955
  });
5181
4956
 
5182
- // add virtual fields to rows if required
5183
- let rows = widgetOptions.rows;
5184
- if (!lodash.get(widgetOptions, 'rows.length') && widgetOptions.options.breakdown_options) {
5185
- rows = [
5186
- {
5187
- id: -1,
5188
- name: highchartsRenderer.VIRTUAL_FIELDS.WATERFALL_VARIANCE,
5189
- type: 'Text',
5190
- },
5191
- ];
5192
- }
5193
-
5194
4957
  // fill rows fields
5195
- lodash.forEach(rows, function (valObj) {
5196
- if (lodash.includes(highchartsRenderer.VIRTUAL_FIELDS, valObj.name)) {
5197
- legendFields.push(valObj);
5198
- } else {
5199
- fieldOb = lodash.find(fields, {id: valObj.id});
5200
- if (fieldOb) {
5201
- legendFields.push(fieldOb);
5202
- lodash.remove(fields, {id: fieldOb.id});
5203
- }
4958
+ lodash.forEach(widgetOptions.rows, function (valObj) {
4959
+ fieldOb = lodash.find(fields, {id: valObj.id});
4960
+ if (fieldOb) {
4961
+ legendFields.push(fieldOb);
4962
+ lodash.remove(fields, {id: fieldOb.id});
5204
4963
  }
5205
4964
  });
5206
4965
 
@@ -5841,7 +5600,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5841
5600
  return valToReturn;
5842
5601
  };
5843
5602
 
5844
-
5603
+
5845
5604
  highchartsRenderer.getChartAxisLabel = function(type) {
5846
5605
  return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
5847
5606
  };
@@ -6676,7 +6435,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6676
6435
  value_name: 'show',
6677
6436
  default_value: true,
6678
6437
  disabled_str: '!{var}.show_out_of_x_axis && !{var}.show_out_of_data_series && !{var}.show_value && !{var}.show_x_axis && !{var}.show_data_series',
6679
- disabled_fn: (value) => !value.show_out_of_x_axis
6438
+ disabled_fn: (value) => !value.show_out_of_x_axis
6680
6439
  && !value.show_out_of_data_series
6681
6440
  && !value.show_value
6682
6441
  && !value.show_x_axis
@@ -6717,8 +6476,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6717
6476
  element_label: '[X Axis]',
6718
6477
  value_name: 'show_x_axis',
6719
6478
  default_value: true,
6720
- clickFn: (value) => value.show = value.show
6721
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6479
+ clickFn: (value) => value.show = value.show
6480
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6722
6481
  : value.show,
6723
6482
  },
6724
6483
  {
@@ -6726,8 +6485,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6726
6485
  element_label: '[Data Series]',
6727
6486
  value_name: 'show_data_series',
6728
6487
  default_value: true,
6729
- clickFn: (value) => value.show = value.show
6730
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6488
+ clickFn: (value) => value.show = value.show
6489
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6731
6490
  : value.show,
6732
6491
  },
6733
6492
  {
@@ -6735,8 +6494,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6735
6494
  element_label: 'Value',
6736
6495
  value_name: 'show_value',
6737
6496
  default_value: true,
6738
- clickFn: (value) => value.show = value.show
6739
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6497
+ clickFn: (value) => value.show = value.show
6498
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6740
6499
  : value.show,
6741
6500
  },
6742
6501
  {
@@ -6744,8 +6503,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6744
6503
  element_label: '% Out of [X Axis]',
6745
6504
  value_name: 'show_out_of_x_axis',
6746
6505
  default_value: false,
6747
- clickFn: (value) => value.show = value.show
6748
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6506
+ clickFn: (value) => value.show = value.show
6507
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6749
6508
  : value.show,
6750
6509
  },
6751
6510
  {
@@ -6753,8 +6512,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6753
6512
  element_label: '% Out of [Data Series]',
6754
6513
  value_name: 'show_out_of_data_series',
6755
6514
  default_value: false,
6756
- clickFn: (value) => value.show = value.show
6757
- ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6515
+ clickFn: (value) => value.show = value.show
6516
+ ? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
6758
6517
  : value.show,
6759
6518
  },
6760
6519
  ]
@@ -6928,16 +6687,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6928
6687
  value_name: 'name',
6929
6688
  element_label: 'Name',
6930
6689
  default_value: '_Variance'
6931
- }, {
6932
- element_type: 'input',
6933
- value_name: 'formula',
6934
- element_label: 'Formula',
6935
- default_value: 'x2-x1'
6936
6690
  }, {
6937
6691
  element_type: 'input',
6938
- value_name: 'color',
6939
- element_label: 'Color',
6940
- default_value: ''
6692
+ value_name: 'formula',
6693
+ element_label: 'Formula',
6694
+ default_value: 'x2-x1'
6695
+ }, {
6696
+ element_type: 'input',
6697
+ value_name: 'color',
6698
+ element_label: 'Color',
6699
+ default_value: ''
6941
6700
  }, {
6942
6701
  element_type: 'radio',
6943
6702
  value_name: 'chart',
@@ -7060,17 +6819,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7060
6819
  axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
7061
6820
  legendTooltipTitle: 'Drag one field to further configure your x-axis.',
7062
6821
  legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
7063
- },
7064
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
7065
- name: 'Waterfall Walkthrough Chart ',
7066
- label: 'Waterfall Walkthrough Chart ',
7067
- title: 'TODO: add text',
7068
- description: 'TODO: add text',
7069
- axisName: 'Category',
7070
- startedMessage: 'TODO: add text',
7071
- axisTooltipTitle: 'TODO: add text',
7072
- legendTooltipTitle: 'TODO: add text',
7073
- },
6822
+ },
7074
6823
  'combo-chart': {
7075
6824
  name: 'Combo Chart ',
7076
6825
  label: 'Combo Chart ',
@@ -7726,24 +7475,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7726
7475
  highchartsRenderer.suboptions["legends"],
7727
7476
  ]
7728
7477
  },
7729
- {
7730
- type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
7731
- name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
7732
- class: 'google-visualization-charteditor-thumbs-columnchart',
7733
- render: highchartsRenderer.ptRenderWaterfallWalkthrough,
7734
- suboptions: [
7735
- highchartsRenderer.suboptions["axisX"],
7736
- highchartsRenderer.suboptions["tooltips"],
7737
- highchartsRenderer.suboptions["label"],
7738
- highchartsRenderer.suboptions["subtitle"],
7739
- highchartsRenderer.suboptions["widget_library"],
7740
- highchartsRenderer.suboptions["chart"],
7741
- highchartsRenderer.suboptions["negative_number_format"],
7742
- highchartsRenderer.suboptions["advanced"],
7743
- highchartsRenderer.suboptions["legends"],
7744
- ],
7745
- hidden: true,
7746
- },
7747
7478
  ]
7748
7479
  },
7749
7480
  ];
@@ -7900,7 +7631,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7900
7631
  _.forEach(Object.keys(dates), key => {
7901
7632
  const dateConfiguration = dates[key];
7902
7633
  const timestamp = dateConfiguration.timestamp;
7903
- if (timestamp) {
7634
+ if (timestamp) {
7904
7635
  const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
7905
7636
  dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
7906
7637
  .toLocaleDateString();
@@ -8196,10 +7927,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8196
7927
  };
8197
7928
 
8198
7929
  highchartsRenderer.createDateFromString = function (dateString, format) {
8199
- if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
7930
+ if ((format && !highchartsRenderer.isDateFormat(dateString, format)) || !highchartsRenderer.isDate(dateString)) {
8200
7931
  return null;
8201
7932
  }
8202
- const utcDate = format
7933
+ const utcDate = format
8203
7934
  ? moment_lib.utc(dateString, format, true)
8204
7935
  : moment_lib.utc(dateString);
8205
7936
  return utcDate.startOf('day').unix();
@@ -8217,7 +7948,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8217
7948
  }
8218
7949
 
8219
7950
  let filters = [];
8220
-
7951
+
8221
7952
  if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
8222
7953
  const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
8223
7954
  const labels = [];
@@ -8245,7 +7976,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8245
7976
  col_value,
8246
7977
  highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
8247
7978
  );
8248
-
7979
+
8249
7980
  if ($.isEmptyObject(datetrange)) {
8250
7981
  return;
8251
7982
  }
@@ -8350,7 +8081,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8350
8081
  filter.is_excluded = false;
8351
8082
  } else {
8352
8083
  filter = highchartsRenderer.createDrillDownFilterObject(widget, widget.cols[0], colKey[0]);
8353
- filters.push(filter);
8354
8084
  }
8355
8085
  filter.values = [];
8356
8086
  for (let i = 0; i < colKey.length; i++) {
@@ -8488,7 +8218,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8488
8218
  var data = res;
8489
8219
 
8490
8220
  lodash.forEach(datesFields, function (row) {
8491
- row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
8221
+ row.val_not_convert = highchartsRenderer.check_value_not_for_convert(widget, row.name);
8492
8222
  });
8493
8223
 
8494
8224
  if (datesFields.length > 0) {
@@ -8894,14 +8624,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8894
8624
  return rightPosition;
8895
8625
  case 'none':
8896
8626
  return none;
8897
- }
8898
- } else if (isLine) {
8899
- return useNewUx ? leftPosition : rightPosition;
8900
- } else if (isPie) {
8901
- return useNewUx ? rightPosition : topPosition;
8902
8627
  }
8628
+ } else if (isLine) {
8629
+ return useNewUx ? leftPosition : rightPosition;
8630
+ } else if (isPie) {
8631
+ return useNewUx ? rightPosition : topPosition;
8632
+ }
8903
8633
 
8904
- return useNewUx ? topPosition : bottomPosition;
8634
+ return useNewUx ? topPosition : bottomPosition;
8905
8635
  }
8906
8636
 
8907
8637
  highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
@@ -8916,7 +8646,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8916
8646
  }
8917
8647
 
8918
8648
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
8919
- const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8649
+ const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8920
8650
  ? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
8921
8651
  : null;
8922
8652