@datarailsshared/dr_renderer 1.2.214-dragons → 1.2.215-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 +306 -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,85 @@ 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
|
+
const name = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
|
|
1463
|
+
let color = '';
|
|
1464
|
+
if (value.trend !== 'total') {
|
|
1465
|
+
if (index === 0 && !firstBarColor) {
|
|
1466
|
+
color = waterfallOptions.colors.total;
|
|
1467
|
+
firstBarColor = waterfallOptions.colors.total;
|
|
1468
|
+
} else {
|
|
1469
|
+
color = value.color
|
|
1470
|
+
}
|
|
1471
|
+
} else {
|
|
1472
|
+
color = waterfallOptions.colors.total;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
resultObject.data.push({
|
|
1476
|
+
y: val,
|
|
1477
|
+
name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
|
|
1478
|
+
isSum: value.trend === 'total',
|
|
1479
|
+
isTotal: value.trend === 'total',
|
|
1480
|
+
color,
|
|
1481
|
+
colsForTotal: value.trend === 'total' ? keys : null,
|
|
1482
|
+
});
|
|
1483
|
+
});
|
|
1484
|
+
chart_series.push(resultObject);
|
|
1485
|
+
chart_series.push(
|
|
1486
|
+
{
|
|
1487
|
+
name: 'Increase',
|
|
1488
|
+
visible: false,
|
|
1489
|
+
color: waterfallOptions.colors.increase
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
chart_series.push(
|
|
1493
|
+
{
|
|
1494
|
+
name: 'Decrease',
|
|
1495
|
+
visible: false,
|
|
1496
|
+
color: waterfallOptions.colors.decrease
|
|
1497
|
+
});
|
|
1498
|
+
|
|
1499
|
+
return chart_series;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1416
1502
|
highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
|
|
1417
1503
|
const types = {
|
|
1418
1504
|
'line-chart': 'line',
|
|
@@ -1616,7 +1702,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1616
1702
|
highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
|
|
1617
1703
|
let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
|
|
1618
1704
|
|
|
1619
|
-
if (!result.dataLabels) return {};
|
|
1705
|
+
if (!result.dataLabels) return {};
|
|
1620
1706
|
return {
|
|
1621
1707
|
activeDataLabelStyle: {
|
|
1622
1708
|
color: result.dataLabels.color,
|
|
@@ -3172,7 +3258,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3172
3258
|
|
|
3173
3259
|
highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
|
|
3174
3260
|
let chartOptions = {};
|
|
3175
|
-
const additionOptions = opts.chartOptions
|
|
3261
|
+
const additionOptions = opts.chartOptions
|
|
3176
3262
|
? opts.chartOptions
|
|
3177
3263
|
: highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
|
|
3178
3264
|
|
|
@@ -3271,6 +3357,122 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3271
3357
|
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
|
3272
3358
|
};
|
|
3273
3359
|
|
|
3360
|
+
highchartsRenderer.ptRenderWaterfallWalkthrough = function (pivotData, opts) {
|
|
3361
|
+
let chartOptions = {};
|
|
3362
|
+
const waterfallOptions = opts?.walkthrough_options;
|
|
3363
|
+
const additionOptions = opts.chartOptions
|
|
3364
|
+
? opts.chartOptions
|
|
3365
|
+
: highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH);
|
|
3366
|
+
|
|
3367
|
+
chartOptions.chart = {
|
|
3368
|
+
type: 'waterfall',
|
|
3369
|
+
zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
|
|
3370
|
+
};
|
|
3371
|
+
if (disableAnimation) {
|
|
3372
|
+
chartOptions.chart.animation = false;
|
|
3373
|
+
}
|
|
3374
|
+
const walkthroughFieldIsNotSet = lodash.some(pivotData.getRowKeys(), rowKey => !rowKey || lodash.isArray(rowKey) && !rowKey.length);
|
|
3375
|
+
|
|
3376
|
+
chartOptions.xAxis = {
|
|
3377
|
+
type: 'category',
|
|
3378
|
+
crosshair: true,
|
|
3379
|
+
min: 0,
|
|
3380
|
+
title: {
|
|
3381
|
+
text : additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
|
3382
|
+
},
|
|
3383
|
+
uniqueNames: walkthroughFieldIsNotSet,
|
|
3384
|
+
};
|
|
3385
|
+
|
|
3386
|
+
highchartsRenderer.setTitleAndSubTitle(chartOptions, opts, additionOptions);
|
|
3387
|
+
|
|
3388
|
+
chartOptions.yAxis = {
|
|
3389
|
+
min: null,
|
|
3390
|
+
max: null,
|
|
3391
|
+
title: {
|
|
3392
|
+
text: additionOptions && additionOptions.axisY ? additionOptions.axisY.name : '',
|
|
3393
|
+
autoylabel: additionOptions && additionOptions.axisY ? additionOptions.axisY.autoylabel : ''
|
|
3394
|
+
},
|
|
3395
|
+
labels: {
|
|
3396
|
+
formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
|
|
3397
|
+
},
|
|
3398
|
+
};
|
|
3399
|
+
if (additionOptions) {
|
|
3400
|
+
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
chartOptions.tooltip = {
|
|
3404
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
|
3405
|
+
valueDecimals: 2,
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3408
|
+
highchartsRenderer.handleGridLines(additionOptions, chartOptions);
|
|
3409
|
+
|
|
3410
|
+
if (lodash.get(opts, 'paletteOptions.widgetPalette', null)) {
|
|
3411
|
+
const mc_palette = lodash.find(lodash.get(opts.paletteOptions, 'monochromePalettes', []), { selected: true });
|
|
3412
|
+
chartOptions.colors = mc_palette ? mc_palette.colors : opts.paletteOptions.widgetPalette;
|
|
3413
|
+
} else if (lodash.get(opts, 'paletteOptions.dashboardPalette.colors', null)) {
|
|
3414
|
+
chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
|
|
3415
|
+
}
|
|
3416
|
+
chartOptions.series = highchartsRenderer
|
|
3417
|
+
.ptCreateWaterfallWalkthroughSeries(pivotData, null, additionOptions, opts);
|
|
3418
|
+
|
|
3419
|
+
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
|
3420
|
+
chartOptions.plotOptions = {
|
|
3421
|
+
waterfall: {
|
|
3422
|
+
pointPadding: 0.2,
|
|
3423
|
+
borderWidth: 0,
|
|
3424
|
+
borderRadius: 1,
|
|
3425
|
+
lineWidth: 0,
|
|
3426
|
+
},
|
|
3427
|
+
series: {
|
|
3428
|
+
animation: !disableAnimation,
|
|
3429
|
+
cropThreshold: 1000,
|
|
3430
|
+
dataLabels: {
|
|
3431
|
+
allowOverlap: additionOptions && additionOptions.label ? additionOptions.label.overlap : false,
|
|
3432
|
+
enabled: additionOptions && additionOptions.label ? additionOptions.label.show : true,
|
|
3433
|
+
formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
|
|
3434
|
+
style: highchartsRenderer.getDataLabelsStyle(additionOptions),
|
|
3435
|
+
inside: false
|
|
3436
|
+
},
|
|
3437
|
+
events: {
|
|
3438
|
+
legendItemClick: () => {
|
|
3439
|
+
return false;
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
};
|
|
3444
|
+
|
|
3445
|
+
if (opts.drillDownListFunc) {
|
|
3446
|
+
chartOptions.plotOptions.series.cursor = 'pointer';
|
|
3447
|
+
chartOptions.plotOptions.series.point = {
|
|
3448
|
+
events: {
|
|
3449
|
+
click: opts.drillDownListFunc
|
|
3450
|
+
}
|
|
3451
|
+
};
|
|
3452
|
+
}
|
|
3453
|
+
if (waterfallOptions.colors) {
|
|
3454
|
+
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
|
3455
|
+
chartOptions.legend.useHTML = true;
|
|
3456
|
+
chartOptions.legend.labelFormatter = function() {
|
|
3457
|
+
const name = this.options.className ? 'Total': this.name;
|
|
3458
|
+
const findTotal = _.find(this.options.data, {isTotal: true});
|
|
3459
|
+
const color = findTotal?.color ? findTotal.color : this.color;
|
|
3460
|
+
return '<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: '+ color + '; width: 12px; height: 12px; border-radius: 50%"></span><span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">' + name + '</span>';
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
chartOptions.legend.symbolPadding = 0;
|
|
3464
|
+
chartOptions.legend.symbolWidth = 0;
|
|
3465
|
+
chartOptions.legend.symbolHeight = 0;
|
|
3466
|
+
chartOptions.legend.squareSymbol = false;
|
|
3467
|
+
} else {
|
|
3468
|
+
chartOptions.legend = {
|
|
3469
|
+
enabled: false
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3274
3476
|
highchartsRenderer.formatFieldValue = function (field, value) {
|
|
3275
3477
|
let currentType = '';
|
|
3276
3478
|
let format = field.format;
|
|
@@ -4339,6 +4541,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4339
4541
|
}
|
|
4340
4542
|
};
|
|
4341
4543
|
|
|
4544
|
+
highchartsRenderer.waterfallConstants = {
|
|
4545
|
+
[highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
|
|
4546
|
+
minCategoriesCount: 2,
|
|
4547
|
+
maxCategoriesCount: 5,
|
|
4548
|
+
},
|
|
4549
|
+
[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
|
4550
|
+
minCategoriesCount: 2,
|
|
4551
|
+
maxCategoriesCount: 10,
|
|
4552
|
+
}
|
|
4553
|
+
};
|
|
4554
|
+
|
|
4342
4555
|
highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
|
|
4343
4556
|
if (!rowData || !rowData) {
|
|
4344
4557
|
if (options.onlyOptions) {
|
|
@@ -4347,10 +4560,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4347
4560
|
return null;
|
|
4348
4561
|
}
|
|
4349
4562
|
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4563
|
+
const isWaterfall = widget
|
|
4564
|
+
&& (
|
|
4565
|
+
widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN
|
|
4566
|
+
|| widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH
|
|
4567
|
+
);
|
|
4568
|
+
|
|
4569
|
+
if (isWaterfall) {
|
|
4570
|
+
const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
|
|
4571
|
+
const minCategories = highchartsRenderer.waterfallConstants[widget.chart_type].minCategoriesCount;
|
|
4354
4572
|
const uniqueCategories = lodash.filter(
|
|
4355
4573
|
lodash.uniq(
|
|
4356
4574
|
lodash.map(rowData, row => row[widget.cols[0].name])
|
|
@@ -4360,6 +4578,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4360
4578
|
|
|
4361
4579
|
if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
|
|
4362
4580
|
options.error_has_occurred = true;
|
|
4581
|
+
const isDateField = widget.cols[0].type === 'Date';
|
|
4582
|
+
const commonMessagePart = `This chart support a selection of ${minCategories}-${maxCategories} items from the category section. `;
|
|
4363
4583
|
options.error_params = {
|
|
4364
4584
|
title: 'Data Conflict',
|
|
4365
4585
|
text: `Please adjust your dashboard's reference date and filter selections as \
|
|
@@ -4608,19 +4828,25 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4608
4828
|
return highchartsRenderer.getWeekNumber(dateObj);
|
|
4609
4829
|
};
|
|
4610
4830
|
|
|
4611
|
-
highchartsRenderer.
|
|
4612
|
-
let
|
|
4831
|
+
highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
|
|
4832
|
+
let vals_not_convert = [];
|
|
4613
4833
|
if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
|
|
4614
4834
|
let delta_options = currentgraph.options.chartOptions.delta_column;
|
|
4615
4835
|
if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
|
|
4616
4836
|
currentgraph.rows[0].name == field_name) {
|
|
4617
|
-
|
|
4837
|
+
vals_not_convert = [delta_options.name];
|
|
4618
4838
|
} else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
|
|
4619
4839
|
currentgraph.cols[0].name == field_name) {
|
|
4620
|
-
|
|
4840
|
+
vals_not_convert = [delta_options.name];
|
|
4621
4841
|
}
|
|
4842
|
+
} else if (currentgraph.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
|
|
4843
|
+
lodash.forEach(currentgraph.options.walkthrough_options.values.walkthrough, value => {
|
|
4844
|
+
if (value.trend === 'total') {
|
|
4845
|
+
vals_not_convert.push(value.key[0]);
|
|
4846
|
+
}
|
|
4847
|
+
});
|
|
4622
4848
|
}
|
|
4623
|
-
return
|
|
4849
|
+
return vals_not_convert;
|
|
4624
4850
|
};
|
|
4625
4851
|
|
|
4626
4852
|
highchartsRenderer.updateFiltersShowNames = function (filters) {
|
|
@@ -4640,8 +4866,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4640
4866
|
})
|
|
4641
4867
|
};
|
|
4642
4868
|
|
|
4643
|
-
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name,
|
|
4644
|
-
if (
|
|
4869
|
+
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
|
|
4870
|
+
if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
|
|
4645
4871
|
return value;
|
|
4646
4872
|
}
|
|
4647
4873
|
|
|
@@ -5615,7 +5841,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5615
5841
|
return valToReturn;
|
|
5616
5842
|
};
|
|
5617
5843
|
|
|
5618
|
-
|
|
5844
|
+
|
|
5619
5845
|
highchartsRenderer.getChartAxisLabel = function(type) {
|
|
5620
5846
|
return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
|
|
5621
5847
|
};
|
|
@@ -6450,7 +6676,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6450
6676
|
value_name: 'show',
|
|
6451
6677
|
default_value: true,
|
|
6452
6678
|
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
|
|
6679
|
+
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6454
6680
|
&& !value.show_out_of_data_series
|
|
6455
6681
|
&& !value.show_value
|
|
6456
6682
|
&& !value.show_x_axis
|
|
@@ -6491,8 +6717,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6491
6717
|
element_label: '[X Axis]',
|
|
6492
6718
|
value_name: 'show_x_axis',
|
|
6493
6719
|
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
|
|
6720
|
+
clickFn: (value) => value.show = value.show
|
|
6721
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6496
6722
|
: value.show,
|
|
6497
6723
|
},
|
|
6498
6724
|
{
|
|
@@ -6500,8 +6726,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6500
6726
|
element_label: '[Data Series]',
|
|
6501
6727
|
value_name: 'show_data_series',
|
|
6502
6728
|
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
|
|
6729
|
+
clickFn: (value) => value.show = value.show
|
|
6730
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6505
6731
|
: value.show,
|
|
6506
6732
|
},
|
|
6507
6733
|
{
|
|
@@ -6509,8 +6735,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6509
6735
|
element_label: 'Value',
|
|
6510
6736
|
value_name: 'show_value',
|
|
6511
6737
|
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
|
|
6738
|
+
clickFn: (value) => value.show = value.show
|
|
6739
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6514
6740
|
: value.show,
|
|
6515
6741
|
},
|
|
6516
6742
|
{
|
|
@@ -6518,8 +6744,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6518
6744
|
element_label: '% Out of [X Axis]',
|
|
6519
6745
|
value_name: 'show_out_of_x_axis',
|
|
6520
6746
|
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
|
|
6747
|
+
clickFn: (value) => value.show = value.show
|
|
6748
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6523
6749
|
: value.show,
|
|
6524
6750
|
},
|
|
6525
6751
|
{
|
|
@@ -6527,8 +6753,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6527
6753
|
element_label: '% Out of [Data Series]',
|
|
6528
6754
|
value_name: 'show_out_of_data_series',
|
|
6529
6755
|
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
|
|
6756
|
+
clickFn: (value) => value.show = value.show
|
|
6757
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6532
6758
|
: value.show,
|
|
6533
6759
|
},
|
|
6534
6760
|
]
|
|
@@ -6702,16 +6928,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6702
6928
|
value_name: 'name',
|
|
6703
6929
|
element_label: 'Name',
|
|
6704
6930
|
default_value: '_Variance'
|
|
6705
|
-
}, {
|
|
6706
|
-
element_type: 'input',
|
|
6707
|
-
value_name: 'formula',
|
|
6708
|
-
element_label: 'Formula',
|
|
6709
|
-
default_value: 'x2-x1'
|
|
6710
6931
|
}, {
|
|
6711
6932
|
element_type: 'input',
|
|
6712
|
-
value_name: '
|
|
6713
|
-
element_label: '
|
|
6714
|
-
default_value: ''
|
|
6933
|
+
value_name: 'formula',
|
|
6934
|
+
element_label: 'Formula',
|
|
6935
|
+
default_value: 'x2-x1'
|
|
6936
|
+
}, {
|
|
6937
|
+
element_type: 'input',
|
|
6938
|
+
value_name: 'color',
|
|
6939
|
+
element_label: 'Color',
|
|
6940
|
+
default_value: ''
|
|
6715
6941
|
}, {
|
|
6716
6942
|
element_type: 'radio',
|
|
6717
6943
|
value_name: 'chart',
|
|
@@ -6834,7 +7060,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6834
7060
|
axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
|
|
6835
7061
|
legendTooltipTitle: 'Drag one field to further configure your x-axis.',
|
|
6836
7062
|
legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
|
|
6837
|
-
},
|
|
7063
|
+
},
|
|
7064
|
+
[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
|
7065
|
+
name: 'Waterfall Walkthrough Chart ',
|
|
7066
|
+
label: 'Waterfall Walkthrough Chart ',
|
|
7067
|
+
title: 'TODO: add text',
|
|
7068
|
+
description: 'TODO: add text',
|
|
7069
|
+
axisName: 'Category',
|
|
7070
|
+
startedMessage: 'TODO: add text',
|
|
7071
|
+
axisTooltipTitle: 'TODO: add text',
|
|
7072
|
+
legendTooltipTitle: 'TODO: add text',
|
|
7073
|
+
},
|
|
6838
7074
|
'combo-chart': {
|
|
6839
7075
|
name: 'Combo Chart ',
|
|
6840
7076
|
label: 'Combo Chart ',
|
|
@@ -7490,6 +7726,24 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7490
7726
|
highchartsRenderer.suboptions["legends"],
|
|
7491
7727
|
]
|
|
7492
7728
|
},
|
|
7729
|
+
{
|
|
7730
|
+
type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
|
|
7731
|
+
name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
|
|
7732
|
+
class: 'google-visualization-charteditor-thumbs-columnchart',
|
|
7733
|
+
render: highchartsRenderer.ptRenderWaterfallWalkthrough,
|
|
7734
|
+
suboptions: [
|
|
7735
|
+
highchartsRenderer.suboptions["axisX"],
|
|
7736
|
+
highchartsRenderer.suboptions["tooltips"],
|
|
7737
|
+
highchartsRenderer.suboptions["label"],
|
|
7738
|
+
highchartsRenderer.suboptions["subtitle"],
|
|
7739
|
+
highchartsRenderer.suboptions["widget_library"],
|
|
7740
|
+
highchartsRenderer.suboptions["chart"],
|
|
7741
|
+
highchartsRenderer.suboptions["negative_number_format"],
|
|
7742
|
+
highchartsRenderer.suboptions["advanced"],
|
|
7743
|
+
highchartsRenderer.suboptions["legends"],
|
|
7744
|
+
],
|
|
7745
|
+
hidden: true,
|
|
7746
|
+
},
|
|
7493
7747
|
]
|
|
7494
7748
|
},
|
|
7495
7749
|
];
|
|
@@ -7646,7 +7900,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7646
7900
|
_.forEach(Object.keys(dates), key => {
|
|
7647
7901
|
const dateConfiguration = dates[key];
|
|
7648
7902
|
const timestamp = dateConfiguration.timestamp;
|
|
7649
|
-
if (timestamp) {
|
|
7903
|
+
if (timestamp) {
|
|
7650
7904
|
const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
|
|
7651
7905
|
dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
|
|
7652
7906
|
.toLocaleDateString();
|
|
@@ -7945,7 +8199,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7945
8199
|
if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
|
|
7946
8200
|
return null;
|
|
7947
8201
|
}
|
|
7948
|
-
const utcDate = format
|
|
8202
|
+
const utcDate = format
|
|
7949
8203
|
? moment_lib.utc(dateString, format, true)
|
|
7950
8204
|
: moment_lib.utc(dateString);
|
|
7951
8205
|
return utcDate.startOf('day').unix();
|
|
@@ -7963,7 +8217,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7963
8217
|
}
|
|
7964
8218
|
|
|
7965
8219
|
let filters = [];
|
|
7966
|
-
|
|
8220
|
+
|
|
7967
8221
|
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
|
7968
8222
|
const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
|
|
7969
8223
|
const labels = [];
|
|
@@ -7991,7 +8245,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7991
8245
|
col_value,
|
|
7992
8246
|
highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
|
|
7993
8247
|
);
|
|
7994
|
-
|
|
8248
|
+
|
|
7995
8249
|
if ($.isEmptyObject(datetrange)) {
|
|
7996
8250
|
return;
|
|
7997
8251
|
}
|
|
@@ -8234,7 +8488,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8234
8488
|
var data = res;
|
|
8235
8489
|
|
|
8236
8490
|
lodash.forEach(datesFields, function (row) {
|
|
8237
|
-
row.val_not_convert = highchartsRenderer.
|
|
8491
|
+
row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
|
|
8238
8492
|
});
|
|
8239
8493
|
|
|
8240
8494
|
if (datesFields.length > 0) {
|
|
@@ -8640,14 +8894,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8640
8894
|
return rightPosition;
|
|
8641
8895
|
case 'none':
|
|
8642
8896
|
return none;
|
|
8897
|
+
}
|
|
8898
|
+
} else if (isLine) {
|
|
8899
|
+
return useNewUx ? leftPosition : rightPosition;
|
|
8900
|
+
} else if (isPie) {
|
|
8901
|
+
return useNewUx ? rightPosition : topPosition;
|
|
8643
8902
|
}
|
|
8644
|
-
} else if (isLine) {
|
|
8645
|
-
return useNewUx ? leftPosition : rightPosition;
|
|
8646
|
-
} else if (isPie) {
|
|
8647
|
-
return useNewUx ? rightPosition : topPosition;
|
|
8648
|
-
}
|
|
8649
8903
|
|
|
8650
|
-
|
|
8904
|
+
return useNewUx ? topPosition : bottomPosition;
|
|
8651
8905
|
}
|
|
8652
8906
|
|
|
8653
8907
|
highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
|
|
@@ -8662,7 +8916,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8662
8916
|
}
|
|
8663
8917
|
|
|
8664
8918
|
highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
|
|
8665
|
-
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8919
|
+
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8666
8920
|
? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
|
|
8667
8921
|
: null;
|
|
8668
8922
|
|