@datarailsshared/dr_renderer 1.2.216-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.216-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,89 +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
- if (value.trend === 'decrease') {
1463
- val = val * -1;
1464
- }
1465
-
1466
- const name = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
1467
- let color = '';
1468
- if (value.trend !== 'total') {
1469
- if (index === 0 && !firstBarColor) {
1470
- color = waterfallOptions.colors.total;
1471
- firstBarColor = waterfallOptions.colors.total;
1472
- } else {
1473
- color = value.color
1474
- }
1475
- } else {
1476
- color = waterfallOptions.colors.total;
1477
- }
1478
-
1479
- resultObject.data.push({
1480
- y: val,
1481
- name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1482
- isSum: value.trend === 'total',
1483
- isTotal: value.trend === 'total',
1484
- color,
1485
- colsForTotal: value.trend === 'total' ? keys : null,
1486
- });
1487
- });
1488
- chart_series.push(resultObject);
1489
- chart_series.push(
1490
- {
1491
- name: 'Increase',
1492
- visible: false,
1493
- color: waterfallOptions.colors.increase
1494
- });
1495
-
1496
- chart_series.push(
1497
- {
1498
- name: 'Decrease',
1499
- visible: false,
1500
- color: waterfallOptions.colors.decrease
1501
- });
1502
-
1503
- return chart_series;
1504
- }
1505
-
1506
1417
  highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
1507
1418
  const types = {
1508
1419
  'line-chart': 'line',
@@ -1706,7 +1617,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1706
1617
  highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
1707
1618
  let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
1708
1619
 
1709
- if (!result.dataLabels) return {};
1620
+ if (!result.dataLabels) return {};
1710
1621
  return {
1711
1622
  activeDataLabelStyle: {
1712
1623
  color: result.dataLabels.color,
@@ -3262,7 +3173,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3262
3173
 
3263
3174
  highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
3264
3175
  let chartOptions = {};
3265
- const additionOptions = opts.chartOptions
3176
+ const additionOptions = opts.chartOptions
3266
3177
  ? opts.chartOptions
3267
3178
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
3268
3179
 
@@ -3361,122 +3272,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3361
3272
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3362
3273
  };
3363
3274
 
3364
- highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
3365
- let chartOptions = {};
3366
- const waterfallOptions = opts?.walkthrough_options;
3367
- const additionOptions = opts.chartOptions
3368
- ? opts.chartOptions
3369
- : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
3370
-
3371
- chartOptions.chart = {
3372
- type: 'waterfall',
3373
- zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
3374
- };
3375
- if (disableAnimation) {
3376
- chartOptions.chart.animation = false;
3377
- }
3378
- const walkthroughFieldIsNotSet = lodash.some(pivotData.getRowKeys(), rowKey => !rowKey || lodash.isArray(rowKey) && !rowKey.length);
3379
-
3380
- chartOptions.xAxis = {
3381
- type: 'category',
3382
- crosshair: true,
3383
- min: 0,
3384
- title: {
3385
- text : additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
3386
- },
3387
- uniqueNames: walkthroughFieldIsNotSet,
3388
- };
3389
-
3390
- highchartsRenderer.setTitleAndSubTitle(chartOptions, opts, additionOptions);
3391
-
3392
- chartOptions.yAxis = {
3393
- min: null,
3394
- max: null,
3395
- title: {
3396
- text: additionOptions && additionOptions.axisY ? additionOptions.axisY.name : '',
3397
- autoylabel: additionOptions && additionOptions.axisY ? additionOptions.axisY.autoylabel : ''
3398
- },
3399
- labels: {
3400
- formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
3401
- },
3402
- };
3403
- if (additionOptions) {
3404
- highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
3405
- }
3406
-
3407
- chartOptions.tooltip = {
3408
- formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
3409
- valueDecimals: 2,
3410
- };
3411
-
3412
- highchartsRenderer.handleGridLines(additionOptions, chartOptions);
3413
-
3414
- if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
3415
- const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
3416
- chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
3417
- } else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
3418
- chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
3419
- }
3420
- chartOptions.series = highchartsRenderer
3421
- .ptCreateWaterfallWalkthroughSeries(pivotData, null, additionOptions, opts);
3422
-
3423
- chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3424
- chartOptions.plotOptions = {
3425
- waterfall: {
3426
- pointPadding: 0.2,
3427
- borderWidth: 0,
3428
- borderRadius: 1,
3429
- lineWidth: 0,
3430
- },
3431
- series: {
3432
- animation: !disableAnimation,
3433
- cropThreshold: 1000,
3434
- dataLabels: {
3435
- allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
3436
- enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
3437
- formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
3438
- style: highchartsRenderer.getDataLabelsStyle(additionOptions),
3439
- inside: false
3440
- },
3441
- events: {
3442
- legendItemClick: () => {
3443
- return false;
3444
- }
3445
- }
3446
- }
3447
- };
3448
-
3449
- if (opts.drillDownListFunc) {
3450
- chartOptions.plotOptions.series.cursor = 'pointer';
3451
- chartOptions.plotOptions.series.point = {
3452
- events: {
3453
- click: opts.drillDownListFunc
3454
- }
3455
- };
3456
- }
3457
- if (waterfallOptions.colors) {
3458
- chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
3459
- chartOptions.legend.useHTML = true;
3460
- chartOptions.legend.labelFormatter = function() {
3461
- const name = this.options.className ? 'Total': this.name;
3462
- const findTotal = _.find(this.options.data, {isTotal: true});
3463
- const color = findTotal?.color ? findTotal.color : this.color;
3464
- 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>';
3465
- }
3466
-
3467
- chartOptions.legend.symbolPadding = 0;
3468
- chartOptions.legend.symbolWidth = 0;
3469
- chartOptions.legend.symbolHeight = 0;
3470
- chartOptions.legend.squareSymbol = false;
3471
- } else {
3472
- chartOptions.legend = {
3473
- enabled: false
3474
- }
3475
- }
3476
-
3477
- return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3478
- }
3479
-
3480
3275
  highchartsRenderer.formatFieldValue = function (field, value) {
3481
3276
  let currentType = '';
3482
3277
  let format = field.format;
@@ -4545,17 +4340,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4545
4340
  }
