@datarailsshared/dr_renderer 1.2.214-dragons → 1.2.216-dragons
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 +1 -1
- package/src/highcharts_renderer.js +310 -52
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const SERIES_CLASSNAMES = {
|
|
2
2
|
WATERFALL_BREAKDOWN: 'waterfallBreakdown',
|
|
3
|
+
WATERFALL_WALKTHROUGH: 'waterfallWalkthrough',
|
|
3
4
|
TOTAL_SERIES: 'totalSeries',
|
|
4
5
|
TREND_SERIES: 'trendSeries',
|
|
5
6
|
};
|
|
@@ -25,6 +26,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
25
26
|
const textColor = "#151a41";
|
|
26
27
|
const chartLabelColor = "#cfd7dd";
|
|
27
28
|
const HIGHCHARTS_FONT_FAMILY = 'Poppins';
|
|
29
|
+
let firstBarColor = null;
|
|
28
30
|
|
|
29
31
|
if(!Highcharts){
|
|
30
32
|
Highcharts = {
|
|
@@ -82,6 +84,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
82
84
|
KPI_WIDGET: 'kpi-widget',
|
|
83
85
|
TEXT_WIDGET: 'text-widget',
|
|
84
86
|
WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
|
|
87
|
+
WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
|
|
85
88
|
PUBLISHED_ITEM: 'published_item',
|
|
86
89
|
RICH_TEXT: 'rich_text',
|
|
87
90
|
EXCEL_VIEWER: 'excel_viewer',
|
|
@@ -466,7 +469,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
466
469
|
highchartsRenderer.getOthersName(opts) :
|
|
467
470
|
undefined;
|
|
468
471
|
var drOthersInColumn = lodash.find(
|
|
469
|
-
pivotData.getColKeys(),
|
|
472
|
+
pivotData.getColKeys(),
|
|
470
473
|
keys => keys.length && (lodash.includes(keys, 'DR_Others') || lodash.includes(keys, othersName))
|
|
471
474
|
);
|
|
472
475
|
|
|
@@ -486,7 +489,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
486
489
|
rows = [];
|
|
487
490
|
}
|
|
488
491
|
|
|
489
|
-
var cols = this.key;
|
|
492
|
+
var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
|
|
490
493
|
if (typeof (cols) == 'object' && cols.name) {
|
|
491
494
|
cols = cols.name;
|
|
492
495
|
}
|
|
@@ -494,7 +497,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
494
497
|
if (!cols && is_drill_down_pie) {
|
|
495
498
|
cols = this.point.name;
|
|
496
499
|
}
|
|
497
|
-
|
|
500
|
+
|
|
498
501
|
if (drOthersInColumn) {
|
|
499
502
|
if (!lodash.isArray(cols) && othersName === cols) {
|
|
500
503
|
cols = ['DR_Others'];
|
|
@@ -632,7 +635,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
632
635
|
|| this.series.options.className === 'trendSeries') {
|
|
633
636
|
rows = [];
|
|
634
637
|
}
|
|
635
|
-
|
|
638
|
+
|
|
639
|
+
var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
|
|
636
640
|
if (!cols && is_drill_down_pie) {
|
|
637
641
|
cols = this.name;
|
|
638
642
|
}
|
|
@@ -655,7 +659,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
655
659
|
rows = temp;
|
|
656
660
|
}
|
|
657
661
|
|
|
658
|
-
var category_text = `<span style="font-weight: bold;"
|
|
662
|
+
var category_text = `<span style="font-weight: bold;">
|
|
663
|
+
${ lodash.get(this, 'point.options.colsForTotal') ? cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
|
|
664
|
+
</span>`;
|
|
659
665
|
if (this.category) {
|
|
660
666
|
category_text = '';
|
|
661
667
|
}
|
|
@@ -672,7 +678,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
672
678
|
const modifiedRowsAndCols = highchartsRenderer.transformRowsAndColsForBreakdown(rows, cols, this.point, opts);
|
|
673
679
|
rows = modifiedRowsAndCols.rows;
|
|
674
680
|
cols = modifiedRowsAndCols.cols;
|
|
675
|
-
}
|
|
681
|
+
}
|
|
676
682
|
|
|
677
683
|
var aggr = pivotData.getAggregator(rows, cols);
|
|
678
684
|
|
|
@@ -1388,6 +1394,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1388
1394
|
if (tmoobj.name) {
|
|
1389
1395
|
tmoobj.name = tmoobj.name.replace('DR_Others', highchartsRenderer.getOthersName(opts));
|
|
1390
1396
|
}
|
|
1397
|
+
|
|
1391
1398
|
if (lodash.isEmpty(String(tmoobj.name))) {
|
|
1392
1399
|
tmoobj.name = lodash.unescape(col_n_value);
|
|
1393
1400
|
tmoobj.visible = false;
|
|
@@ -1413,6 +1420,89 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1413
1420
|
return chart_series;
|
|
1414
1421
|
}
|
|
1415
1422
|
|
|
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
|
+
|
|
1416
1506
|
highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
|
|
1417
1507
|
const types = {
|
|
1418
1508
|
'line-chart': 'line',
|
|
@@ -1616,7 +1706,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1616
1706
|
highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
|
|
1617
1707
|
let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
|
|
1618
1708
|
|
|
1619
|
-
if (!result.dataLabels) return {};
|
|
1709
|
+
if (!result.dataLabels) return {};
|
|
1620
1710
|
return {
|
|
1621
1711
|
activeDataLabelStyle: {
|
|
1622
1712
|
color: result.dataLabels.color,
|
|
@@ -3172,7 +3262,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3172
3262
|
|
|
3173
3263
|
highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
|
|
3174
3264
|
let chartOptions = {};
|
|
3175
|
-
const additionOptions = opts.chartOptions
|
|
3265
|
+
const additionOptions = opts.chartOptions
|
|
3176
3266
|
? opts.chartOptions
|
|
3177
3267
|
: highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
|
|
3178
3268
|
|
|
@@ -3271,6 +3361,122 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3271
3361
|
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
|
3272
3362
|
};
|
|
3273
3363
|
|
|
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
|
+
|
|
3274
3480
|
highchartsRenderer.formatFieldValue = function (field, value) {
|
|
3275
3481
|
let currentType = '';
|
|
3276
3482
|
let format = field.format;
|
|
@@ -4339,6 +4545,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4339
4545
|
}
|
|
4340
4546
|
};
|
|
4341
4547
|
|
|
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
|
+
|
|
4342
4559
|
highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
|
|
4343
4560
|
if (!rowData || !rowData) {
|
|
4344
4561
|
if (options.onlyOptions) {
|
|
@@ -4347,10 +4564,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4347
4564
|
return null;
|
|
4348
4565
|
}
|
|
4349
4566
|
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
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;
|
|
4354
4576
|
const uniqueCategories = lodash.filter(
|
|
4355
4577
|
lodash.uniq(
|
|
4356
4578
|
lodash.map(rowData, row => row[widget.cols[0].name])
|
|
@@ -4360,6 +4582,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4360
4582
|
|
|
4361
4583
|
if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
|
|
4362
4584
|
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. `;
|
|
4363
4587
|
options.error_params = {
|
|
4364
4588
|
title: 'Data Conflict',
|
|
4365
4589
|
text: `Please adjust your dashboard's reference date and filter selections as \
|
|
@@ -4608,19 +4832,25 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4608
4832
|
return highchartsRenderer.getWeekNumber(dateObj);
|
|
4609
4833
|
};
|
|
4610
4834
|
|
|
4611
|
-
highchartsRenderer.
|
|
4612
|
-
let
|
|
4835
|
+
highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
|
|
4836
|
+
let vals_not_convert = [];
|
|
4613
4837
|
if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
|
|
4614
4838
|
let delta_options = currentgraph.options.chartOptions.delta_column;
|
|
4615
4839
|
if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
|
|
4616
4840
|
currentgraph.rows[0].name == field_name) {
|
|
4617
|
-
|
|
4841
|
+
vals_not_convert = [delta_options.name];
|
|
4618
4842
|
} else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
|
|
4619
4843
|
currentgraph.cols[0].name == field_name) {
|
|
4620
|
-
|
|
4844
|
+
vals_not_convert = [delta_options.name];
|
|
4621
4845
|
}
|
|
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
|
+
});
|
|
4622
4852
|
}
|
|
4623
|
-
return
|
|
4853
|
+
return vals_not_convert;
|
|
4624
4854
|
};
|
|
4625
4855
|
|
|
4626
4856
|
highchartsRenderer.updateFiltersShowNames = function (filters) {
|
|
@@ -4640,8 +4870,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4640
4870
|
})
|
|
4641
4871
|
};
|
|
4642
4872
|
|
|
4643
|
-
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name,
|
|
4644
|
-
if (
|
|
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)) {
|
|
4645
4875
|
return value;
|
|
4646
4876
|
}
|
|
4647
4877
|
|
|
@@ -5615,7 +5845,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5615
5845
|
return valToReturn;
|
|
5616
5846
|
};
|
|
5617
5847
|
|
|
5618
|
-
|
|
5848
|
+
|
|
5619
5849
|
highchartsRenderer.getChartAxisLabel = function(type) {
|
|
5620
5850
|
return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
|
|
5621
5851
|
};
|
|
@@ -6450,7 +6680,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6450
6680
|
value_name: 'show',
|
|
6451
6681
|
default_value: true,
|
|
6452
6682
|
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',
|
|
6453
|
-
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6683
|
+
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6454
6684
|
&& !value.show_out_of_data_series
|
|
6455
6685
|
&& !value.show_value
|
|
6456
6686
|
&& !value.show_x_axis
|
|
@@ -6491,8 +6721,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6491
6721
|
element_label: '[X Axis]',
|
|
6492
6722
|
value_name: 'show_x_axis',
|
|
6493
6723
|
default_value: true,
|
|
6494
|
-
clickFn: (value) => value.show = value.show
|
|
6495
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
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
|
|
6496
6726
|
: value.show,
|
|
6497
6727
|
},
|
|
6498
6728
|
{
|
|
@@ -6500,8 +6730,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6500
6730
|
element_label: '[Data Series]',
|
|
6501
6731
|
value_name: 'show_data_series',
|
|
6502
6732
|
default_value: true,
|
|
6503
|
-
clickFn: (value) => value.show = value.show
|
|
6504
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
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
|
|
6505
6735
|
: value.show,
|
|
6506
6736
|
},
|
|
6507
6737
|
{
|
|
@@ -6509,8 +6739,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6509
6739
|
element_label: 'Value',
|
|
6510
6740
|
value_name: 'show_value',
|
|
6511
6741
|
default_value: true,
|
|
6512
|
-
clickFn: (value) => value.show = value.show
|
|
6513
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
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
|
|
6514
6744
|
: value.show,
|
|
6515
6745
|
},
|
|
6516
6746
|
{
|
|
@@ -6518,8 +6748,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6518
6748
|
element_label: '% Out of [X Axis]',
|
|
6519
6749
|
value_name: 'show_out_of_x_axis',
|
|
6520
6750
|
default_value: false,
|
|
6521
|
-
clickFn: (value) => value.show = value.show
|
|
6522
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
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
|
|
6523
6753
|
: value.show,
|
|
6524
6754
|
},
|
|
6525
6755
|
{
|
|
@@ -6527,8 +6757,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6527
6757
|
element_label: '% Out of [Data Series]',
|
|
6528
6758
|
value_name: 'show_out_of_data_series',
|
|
6529
6759
|
default_value: false,
|
|
6530
|
-
clickFn: (value) => value.show = value.show
|
|
6531
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
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
|
|
6532
6762
|
: value.show,
|
|
6533
6763
|
},
|
|
6534
6764
|
]
|
|
@@ -6702,16 +6932,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6702
6932
|
value_name: 'name',
|
|
6703
6933
|
element_label: 'Name',
|
|
6704
6934
|
default_value: '_Variance'
|
|
6705
|
-
}, {
|
|
6706
|
-
element_type: 'input',
|
|
6707
|
-
value_name: 'formula',
|
|
6708
|
-
element_label: 'Formula',
|
|
6709
|
-
default_value: 'x2-x1'
|
|
6710
6935
|
}, {
|
|
6711
6936
|
element_type: 'input',
|
|
6712
|
-
value_name: '
|
|
6713
|
-
element_label: '
|
|
6714
|
-
default_value: ''
|
|
6937
|
+
value_name: 'formula',
|
|
6938
|
+
element_label: 'Formula',
|
|
6939
|
+
default_value: 'x2-x1'
|
|
6940
|
+
}, {
|
|
6941
|
+
element_type: 'input',
|
|
6942
|
+
value_name: 'color',
|
|
6943
|
+
element_label: 'Color',
|
|
6944
|
+
default_value: ''
|
|
6715
6945
|
}, {
|
|
6716
6946
|
element_type: 'radio',
|
|
6717
6947
|
value_name: 'chart',
|
|
@@ -6834,7 +7064,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6834
7064
|
axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
|
|
6835
7065
|
legendTooltipTitle: 'Drag one field to further configure your x-axis.',
|
|
6836
7066
|
legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
|
|
6837
|
-
},
|
|
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
|
+
},
|
|
6838
7078
|
'combo-chart': {
|
|
6839
7079
|
name: 'Combo Chart ',
|
|
6840
7080
|
label: 'Combo Chart ',
|
|
@@ -7490,6 +7730,24 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7490
7730
|
highchartsRenderer.suboptions["legends"],
|
|
7491
7731
|
]
|
|
7492
7732
|
},
|
|
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
|
+
},
|
|
7493
7751
|
]
|
|
7494
7752
|
},
|
|
7495
7753
|
];
|
|
@@ -7646,7 +7904,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7646
7904
|
_.forEach(Object.keys(dates), key => {
|
|
7647
7905
|
const dateConfiguration = dates[key];
|
|
7648
7906
|
const timestamp = dateConfiguration.timestamp;
|
|
7649
|
-
if (timestamp) {
|
|
7907
|
+
if (timestamp) {
|
|
7650
7908
|
const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
|
|
7651
7909
|
dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
|
|
7652
7910
|
.toLocaleDateString();
|
|
@@ -7945,7 +8203,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7945
8203
|
if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
|
|
7946
8204
|
return null;
|
|
7947
8205
|
}
|
|
7948
|
-
const utcDate = format
|
|
8206
|
+
const utcDate = format
|
|
7949
8207
|
? moment_lib.utc(dateString, format, true)
|
|
7950
8208
|
: moment_lib.utc(dateString);
|
|
7951
8209
|
return utcDate.startOf('day').unix();
|
|
@@ -7963,7 +8221,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7963
8221
|
}
|
|
7964
8222
|
|
|
7965
8223
|
let filters = [];
|
|
7966
|
-
|
|
8224
|
+
|
|
7967
8225
|
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
|
7968
8226
|
const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
|
|
7969
8227
|
const labels = [];
|
|
@@ -7991,7 +8249,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7991
8249
|
col_value,
|
|
7992
8250
|
highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
|
|
7993
8251
|
);
|
|
7994
|
-
|
|
8252
|
+
|
|
7995
8253
|
if ($.isEmptyObject(datetrange)) {
|
|
7996
8254
|
return;
|
|
7997
8255
|
}
|
|
@@ -8234,7 +8492,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8234
8492
|
var data = res;
|
|
8235
8493
|
|
|
8236
8494
|
lodash.forEach(datesFields, function (row) {
|
|
8237
|
-
row.val_not_convert = highchartsRenderer.
|
|
8495
|
+
row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
|
|
8238
8496
|
});
|
|
8239
8497
|
|
|
8240
8498
|
if (datesFields.length > 0) {
|
|
@@ -8640,14 +8898,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8640
8898
|
return rightPosition;
|
|
8641
8899
|
case 'none':
|
|
8642
8900
|
return none;
|
|
8901
|
+
}
|
|
8902
|
+
} else if (isLine) {
|
|
8903
|
+
return useNewUx ? leftPosition : rightPosition;
|
|
8904
|
+
} else if (isPie) {
|
|
8905
|
+
return useNewUx ? rightPosition : topPosition;
|
|
8643
8906
|
}
|
|
8644
|
-
} else if (isLine) {
|
|
8645
|
-
return useNewUx ? leftPosition : rightPosition;
|
|
8646
|
-
} else if (isPie) {
|
|
8647
|
-
return useNewUx ? rightPosition : topPosition;
|
|
8648
|
-
}
|
|
8649
8907
|
|
|
8650
|
-
|
|
8908
|
+
return useNewUx ? topPosition : bottomPosition;
|
|
8651
8909
|
}
|
|
8652
8910
|
|
|
8653
8911
|
highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
|
|
@@ -8662,7 +8920,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8662
8920
|
}
|
|
8663
8921
|
|
|
8664
8922
|
highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
|
|
8665
|
-
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8923
|
+
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8666
8924
|
? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
|
|
8667
8925
|
: null;
|
|
8668
8926
|
|