@datarailsshared/dr_renderer 1.2.223 → 1.2.225-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 +312 -54
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'];
|
|
@@ -619,7 +622,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
619
622
|
|
|
620
623
|
var func = function () {
|
|
621
624
|
const isWaterfallBreakdown = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_BREAKDOWN;
|
|
622
|
-
|
|
625
|
+
const isWaterfallWalkthrough = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH;
|
|
623
626
|
var y = parseFloat(this.y);
|
|
624
627
|
if (pivotData) {
|
|
625
628
|
let series_name = (this.series.name || '') + "";
|
|
@@ -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
|
}
|
|
@@ -647,7 +651,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
647
651
|
if (variant_name && rows && rows[0] && variant_name == rows[0]) {
|
|
648
652
|
rows[0] = variant_name_default_name;
|
|
649
653
|
}
|
|
650
|
-
|
|
654
|
+
if (isWaterfallWalkthrough) {
|
|
655
|
+
cols = [this.key]
|
|
656
|
+
}
|
|
651
657
|
try {
|
|
652
658
|
if (is_drill_down_pie && !highchartsRenderer.selfStartsWith(series_name,"Series ")) {
|
|
653
659
|
let temp = cols;
|
|
@@ -655,7 +661,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
655
661
|
rows = temp;
|
|
656
662
|
}
|
|
657
663
|
|
|
658
|
-
var category_text = `<span style="font-weight: bold;"
|
|
664
|
+
var category_text = `<span style="font-weight: bold;">
|
|
665
|
+
${ lodash.get(this, 'point.options.colsForTotal') ? cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
|
|
666
|
+
</span>`;
|
|
659
667
|
if (this.category) {
|
|
660
668
|
category_text = '';
|
|
661
669
|
}
|
|
@@ -672,7 +680,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
672
680
|
const modifiedRowsAndCols = highchartsRenderer.transformRowsAndColsForBreakdown(rows, cols, this.point, opts);
|
|
673
681
|
rows = modifiedRowsAndCols.rows;
|
|
674
682
|
cols = modifiedRowsAndCols.cols;
|
|
675
|
-
}
|
|
683
|
+
}
|
|
676
684
|
|
|
677
685
|
var aggr = pivotData.getAggregator(rows, cols);
|
|
678
686
|
|
|
@@ -1414,6 +1422,89 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1414
1422
|
return chart_series;
|
|
1415
1423
|
}
|
|
1416
1424
|
|
|
1425
|
+
highchartsRenderer.ptCreateWaterfallWalkthroughSeries = function (pivotData, onlyNumbers, additionOptions, opts) {
|
|
1426
|
+
const waterfallOptions = opts.walkthrough_options;
|
|
1427
|
+
const chart_series = [];
|
|
1428
|
+
let resultObject = {
|
|
1429
|
+
data: [],
|
|
1430
|
+
dataLabels: {
|
|
1431
|
+
allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
|
|
1432
|
+
enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
|
|
1433
|
+
formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, {'chartOptions': additionOptions, total_value_options: opts.total_value_options}),
|
|
1434
|
+
style: highchartsRenderer.getDataLabelsStyle(additionOptions),
|
|
1435
|
+
},
|
|
1436
|
+
upColor: waterfallOptions.colors.increase,
|
|
1437
|
+
color: waterfallOptions.colors.decrease,
|
|
1438
|
+
className: SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH
|
|
1439
|
+
};
|
|
1440
|
+
resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
|
|
1441
|
+
lodash.forEach(waterfallOptions.values.walkthrough, function(value, index) {
|
|
1442
|
+
|
|
1443
|
+
let keys = [];
|
|
1444
|
+
if (value.trend === 'total') {
|
|
1445
|
+
keys = ['Total'];
|
|
1446
|
+
} else {
|
|
1447
|
+
_.forEach(value.key, (item) => {
|
|
1448
|
+
const findKeyByValue = Object.keys(pivotData.dateValuesDictionary || {}).find(key => pivotData.dateValuesDictionary[key] === item);
|
|
1449
|
+
keys.push(findKeyByValue ? findKeyByValue : item);
|
|
1450
|
+
})
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
const agg = pivotData.getAggregator([], keys);
|
|
1454
|
+
let val = agg.value();
|
|
1455
|
+
|
|
1456
|
+
if (val != null && $.isNumeric(val)) {
|
|
1457
|
+
val = parseFloat(val);
|
|
1458
|
+
} else if (onlyNumbers) {
|
|
1459
|
+
val = NaN;
|
|
1460
|
+
} else {
|
|
1461
|
+
val = 0;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
if (value.trend === 'decrease') {
|
|
1465
|
+
val = val * -1;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
const name = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
|
|
1469
|
+
let color = '';
|
|
1470
|
+
if (value.trend !== 'total') {
|
|
1471
|
+
if (index === 0 && !firstBarColor) {
|
|
1472
|
+
color = waterfallOptions.colors.total;
|
|
1473
|
+
firstBarColor = waterfallOptions.colors.total;
|
|
1474
|
+
} else {
|
|
1475
|
+
color = value.color
|
|
1476
|
+
}
|
|
1477
|
+
} else {
|
|
1478
|
+
color = waterfallOptions.colors.total;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
resultObject.data.push({
|
|
1482
|
+
y: val,
|
|
1483
|
+
name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
|
|
1484
|
+
isSum: value.trend === 'total',
|
|
1485
|
+
isTotal: value.trend === 'total',
|
|
1486
|
+
color,
|
|
1487
|
+
colsForTotal: value.trend === 'total' ? keys : null,
|
|
1488
|
+
});
|
|
1489
|
+
});
|
|
1490
|
+
chart_series.push(resultObject);
|
|
1491
|
+
chart_series.push(
|
|
1492
|
+
{
|
|
1493
|
+
name: 'Increase',
|
|
1494
|
+
visible: false,
|
|
1495
|
+
color: waterfallOptions.colors.increase
|
|
1496
|
+
});
|
|
1497
|
+
|
|
1498
|
+
chart_series.push(
|
|
1499
|
+
{
|
|
1500
|
+
name: 'Decrease',
|
|
1501
|
+
visible: false,
|
|
1502
|
+
color: waterfallOptions.colors.decrease
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
return chart_series;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1417
1508
|
highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
|
|
1418
1509
|
const types = {
|
|
1419
1510
|
'line-chart': 'line',
|
|
@@ -1617,7 +1708,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1617
1708
|
highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
|
|
1618
1709
|
let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
|
|
1619
1710
|
|
|
1620
|
-
if (!result.dataLabels) return {};
|
|
1711
|
+
if (!result.dataLabels) return {};
|
|
1621
1712
|
return {
|
|
1622
1713
|
activeDataLabelStyle: {
|
|
1623
1714
|
color: result.dataLabels.color,
|
|
@@ -3173,7 +3264,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3173
3264
|
|
|
3174
3265
|
highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
|
|
3175
3266
|
let chartOptions = {};
|
|
3176
|
-
const additionOptions = opts.chartOptions
|
|
3267
|
+
const additionOptions = opts.chartOptions
|
|
3177
3268
|
? opts.chartOptions
|
|
3178
3269
|
: highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
|
|
3179
3270
|
|
|
@@ -3272,6 +3363,121 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3272
3363
|
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
|
3273
3364
|
};
|
|
3274
3365
|
|
|
3366
|
+
highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
|
|
3367
|
+
let chartOptions = {};
|
|
3368
|
+
const waterfallOptions = opts?.walkthrough_options;
|
|
3369
|
+
const additionOptions = opts.chartOptions
|
|
3370
|
+
? opts.chartOptions
|
|
3371
|
+
: highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
|
|
3372
|
+
|
|
3373
|
+
chartOptions.chart = {
|
|
3374
|
+
type: 'waterfall',
|
|
3375
|
+
zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
|
|
3376
|
+
};
|
|
3377
|
+
if (disableAnimation) {
|
|
3378
|
+
chartOptions.chart.animation = false;
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
chartOptions.xAxis = {
|
|
3382
|
+
type: 'category',
|
|
3383
|
+
crosshair: true,
|
|
3384
|
+
min: 0,
|
|
3385
|
+
title: {
|
|
3386
|
+
text : additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
|
3387
|
+
},
|
|
3388
|
+
uniqueNames: false,
|
|
3389
|
+
};
|
|
3390
|
+
|
|
3391
|
+
highchartsRenderer.setTitleAndSubTitle(chartOptions, opts, additionOptions);
|
|
3392
|
+
|
|
3393
|
+
chartOptions.yAxis = {
|
|
3394
|
+
min: null,
|
|
3395
|
+
max: null,
|
|
3396
|
+
title: {
|
|
3397
|
+
text: additionOptions && additionOptions.axisY ? additionOptions.axisY.name : '',
|
|
3398
|
+
autoylabel: additionOptions && additionOptions.axisY ? additionOptions.axisY.autoylabel : ''
|
|
3399
|
+
},
|
|
3400
|
+
labels: {
|
|
3401
|
+
formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
|
|
3402
|
+
},
|
|
3403
|
+
};
|
|
3404
|
+
if (additionOptions) {
|
|
3405
|
+
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3408
|
+
chartOptions.tooltip = {
|
|
3409
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
|
3410
|
+
valueDecimals: 2,
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
highchartsRenderer.handleGridLines(additionOptions, chartOptions);
|
|
3414
|
+
|
|
3415
|
+
if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
|
|
3416
|
+
const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
|
|
3417
|
+
chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
|
|
3418
|
+
} else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
|
|
3419
|
+
chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
|
|
3420
|
+
}
|
|
3421
|
+
chartOptions.series = highchartsRenderer
|
|
3422
|
+
.ptCreateWaterfallWalkthroughSeries(pivotData, null, additionOptions, opts);
|
|
3423
|
+
|
|
3424
|
+
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
|
3425
|
+
chartOptions.plotOptions = {
|
|
3426
|
+
waterfall: {
|
|
3427
|
+
pointPadding: 0.2,
|
|
3428
|
+
borderWidth: 0,
|
|
3429
|
+
borderRadius: 1,
|
|
3430
|
+
lineWidth: 0,
|
|
3431
|
+
},
|
|
3432
|
+
series: {
|
|
3433
|
+
animation: !disableAnimation,
|
|
3434
|
+
cropThreshold: 1000,
|
|
3435
|
+
dataLabels: {
|
|
3436
|
+
allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
|
|
3437
|
+
enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
|
|
3438
|
+
formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
|
|
3439
|
+
style: highchartsRenderer.getDataLabelsStyle(additionOptions),
|
|
3440
|
+
inside: false
|
|
3441
|
+
},
|
|
3442
|
+
events: {
|
|
3443
|
+
legendItemClick: () => {
|
|
3444
|
+
return false;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
};
|
|
3449
|
+
|
|
3450
|
+
if (opts.drillDownListFunc) {
|
|
3451
|
+
chartOptions.plotOptions.series.cursor = 'pointer';
|
|
3452
|
+
chartOptions.plotOptions.series.point = {
|
|
3453
|
+
events: {
|
|
3454
|
+
click: opts.drillDownListFunc
|
|
3455
|
+
}
|
|
3456
|
+
};
|
|
3457
|
+
}
|
|
3458
|
+
if (waterfallOptions.colors) {
|
|
3459
|
+
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
|
3460
|
+
chartOptions.legend.useHTML = true;
|
|
3461
|
+
chartOptions.legend.labelFormatter = function() {
|
|
3462
|
+
const name = this.options.className ? 'Total': this.name;
|
|
3463
|
+
const findTotal = _.find(this.options.data, {isTotal: true});
|
|
3464
|
+
const color = findTotal?.color ? findTotal.color : this.color;
|
|
3465
|
+
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>';
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
chartOptions.legend.symbolPadding = 0;
|
|
3469
|
+
chartOptions.legend.symbolWidth = 0;
|
|
3470
|
+
chartOptions.legend.symbolHeight = 0;
|
|
3471
|
+
chartOptions.legend.squareSymbol = false;
|
|
3472
|
+
} else {
|
|
3473
|
+
chartOptions.legend = {
|
|
3474
|
+
enabled: false
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3275
3481
|
highchartsRenderer.formatFieldValue = function (field, value) {
|
|
3276
3482
|
let currentType = '';
|
|
3277
3483
|
let format = field.format;
|
|
@@ -4340,6 +4546,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4340
4546
|
}
|
|
4341
4547
|
};
|
|
4342
4548
|
|
|
4549
|
+
highchartsRenderer.waterfallConstants = {
|
|
4550
|
+
[highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
|
|
4551
|
+
minCategoriesCount: 2,
|
|
4552
|
+
maxCategoriesCount: 5,
|
|
4553
|
+
},
|
|
4554
|
+
[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
|
4555
|
+
minCategoriesCount: 2,
|
|
4556
|
+
maxCategoriesCount: 10,
|
|
4557
|
+
}
|
|
4558
|
+
};
|
|
4559
|
+
|
|
4343
4560
|
highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
|
|
4344
4561
|
if (!rowData || !rowData) {
|
|
4345
4562
|
if (options.onlyOptions) {
|
|
@@ -4348,10 +4565,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4348
4565
|
return null;
|
|
4349
4566
|
}
|
|
4350
4567
|
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4568
|
+
const isWaterfall = widget
|
|
4569
|
+
&& (
|
|
4570
|
+
widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN
|
|
4571
|
+
|| widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH
|
|
4572
|
+
);
|
|
4573
|
+
|
|
4574
|
+
if (isWaterfall) {
|
|
4575
|
+
const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
|
|
4576
|
+
const minCategories = highchartsRenderer.waterfallConstants[widget.chart_type].minCategoriesCount;
|
|
4355
4577
|
const uniqueCategories = lodash.filter(
|
|
4356
4578
|
lodash.uniq(
|
|
4357
4579
|
lodash.map(rowData, row => row[widget.cols[0].name])
|
|
@@ -4361,6 +4583,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4361
4583
|
|
|
4362
4584
|
if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
|
|
4363
4585
|
options.error_has_occurred = true;
|
|
4586
|
+
const isDateField = widget.cols[0].type === 'Date';
|
|
4587
|
+
const commonMessagePart = `This chart support a selection of ${minCategories}-${maxCategories} items from the category section. `;
|
|
4364
4588
|
options.error_params = {
|
|
4365
4589
|
title: 'Data Conflict',
|
|
4366
4590
|
text: `Please adjust your dashboard's reference date and filter selections as \
|
|
@@ -4609,19 +4833,25 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4609
4833
|
return highchartsRenderer.getWeekNumber(dateObj);
|
|
4610
4834
|
};
|
|
4611
4835
|
|
|
4612
|
-
highchartsRenderer.
|
|
4613
|
-
let
|
|
4836
|
+
highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
|
|
4837
|
+
let vals_not_convert = [];
|
|
4614
4838
|
if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
|
|
4615
4839
|
let delta_options = currentgraph.options.chartOptions.delta_column;
|
|
4616
4840
|
if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
|
|
4617
4841
|
currentgraph.rows[0].name == field_name) {
|
|
4618
|
-
|
|
4842
|
+
vals_not_convert = [delta_options.name];
|
|
4619
4843
|
} else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
|
|
4620
4844
|
currentgraph.cols[0].name == field_name) {
|
|
4621
|
-
|
|
4845
|
+
vals_not_convert = [delta_options.name];
|
|
4622
4846
|
}
|
|
4847
|
+
} else if (currentgraph.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
|
|
4848
|
+
lodash.forEach(currentgraph.options.walkthrough_options.values.walkthrough, value => {
|
|
4849
|
+
if (value.trend === 'total') {
|
|
4850
|
+
vals_not_convert.push(value.key[0]);
|
|
4851
|
+
}
|
|
4852
|
+
});
|
|
4623
4853
|
}
|
|
4624
|
-
return
|
|
4854
|
+
return vals_not_convert;
|
|
4625
4855
|
};
|
|
4626
4856
|
|
|
4627
4857
|
highchartsRenderer.updateFiltersShowNames = function (filters) {
|
|
@@ -4641,8 +4871,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4641
4871
|
})
|
|
4642
4872
|
};
|
|
4643
4873
|
|
|
4644
|
-
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name,
|
|
4645
|
-
if (
|
|
4874
|
+
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
|
|
4875
|
+
if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
|
|
4646
4876
|
return value;
|
|
4647
4877
|
}
|
|
4648
4878
|
|
|
@@ -5665,7 +5895,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5665
5895
|
return valToReturn;
|
|
5666
5896
|
};
|
|
5667
5897
|
|
|
5668
|
-
|
|
5898
|
+
|
|
5669
5899
|
highchartsRenderer.getChartAxisLabel = function(type) {
|
|
5670
5900
|
return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
|
|
5671
5901
|
};
|
|
@@ -6500,7 +6730,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6500
6730
|
value_name: 'show',
|
|
6501
6731
|
default_value: true,
|
|
6502
6732
|
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',
|
|
6503
|
-
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6733
|
+
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6504
6734
|
&& !value.show_out_of_data_series
|
|
6505
6735
|
&& !value.show_value
|
|
6506
6736
|
&& !value.show_x_axis
|
|
@@ -6541,8 +6771,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6541
6771
|
element_label: '[X Axis]',
|
|
6542
6772
|
value_name: 'show_x_axis',
|
|
6543
6773
|
default_value: true,
|
|
6544
|
-
clickFn: (value) => value.show = value.show
|
|
6545
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6774
|
+
clickFn: (value) => value.show = value.show
|
|
6775
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6546
6776
|
: value.show,
|
|
6547
6777
|
},
|
|
6548
6778
|
{
|
|
@@ -6550,8 +6780,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6550
6780
|
element_label: '[Data Series]',
|
|
6551
6781
|
value_name: 'show_data_series',
|
|
6552
6782
|
default_value: true,
|
|
6553
|
-
clickFn: (value) => value.show = value.show
|
|
6554
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6783
|
+
clickFn: (value) => value.show = value.show
|
|
6784
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6555
6785
|
: value.show,
|
|
6556
6786
|
},
|
|
6557
6787
|
{
|
|
@@ -6559,8 +6789,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6559
6789
|
element_label: 'Value',
|
|
6560
6790
|
value_name: 'show_value',
|
|
6561
6791
|
default_value: true,
|
|
6562
|
-
clickFn: (value) => value.show = value.show
|
|
6563
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6792
|
+
clickFn: (value) => value.show = value.show
|
|
6793
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6564
6794
|
: value.show,
|
|
6565
6795
|
},
|
|
6566
6796
|
{
|
|
@@ -6568,8 +6798,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6568
6798
|
element_label: '% Out of [X Axis]',
|
|
6569
6799
|
value_name: 'show_out_of_x_axis',
|
|
6570
6800
|
default_value: false,
|
|
6571
|
-
clickFn: (value) => value.show = value.show
|
|
6572
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6801
|
+
clickFn: (value) => value.show = value.show
|
|
6802
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6573
6803
|
: value.show,
|
|
6574
6804
|
},
|
|
6575
6805
|
{
|
|
@@ -6577,8 +6807,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6577
6807
|
element_label: '% Out of [Data Series]',
|
|
6578
6808
|
value_name: 'show_out_of_data_series',
|
|
6579
6809
|
default_value: false,
|
|
6580
|
-
clickFn: (value) => value.show = value.show
|
|
6581
|
-
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6810
|
+
clickFn: (value) => value.show = value.show
|
|
6811
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6582
6812
|
: value.show,
|
|
6583
6813
|
},
|
|
6584
6814
|
]
|
|
@@ -6752,16 +6982,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6752
6982
|
value_name: 'name',
|
|
6753
6983
|
element_label: 'Name',
|
|
6754
6984
|
default_value: '_Variance'
|
|
6755
|
-
}, {
|
|
6756
|
-
element_type: 'input',
|
|
6757
|
-
value_name: 'formula',
|
|
6758
|
-
element_label: 'Formula',
|
|
6759
|
-
default_value: 'x2-x1'
|
|
6760
6985
|
}, {
|
|
6761
6986
|
element_type: 'input',
|
|
6762
|
-
value_name: '
|
|
6763
|
-
element_label: '
|
|
6764
|
-
default_value: ''
|
|
6987
|
+
value_name: 'formula',
|
|
6988
|
+
element_label: 'Formula',
|
|
6989
|
+
default_value: 'x2-x1'
|
|
6990
|
+
}, {
|
|
6991
|
+
element_type: 'input',
|
|
6992
|
+
value_name: 'color',
|
|
6993
|
+
element_label: 'Color',
|
|
6994
|
+
default_value: ''
|
|
6765
6995
|
}, {
|
|
6766
6996
|
element_type: 'radio',
|
|
6767
6997
|
value_name: 'chart',
|
|
@@ -6884,7 +7114,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6884
7114
|
axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
|
|
6885
7115
|
legendTooltipTitle: 'Drag one field to further configure your x-axis.',
|
|
6886
7116
|
legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
|
|
6887
|
-
},
|
|
7117
|
+
},
|
|
7118
|
+
[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
|
7119
|
+
name: 'Waterfall Walkthrough Chart ',
|
|
7120
|
+
label: 'Waterfall Walkthrough Chart ',
|
|
7121
|
+
title: 'TODO: add text',
|
|
7122
|
+
description: 'TODO: add text',
|
|
7123
|
+
axisName: 'Category',
|
|
7124
|
+
startedMessage: 'TODO: add text',
|
|
7125
|
+
axisTooltipTitle: 'TODO: add text',
|
|
7126
|
+
legendTooltipTitle: 'TODO: add text',
|
|
7127
|
+
},
|
|
6888
7128
|
'combo-chart': {
|
|
6889
7129
|
name: 'Combo Chart ',
|
|
6890
7130
|
label: 'Combo Chart ',
|
|
@@ -7540,6 +7780,24 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7540
7780
|
highchartsRenderer.suboptions["legends"],
|
|
7541
7781
|
]
|
|
7542
7782
|
},
|
|
7783
|
+
{
|
|
7784
|
+
type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
|
|
7785
|
+
name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
|
|
7786
|
+
class: 'google-visualization-charteditor-thumbs-columnchart',
|
|
7787
|
+
render: highchartsRenderer.ptRenderWaterfallWalkthrough,
|
|
7788
|
+
suboptions: [
|
|
7789
|
+
highchartsRenderer.suboptions["axisX"],
|
|
7790
|
+
highchartsRenderer.suboptions["tooltips"],
|
|
7791
|
+
highchartsRenderer.suboptions["label"],
|
|
7792
|
+
highchartsRenderer.suboptions["subtitle"],
|
|
7793
|
+
highchartsRenderer.suboptions["widget_library"],
|
|
7794
|
+
highchartsRenderer.suboptions["chart"],
|
|
7795
|
+
highchartsRenderer.suboptions["negative_number_format"],
|
|
7796
|
+
highchartsRenderer.suboptions["advanced"],
|
|
7797
|
+
highchartsRenderer.suboptions["legends"],
|
|
7798
|
+
],
|
|
7799
|
+
hidden: true,
|
|
7800
|
+
},
|
|
7543
7801
|
]
|
|
7544
7802
|
},
|
|
7545
7803
|
];
|
|
@@ -7696,7 +7954,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7696
7954
|
_.forEach(Object.keys(dates), key => {
|
|
7697
7955
|
const dateConfiguration = dates[key];
|
|
7698
7956
|
const timestamp = dateConfiguration.timestamp;
|
|
7699
|
-
if (timestamp) {
|
|
7957
|
+
if (timestamp) {
|
|
7700
7958
|
const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
|
|
7701
7959
|
dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
|
|
7702
7960
|
.toLocaleDateString();
|
|
@@ -7995,7 +8253,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7995
8253
|
if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
|
|
7996
8254
|
return null;
|
|
7997
8255
|
}
|
|
7998
|
-
const utcDate = format
|
|
8256
|
+
const utcDate = format
|
|
7999
8257
|
? moment_lib.utc(dateString, format, true)
|
|
8000
8258
|
: moment_lib.utc(dateString);
|
|
8001
8259
|
return utcDate.startOf('day').unix();
|
|
@@ -8013,7 +8271,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8013
8271
|
}
|
|
8014
8272
|
|
|
8015
8273
|
let filters = [];
|
|
8016
|
-
|
|
8274
|
+
|
|
8017
8275
|
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
|
8018
8276
|
const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
|
|
8019
8277
|
const labels = [];
|
|
@@ -8041,7 +8299,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8041
8299
|
col_value,
|
|
8042
8300
|
highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
|
|
8043
8301
|
);
|
|
8044
|
-
|
|
8302
|
+
|
|
8045
8303
|
if ($.isEmptyObject(datetrange)) {
|
|
8046
8304
|
return;
|
|
8047
8305
|
}
|
|
@@ -8284,7 +8542,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8284
8542
|
var data = res;
|
|
8285
8543
|
|
|
8286
8544
|
lodash.forEach(datesFields, function (row) {
|
|
8287
|
-
row.val_not_convert = highchartsRenderer.
|
|
8545
|
+
row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
|
|
8288
8546
|
});
|
|
8289
8547
|
|
|
8290
8548
|
if (datesFields.length > 0) {
|
|
@@ -8690,14 +8948,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8690
8948
|
return rightPosition;
|
|
8691
8949
|
case 'none':
|
|
8692
8950
|
return none;
|
|
8951
|
+
}
|
|
8952
|
+
} else if (isLine) {
|
|
8953
|
+
return useNewUx ? leftPosition : rightPosition;
|
|
8954
|
+
} else if (isPie) {
|
|
8955
|
+
return useNewUx ? rightPosition : topPosition;
|
|
8693
8956
|
}
|
|
8694
|
-
} else if (isLine) {
|
|
8695
|
-
return useNewUx ? leftPosition : rightPosition;
|
|
8696
|
-
} else if (isPie) {
|
|
8697
|
-
return useNewUx ? rightPosition : topPosition;
|
|
8698
|
-
}
|
|
8699
8957
|
|
|
8700
|
-
|
|
8958
|
+
return useNewUx ? topPosition : bottomPosition;
|
|
8701
8959
|
}
|
|
8702
8960
|
|
|
8703
8961
|
highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
|
|
@@ -8712,7 +8970,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8712
8970
|
}
|
|
8713
8971
|
|
|
8714
8972
|
highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
|
|
8715
|
-
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8973
|
+
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8716
8974
|
? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
|
|
8717
8975
|
: null;
|
|
8718
8976
|
|