4546
4341
  };
4547
4342
 
4548
- highchartsRenderer.waterfallConstants = {
4549
- [highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
4550
- minCategoriesCount: 2,
4551
- maxCategoriesCount: 5,
4552
- },
4553
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
4554
- minCategoriesCount: 2,
4555
- maxCategoriesCount: 10,
4556
- }
4557
- };
4558
-
4559
4343
  highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
4560
4344
  if (!rowData || !rowData) {
4561
4345
  if (options.onlyOptions) {
@@ -4564,15 +4348,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4564
4348
  return null;
4565
4349
  }
4566
4350
 
4567
- const isWaterfall = widget
4568
- && (
4569
- widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN
4570
- || widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH
4571
- );
4572
-
4573
- if (isWaterfall) {
4574
- const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
4575
- 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;
4576
4355
  const uniqueCategories = lodash.filter(
4577
4356
  lodash.uniq(
4578
4357
  lodash.map(rowData, row => row[widget.cols[0].name])
@@ -4582,13 +4361,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4582
4361
 
4583
4362
  if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
4584
4363
  options.error_has_occurred = true;
4585
- const isDateField = widget.cols[0].type === 'Date';
4586
- const commonMessagePart = `This chart support a selection of ${minCategories}-${maxCategories} items from the category section. `;
4587
4364
  options.error_params = {
4588
4365
  title: 'Data Conflict',
4589
4366
  text: `Please adjust your dashboard's reference date and filter selections as \
4590
4367
  the quantity of data doesn't match the chart's ${ minCategories }-${ maxCategories } value limit.`,
4591
- class: uniqueCategories.length < minCategories ? 'waterfall-nodata' : 'waterfall-too-much-data',
4368
+ class: 'nodata',
4592
4369
  }
4593
4370
  return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
4594
4371
  }
@@ -4832,25 +4609,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4832
4609
  return highchartsRenderer.getWeekNumber(dateObj);
4833
4610
  };
4834
4611
 
4835
- highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
4836
- let vals_not_convert = [];
4612
+ highchartsRenderer.check_value_not_for_convert = function (currentgraph, field_name) {
4613
+ let val_not_convert = null;
4837
4614
  if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
4838
4615
  let delta_options = currentgraph.options.chartOptions.delta_column;
4839
4616
  if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
4840
4617
  currentgraph.rows[0].name == field_name) {
4841
- vals_not_convert = [delta_options.name];
4618
+ val_not_convert = delta_options.name;
4842
4619
  } else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
4843
4620
  currentgraph.cols[0].name == field_name) {
4844
- vals_not_convert = [delta_options.name];
4621
+ val_not_convert = delta_options.name;
4845
4622
  }
4846
- } else if (currentgraph.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
4847
- lodash.forEach(currentgraph.options.walkthrough_options.values.walkthrough, value => {
4848
- if (value.trend === 'total') {
4849
- vals_not_convert.push(value.key[0]);
4850
- }
4851
- });
4852
4623
  }
4853
- return vals_not_convert;
4624
+ return val_not_convert;
4854
4625
  };
4855
4626
 
