@datarailsshared/dr_renderer 1.2.226-dragons → 1.2.227
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 +65 -325
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const SERIES_CLASSNAMES = {
|
|
2
2
|
WATERFALL_BREAKDOWN: 'waterfallBreakdown',
|
|
3
|
-
WATERFALL_WALKTHROUGH: 'waterfallWalkthrough',
|
|
4
3
|
TOTAL_SERIES: 'totalSeries',
|
|
5
4
|
TREND_SERIES: 'trendSeries',
|
|
6
5
|
};
|
|
@@ -26,7 +25,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
26
25
|
const textColor = "#151a41";
|
|
27
26
|
const chartLabelColor = "#cfd7dd";
|
|
28
27
|
const HIGHCHARTS_FONT_FAMILY = 'Poppins';
|
|
29
|
-
let firstBarColor = null;
|
|
30
28
|
|
|
31
29
|
if(!Highcharts){
|
|
32
30
|
Highcharts = {
|
|
@@ -84,7 +82,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
84
82
|
KPI_WIDGET: 'kpi-widget',
|
|
85
83
|
TEXT_WIDGET: 'text-widget',
|
|
86
84
|
WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
|
|
87
|
-
WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
|
|
88
85
|
PUBLISHED_ITEM: 'published_item',
|
|
89
86
|
RICH_TEXT: 'rich_text',
|
|
90
87
|
EXCEL_VIEWER: 'excel_viewer',
|
|
@@ -469,7 +466,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
469
466
|
highchartsRenderer.getOthersName(opts) :
|
|
470
467
|
undefined;
|
|
471
468
|
var drOthersInColumn = lodash.find(
|
|
472
|
-
pivotData.getColKeys(),
|
|
469
|
+
pivotData.getColKeys(),
|
|
473
470
|
keys => keys.length && (lodash.includes(keys, 'DR_Others') || lodash.includes(keys, othersName))
|
|
474
471
|
);
|
|
475
472
|
|
|
@@ -489,7 +486,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
489
486
|
rows = [];
|
|
490
487
|
}
|
|
491
488
|
|
|
492
|
-
var cols =
|
|
489
|
+
var cols = this.key;
|
|
493
490
|
if (typeof (cols) == 'object' && cols.name) {
|
|
494
491
|
cols = cols.name;
|
|
495
492
|
}
|
|
@@ -497,7 +494,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
497
494
|
if (!cols && is_drill_down_pie) {
|
|
498
495
|
cols = this.point.name;
|
|
499
496
|
}
|
|
500
|
-
|
|
497
|
+
|
|
501
498
|
if (drOthersInColumn) {
|
|
502
499
|
if (!lodash.isArray(cols) && othersName === cols) {
|
|
503
500
|
cols = ['DR_Others'];
|
|
@@ -622,7 +619,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
622
619
|
|
|
623
620
|
var func = function () {
|
|
624
621
|
const isWaterfallBreakdown = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_BREAKDOWN;
|
|
625
|
-
|
|
622
|
+
|
|
626
623
|
var y = parseFloat(this.y);
|
|
627
624
|
if (pivotData) {
|
|
628
625
|
let series_name = (this.series.name || '') + "";
|
|
@@ -635,8 +632,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
635
632
|
|| this.series.options.className === 'trendSeries') {
|
|
636
633
|
rows = [];
|
|
637
634
|
}
|
|
638
|
-
|
|
639
|
-
var cols = lodash.get(this, 'point.options.colsForTotal') || this.key;
|
|
635
|
+
var cols = this.key;
|
|
640
636
|
if (!cols && is_drill_down_pie) {
|
|
641
637
|
cols = this.name;
|
|
642
638
|
}
|
|
@@ -651,9 +647,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
651
647
|
if (variant_name && rows && rows[0] && variant_name == rows[0]) {
|
|
652
648
|
rows[0] = variant_name_default_name;
|
|
653
649
|
}
|
|
654
|
-
|
|
655
|
-
cols = [this.key]
|
|
656
|
-
}
|
|
650
|
+
|
|
657
651
|
try {
|
|
658
652
|
if (is_drill_down_pie && !highchartsRenderer.selfStartsWith(series_name,"Series ")) {
|
|
659
653
|
let temp = cols;
|
|
@@ -661,9 +655,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
661
655
|
rows = temp;
|
|
662
656
|
}
|
|
663
657
|
|
|
664
|
-
var category_text = `<span style="font-weight: bold;"
|
|
665
|
-
${ lodash.get(this, 'point.options.colsForTotal') ? cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
|
|
666
|
-
</span>`;
|
|
658
|
+
var category_text = `<span style="font-weight: bold;">${ cols }${ isWaterfallBreakdown ? ': ' : ' ' }</span>`;
|
|
667
659
|
if (this.category) {
|
|
668
660
|
category_text = '';
|
|
669
661
|
}
|
|
@@ -680,7 +672,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
680
672
|
const modifiedRowsAndCols = highchartsRenderer.transformRowsAndColsForBreakdown(rows, cols, this.point, opts);
|
|
681
673
|
rows = modifiedRowsAndCols.rows;
|
|
682
674
|
cols = modifiedRowsAndCols.cols;
|
|
683
|
-
}
|
|
675
|
+
}
|
|
684
676
|
|
|
685
677
|
var aggr = pivotData.getAggregator(rows, cols);
|
|
686
678
|
|
|
@@ -1422,89 +1414,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1422
1414
|
return chart_series;
|
|
1423
1415
|
}
|
|
1424
1416
|
|
|
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: 'Positive',
|
|
1494
|
-
visible: false,
|
|
1495
|
-
color: waterfallOptions.colors.increase
|
|
1496
|
-
});
|
|
1497
|
-
|
|
1498
|
-
chart_series.push(
|
|
1499
|
-
{
|
|
1500
|
-
name: 'Negative',
|
|
1501
|
-
visible: false,
|
|
1502
|
-
color: waterfallOptions.colors.decrease
|
|
1503
|
-
});
|
|
1504
|
-
|
|
1505
|
-
return chart_series;
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
1417
|
highchartsRenderer.setChartTypeBySeriesType = function (type, series) {
|
|
1509
1418
|
const types = {
|
|
1510
1419
|
'line-chart': 'line',
|
|
@@ -1708,7 +1617,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1708
1617
|
highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
|
|
1709
1618
|
let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
|
|
1710
1619
|
|
|
1711
|
-
if (!result.dataLabels) return {};
|
|
1620
|
+
if (!result.dataLabels) return {};
|
|
1712
1621
|
return {
|
|
1713
1622
|
activeDataLabelStyle: {
|
|
1714
1623
|
color: result.dataLabels.color,
|
|
@@ -3264,7 +3173,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3264
3173
|
|
|
3265
3174
|
highchartsRenderer.ptRenderWaterfallBreakdown = function (pivotData, opts, drilldownFunc, chartType) {
|
|
3266
3175
|
let chartOptions = {};
|
|
3267
|
-
const additionOptions = opts.chartOptions
|
|
3176
|
+
const additionOptions = opts.chartOptions
|
|
3268
3177
|
? opts.chartOptions
|
|
3269
3178
|
: highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
|
|
3270
3179
|
|
|
@@ -3363,121 +3272,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3363
3272
|
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
|
3364
3273
|
};
|
|
3365
3274
|
|
|
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
|
-
|
|
3481
3275
|
highchartsRenderer.formatFieldValue = function (field, value) {
|
|
3482
3276
|
let currentType = '';
|
|
3483
3277
|
let format = field.format;
|
|
@@ -4546,17 +4340,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4546
4340
|
}
|
|
4547
4341
|
};
|
|
4548
4342
|
|
|
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
|
-
|
|
4560
4343
|
highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
|
|
4561
4344
|
if (!rowData || !rowData) {
|
|
4562
4345
|
if (options.onlyOptions) {
|
|
@@ -4565,15 +4348,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4565
4348
|
return null;
|
|
4566
4349
|
}
|
|
4567
4350
|
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
);
|
|
4573
|
-
|
|
4574
|
-
if (isWaterfall) {
|
|
4575
|
-
const maxCategories = highchartsRenderer.waterfallConstants[widget.chart_type].maxCategoriesCount;
|
|
4576
|
-
const minCategories = highchartsRenderer.waterfallConstants[widget.chart_type].minCategoriesCount;
|
|
4351
|
+
if (widget && widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
|
4352
|
+
const breakdownSettings = widget.options.breakdown_options.settings;
|
|
4353
|
+
const maxCategories = breakdownSettings.maxCategoriesCount;
|
|
4354
|
+
const minCategories = breakdownSettings.minCategoriesCount;
|
|
4577
4355
|
const uniqueCategories = lodash.filter(
|
|
4578
4356
|
lodash.uniq(
|
|
4579
4357
|
lodash.map(rowData, row => row[widget.cols[0].name])
|
|
@@ -4583,8 +4361,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4583
4361
|
|
|
4584
4362
|
if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
|
|
4585
4363
|
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. `;
|
|
4588
4364
|
options.error_params = {
|
|
4589
4365
|
title: 'Data Conflict',
|
|
4590
4366
|
text: `Please adjust your dashboard's reference date and filter selections as \
|
|
@@ -4833,25 +4609,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4833
4609
|
return highchartsRenderer.getWeekNumber(dateObj);
|
|
4834
4610
|
};
|
|
4835
4611
|
|
|
4836
|
-
highchartsRenderer.
|
|
4837
|
-
let
|
|
4612
|
+
highchartsRenderer.check_value_not_for_convert = function (currentgraph, field_name) {
|
|
4613
|
+
let val_not_convert = null;
|
|
4838
4614
|
if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
|
|
4839
4615
|
let delta_options = currentgraph.options.chartOptions.delta_column;
|
|
4840
4616
|
if (delta_options.field == 'series' && currentgraph.rows && currentgraph.rows[0] &&
|
|
4841
4617
|
currentgraph.rows[0].name == field_name) {
|
|
4842
|
-
|
|
4618
|
+
val_not_convert = delta_options.name;
|
|
4843
4619
|
} else if (delta_options.field == 'category' && currentgraph.rows && currentgraph.cols[0] &&
|
|
4844
4620
|
currentgraph.cols[0].name == field_name) {
|
|
4845
|
-
|
|
4621
|
+
val_not_convert = delta_options.name;
|
|
4846
4622
|
}
|
|
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
|
-
});
|
|
4853
4623
|
}
|
|
4854
|
-
return
|
|
4624
|
+
return val_not_convert;
|
|
4855
4625
|
};
|
|
4856
4626
|
|
|
4857
4627
|
highchartsRenderer.updateFiltersShowNames = function (filters) {
|
|
@@ -4871,8 +4641,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4871
4641
|
})
|
|
4872
4642
|
};
|
|
4873
4643
|
|
|
4874
|
-
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name,
|
|
4875
|
-
if (
|
|
4644
|
+
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, val_not_for_convert) {
|
|
4645
|
+
if (val_not_for_convert && val_not_for_convert == value) {
|
|
4876
4646
|
return value;
|
|
4877
4647
|
}
|
|
4878
4648
|
|
|
@@ -5359,20 +5129,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5359
5129
|
|
|
5360
5130
|
lodash.forEach(filters, function (filterObj) {
|
|
5361
5131
|
fieldOb = lodash.find(fields, { id: filterObj.id });
|
|
5362
|
-
if (fieldOb
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
if (fieldOb && filterObj.values && filterObj.values instanceof Array) {
|
|
5370
|
-
if (filterObj.is_excluded === true) {
|
|
5371
|
-
fieldOb.excludes = filterObj.values;
|
|
5372
|
-
} else {
|
|
5373
|
-
fieldOb.includes = filterObj.values;
|
|
5374
|
-
}
|
|
5132
|
+
if (!fieldOb) return;
|
|
5133
|
+
|
|
5134
|
+
filterObj.values = filterObj.values && lodash.map(filterObj.values, highchartsRenderer.decodeFunc);
|
|
5135
|
+
filterObj.includes = filterObj.includes && lodash.map(filterObj.includes, highchartsRenderer.decodeFunc);
|
|
5136
|
+
|
|
5137
|
+
if (lodash.get(filterObj, 'values.datetype') === 'list') {
|
|
5138
|
+
filterObj.values = lodash.map(filterObj.values.val, highchartsRenderer.decodeFunc);
|
|
5375
5139
|
}
|
|
5140
|
+
|
|
5141
|
+
fieldOb.includes = filterObj.includes;
|
|
5142
|
+
fieldOb.values = filterObj.values;
|
|
5143
|
+
|
|
5376
5144
|
if (filterObj.allow_nulls && fieldOb) {
|
|
5377
5145
|
fieldOb.allow_nulls = filterObj.allow_nulls;
|
|
5378
5146
|
}
|
|
@@ -5895,7 +5663,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5895
5663
|
return valToReturn;
|
|
5896
5664
|
};
|
|
5897
5665
|
|
|
5898
|
-
|
|
5666
|
+
|
|
5899
5667
|
highchartsRenderer.getChartAxisLabel = function(type) {
|
|
5900
5668
|
return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
|
|
5901
5669
|
};
|
|
@@ -6730,7 +6498,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6730
6498
|
value_name: 'show',
|
|
6731
6499
|
default_value: true,
|
|
6732
6500
|
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',
|
|
6733
|
-
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6501
|
+
disabled_fn: (value) => !value.show_out_of_x_axis
|
|
6734
6502
|
&& !value.show_out_of_data_series
|
|
6735
6503
|
&& !value.show_value
|
|
6736
6504
|
&& !value.show_x_axis
|
|
@@ -6771,8 +6539,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6771
6539
|
element_label: '[X Axis]',
|
|
6772
6540
|
value_name: 'show_x_axis',
|
|
6773
6541
|
default_value: true,
|
|
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
|
|
6542
|
+
clickFn: (value) => value.show = value.show
|
|
6543
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6776
6544
|
: value.show,
|
|
6777
6545
|
},
|
|
6778
6546
|
{
|
|
@@ -6780,8 +6548,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6780
6548
|
element_label: '[Data Series]',
|
|
6781
6549
|
value_name: 'show_data_series',
|
|
6782
6550
|
default_value: true,
|
|
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
|
|
6551
|
+
clickFn: (value) => value.show = value.show
|
|
6552
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6785
6553
|
: value.show,
|
|
6786
6554
|
},
|
|
6787
6555
|
{
|
|
@@ -6789,8 +6557,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6789
6557
|
element_label: 'Value',
|
|
6790
6558
|
value_name: 'show_value',
|
|
6791
6559
|
default_value: true,
|
|
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
|
|
6560
|
+
clickFn: (value) => value.show = value.show
|
|
6561
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6794
6562
|
: value.show,
|
|
6795
6563
|
},
|
|
6796
6564
|
{
|
|
@@ -6798,8 +6566,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6798
6566
|
element_label: '% Out of [X Axis]',
|
|
6799
6567
|
value_name: 'show_out_of_x_axis',
|
|
6800
6568
|
default_value: false,
|
|
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
|
|
6569
|
+
clickFn: (value) => value.show = value.show
|
|
6570
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6803
6571
|
: value.show,
|
|
6804
6572
|
},
|
|
6805
6573
|
{
|
|
@@ -6807,8 +6575,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6807
6575
|
element_label: '% Out of [Data Series]',
|
|
6808
6576
|
value_name: 'show_out_of_data_series',
|
|
6809
6577
|
default_value: false,
|
|
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
|
|
6578
|
+
clickFn: (value) => value.show = value.show
|
|
6579
|
+
? value.show_out_of_x_axis || value.show_out_of_data_series || value.show_value || value.show_x_axis || value.show_data_series
|
|
6812
6580
|
: value.show,
|
|
6813
6581
|
},
|
|
6814
6582
|
]
|
|
@@ -6982,16 +6750,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6982
6750
|
value_name: 'name',
|
|
6983
6751
|
element_label: 'Name',
|
|
6984
6752
|
default_value: '_Variance'
|
|
6985
|
-
}, {
|
|
6986
|
-
element_type: 'input',
|
|
6987
|
-
value_name: 'formula',
|
|
6988
|
-
element_label: 'Formula',
|
|
6989
|
-
default_value: 'x2-x1'
|
|
6990
6753
|
}, {
|
|
6991
6754
|
element_type: 'input',
|
|
6992
|
-
value_name: '
|
|
6993
|
-
element_label: '
|
|
6994
|
-
default_value: ''
|
|
6755
|
+
value_name: 'formula',
|
|
6756
|
+
element_label: 'Formula',
|
|
6757
|
+
default_value: 'x2-x1'
|
|
6758
|
+
}, {
|
|
6759
|
+
element_type: 'input',
|
|
6760
|
+
value_name: 'color',
|
|
6761
|
+
element_label: 'Color',
|
|
6762
|
+
default_value: ''
|
|
6995
6763
|
}, {
|
|
6996
6764
|
element_type: 'radio',
|
|
6997
6765
|
value_name: 'chart',
|
|
@@ -7114,17 +6882,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7114
6882
|
axisTooltipDescription: 'The category (usually an independent variable) is shown on the x-axis and should be between 2 to 5 total columns. ',
|
|
7115
6883
|
legendTooltipTitle: 'Drag one field to further configure your x-axis.',
|
|
7116
6884
|
legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
|
|
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
|
-
},
|
|
6885
|
+
},
|
|
7128
6886
|
'combo-chart': {
|
|
7129
6887
|
name: 'Combo Chart ',
|
|
7130
6888
|
label: 'Combo Chart ',
|
|
@@ -7780,24 +7538,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7780
7538
|
highchartsRenderer.suboptions["legends"],
|
|
7781
7539
|
]
|
|
7782
7540
|
},
|
|
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
|
-
},
|
|
7801
7541
|
]
|
|
7802
7542
|
},
|
|
7803
7543
|
];
|
|
@@ -7954,7 +7694,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7954
7694
|
_.forEach(Object.keys(dates), key => {
|
|
7955
7695
|
const dateConfiguration = dates[key];
|
|
7956
7696
|
const timestamp = dateConfiguration.timestamp;
|
|
7957
|
-
if (timestamp) {
|
|
7697
|
+
if (timestamp) {
|
|
7958
7698
|
const dateTzOffsetInSeconds = new Date(timestamp * 1000).getTimezoneOffset() * 60;
|
|
7959
7699
|
dateConfiguration.displayedValue = new Date((timestamp + dateTzOffsetInSeconds) * 1000)
|
|
7960
7700
|
.toLocaleDateString();
|
|
@@ -8253,7 +7993,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8253
7993
|
if (!(format && highchartsRenderer.isDateFormat(dateString, format) || highchartsRenderer.isDate(dateString))) {
|
|
8254
7994
|
return null;
|
|
8255
7995
|
}
|
|
8256
|
-
const utcDate = format
|
|
7996
|
+
const utcDate = format
|
|
8257
7997
|
? moment_lib.utc(dateString, format, true)
|
|
8258
7998
|
: moment_lib.utc(dateString);
|
|
8259
7999
|
return utcDate.startOf('day').unix();
|
|
@@ -8271,7 +8011,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8271
8011
|
}
|
|
8272
8012
|
|
|
8273
8013
|
let filters = [];
|
|
8274
|
-
|
|
8014
|
+
|
|
8275
8015
|
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
|
8276
8016
|
const colFilter = highchartsRenderer.createFilterObject(widget.cols[0]);
|
|
8277
8017
|
const labels = [];
|
|
@@ -8299,7 +8039,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8299
8039
|
col_value,
|
|
8300
8040
|
highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
|
|
8301
8041
|
);
|
|
8302
|
-
|
|
8042
|
+
|
|
8303
8043
|
if ($.isEmptyObject(datetrange)) {
|
|
8304
8044
|
return;
|
|
8305
8045
|
}
|
|
@@ -8542,7 +8282,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8542
8282
|
var data = res;
|
|
8543
8283
|
|
|
8544
8284
|
lodash.forEach(datesFields, function (row) {
|
|
8545
|
-
row.val_not_convert = highchartsRenderer.
|
|
8285
|
+
row.val_not_convert = highchartsRenderer.check_value_not_for_convert(widget, row.name);
|
|
8546
8286
|
});
|
|
8547
8287
|
|
|
8548
8288
|
if (datesFields.length > 0) {
|
|
@@ -8948,14 +8688,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8948
8688
|
return rightPosition;
|
|
8949
8689
|
case 'none':
|
|
8950
8690
|
return none;
|
|
8951
|
-
}
|
|
8952
|
-
} else if (isLine) {
|
|
8953
|
-
return useNewUx ? leftPosition : rightPosition;
|
|
8954
|
-
} else if (isPie) {
|
|
8955
|
-
return useNewUx ? rightPosition : topPosition;
|
|
8956
8691
|
}
|
|
8692
|
+
} else if (isLine) {
|
|
8693
|
+
return useNewUx ? leftPosition : rightPosition;
|
|
8694
|
+
} else if (isPie) {
|
|
8695
|
+
return useNewUx ? rightPosition : topPosition;
|
|
8696
|
+
}
|
|
8957
8697
|
|
|
8958
|
-
|
|
8698
|
+
return useNewUx ? topPosition : bottomPosition;
|
|
8959
8699
|
}
|
|
8960
8700
|
|
|
8961
8701
|
highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
|
|
@@ -8970,7 +8710,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8970
8710
|
}
|
|
8971
8711
|
|
|
8972
8712
|
highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
|
|
8973
|
-
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8713
|
+
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
|
8974
8714
|
? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
|
|
8975
8715
|
: null;
|
|
8976
8716
|
|