4856
4627
  highchartsRenderer.updateFiltersShowNames = function (filters) {
@@ -4870,8 +4641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4870
4641
  })
4871
4642
  };
4872
4643
 
4873
- highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
4874
- 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) {
4875
4646
  return value;
4876
4647
  }
4877
4648
 
@@ -5183,28 +4954,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5183
4954
  }
5184
4955
  });
5185
4956
 
5186
- // add virtual fields to rows if required
5187
- let rows = widgetOptions.rows;
5188
- if (!lodash.get(widgetOptions, 'rows.length') && widgetOptions.options.breakdown_options) {
5189
- rows = [
5190
- {
5191
- id: -1,
5192
- name: highchartsRenderer.VIRTUAL_FIELDS.WATERFALL_VARIANCE,
5193
- type: 'Text',
5194
- },
5195
- ];
5196
- }
5197
-
5198
4957
  // fill rows fields
5199
- lodash.forEach(rows, function (valObj) {
5200
- if (lodash.includes(highchartsRenderer.VIRTUAL_FIELDS, valObj.name)) {
5201
- legendFields.push(valObj);
5202
- } else {
5203
- fieldOb = lodash.find(fields, {id: valObj.id});
5204
- if (fieldOb) {
5205
- legendFields.push(fieldOb);
5206
- lodash.remove(fields, {id: fieldOb.id});
5207
- }
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});
5208
4963
  }
5209
4964
  });
5210
4965
 
@@ -5845,7 +5600,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5845
5600
  return valToReturn;
5846
5601
  };
5847
5602
 
5848
-
5603
+
5849
5604
  highchartsRenderer.getChartAxisLabel = function(type) {
5850
5605
  return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
5851
5606
  };
@@ -6680,7 +6435,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6680
6435
  value_name: 'show',
6681
6436
  default_value: true,
6682
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',
6683
- disabled_fn: (value) => !value.show_out_of_x_axis
6438
+ disabled_fn: (value) => !value.show_out_of_x_axis
6684
6439
  && !value.show_out_of_data_series
6685
6440
  && !value.show_value
6686
6441
  && !value.show_x_axis
@@ -6721,8 +6476,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6721
6476
  element_label: '[X Axis]',
6722
6477
  value_name: 'show_x_axis',
6723
6478
  default_value: true,
6724
- clickFn: (value) => value.show = value.show
6725
- ? 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
6726
6481
  : value.show,
6727
6482
  },
6728
6483
  {
@@ -6730,8 +6485,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6730
6485
  element_label: '[Data Series]',
6731
6486
  value_name: 'show_data_series',
6732
6487
  default_value: true,
6733
- clickFn: (value) => value.show = value.show
6734
- ? 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
6735
6490
  : value.show,
6736
6491
  },
6737
6492
  {
@@ -6739,8 +6494,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6739
6494
  element_label: 'Value',
6740
6495
  value_name: 'show_value',
6741
6496
  default_value: true,
6742
- clickFn: (value) => value.show = value.show
6743
- ? 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
6744
6499
  : value.show,
6745
6500
  },
6746
6501
  {
@@ -6748,8 +6503,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6748
6503
  element_label: '% Out of [X Axis]',
6749
6504
  value_name: 'show_out_of_x_axis',
6750
6505
  default_value: false,
6751
- clickFn: (value) => value.show = value.show
6752
- ? 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
6753
6508
  : value.show,
6754
6509
  },
6755
6510
  {
@@ -6757,8 +6512,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6757
6512
  element_label: '% Out of [Data Series]',
6758
6513
  value_name: 'show_out_of_data_series',
6759
6514
  default_value: false,
6760
- clickFn: (value) => value.show = value.show
6761
- ? 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
6762
6517
  : value.show,
6763
6518
  },
6764
6519
  ]
@@ -6932,16 +6687,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6932
6687
  value_name: 'name',
6933
6688
  element_label: 'Name',
6934
6689
  default_value: '_Variance'
6935
- }, {
6936
- element_type: 'input',
6937
- value_name: 'formula',
6938
- element_label: 'Formula',
6939
- default_value: 'x2-x1'
6940
6690
  }, {
6941
6691
  element_type: 'input',
6942
- value_name: 'color',
6943
- element_label: 'Color',
6944
- 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: ''
6945
6700
  }, {
6946
6701
  element_type: 'radio',
6947
6702
  value_name: 'chart',
@@ -7064,17 +6819,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7064
6819
  axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
7065
6820
  legendTooltipTitle: 'Drag one field to further configure your x-axis.',
7066
6821
  legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
7067
- },
7068
- [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
7069
- name: 'Waterfall Walkthrough Chart ',
7070
- label: 'Waterfall Walkthrough Chart ',
7071
- title: 'TODO: add text',
7072
- description: 'TODO: add text',
7073
- axisName: 'Category',
7074
- startedMessage: 'TODO: add text',
7075
- axisTooltipTitle: 'TODO: add text',
7076
- legendTooltipTitle: 'TODO: add text',
7077
- },
6822
+ },
7078
6823
  'combo-chart': {
7079
6824
  name: 'Combo Chart ',
7080
6825
  label: 'Combo Chart ',
@@ -7730,24 +7475,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7730
7475
  highchartsRenderer.suboptions["legends"],
7731
7476
  ]
7732
7477
  },
7733
- {
7734
- type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
7735
- name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
7736
- class: 'google-visualization-charteditor-thumbs-columnchart',
7737
- render: highchartsRenderer.ptRenderWaterfallWalkthrough,
7738
- suboptions: [
7739
- highchartsRenderer.suboptions["axisX"],
7740
- highchartsRenderer.suboptions["tooltips"],
7741
- highchartsRenderer.suboptions["label"],
7742
- highchartsRenderer.suboptions["subtitle"],
7743
- highchartsRenderer.suboptions["widget_library"],
7744
- highchartsRenderer.suboptions["chart"],
7745
- highchartsRenderer.suboptions["negative_number_format"],
7746
- highchartsRenderer.suboptions["advanced"],
7747
- highchartsRenderer.suboptions["legends"],
7748
- ],
7749
- hidden: true,
7750
- },
7751
7478
  ]
7752
7479
  },
7753
7480
  ];
@@ -7904,7 +7631,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7904
7631
  _.forEach(Object.keys(dates), key => {
7905
7632
  const dateConfiguration = dates[key];
7906
7633
  const timestamp = dateConfiguration.timestamp;
7907
- if (timestamp) {
7634
+ if (timestamp) {
7908
7635
  const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
7909
7636
  dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
7910
7637
  .toLocaleDateString();
@@ -8200,10 +7927,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8200
7927
  };
8201
7928
 
8202
7929
  highchartsRenderer.createDateFromString = function (dateString, format) {
8203
- if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
7930
+ if ((format && !highchartsRenderer.isDateFormat(dateString, format)) || !highchartsRenderer.isDate(dateString)) {
8204
7931
  return null;
8205
7932
  }
8206
- const utcDate = format
7933
+ const utcDate = format
8207
7934
  ? moment_lib.utc(dateString, format, true)
8208
7935
  : moment_lib.utc(dateString);
8209
7936
  return utcDate.startOf('day').unix();
@@ -8221,7 +7948,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8221
7948
  }
8222
7949
 
8223
7950
  let filters = [];
8224
-
7951
+
8225
7952
  if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
8226
7953
  const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
8227
7954
  const labels = [];
@@ -8249,7 +7976,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8249
7976
  col_value,
8250
7977
  highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
8251
7978
  );
8252
-
7979
+
8253
7980
  if ($.isEmptyObject(datetrange)) {
8254
7981
  return;
8255
7982
  }
@@ -8354,7 +8081,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8354
8081
  filter.is_excluded = false;
8355
8082
  } else {
8356
8083
  filter = highchartsRenderer.createDrillDownFilterObject(widget, widget.cols[0], colKey[0]);
8357
- filters.push(filter);
8358
8084
  }
8359
8085
  filter.values = [];
8360
8086
  for (let i = 0; i < colKey.length; i++) {
@@ -8492,7 +8218,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8492
8218
  var data = res;
8493
8219
 
8494
8220
  lodash.forEach(datesFields, function (row) {
8495
- 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);
8496
8222
  });
8497
8223
 
8498
8224
  if (datesFields.length > 0) {
@@ -8898,14 +8624,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8898
8624
  return rightPosition;
8899
8625
  case 'none':
8900
8626
  return none;
8901
- }
8902
- } else if (isLine) {
8903
- return useNewUx ? leftPosition : rightPosition;
8904
- } else if (isPie) {
8905
- return useNewUx ? rightPosition : topPosition;
8906
8627
  }
8628
+ } else if (isLine) {
8629
+ return useNewUx ? leftPosition : rightPosition;
8630
+ } else if (isPie) {
8631
+ return useNewUx ? rightPosition : topPosition;
8632
+ }
8907
8633
 
8908
- return useNewUx ? topPosition : bottomPosition;
8634
+ return useNewUx ? topPosition : bottomPosition;
8909
8635
  }
8910
8636
 
8911
8637
  highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
@@ -8920,7 +8646,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8920
8646
  }
8921
8647
 
8922
8648
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
8923
- const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8649
+ const aggregationConfig = widget.options && widget.options.date_aggregation_configs
8924
8650
  ? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
8925
8651
  : null;
8926
8652