@datarailsshared/dr_renderer 1.2.255 → 1.2.256
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 +68 -47
package/package.json
CHANGED
|
@@ -93,6 +93,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
93
93
|
WATERFALL_VARIANCE: 'DR_WATERFALL_BREAKDOWN_VARIANCE',
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
highchartsRenderer.DR_OTHERS_KEY = 'DR_Others';
|
|
97
|
+
|
|
96
98
|
highchartsRenderer.highcharts_theme = {
|
|
97
99
|
"colors": highchartsRenderer.defaults_colors,
|
|
98
100
|
"chart": {
|
|
@@ -464,13 +466,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
464
466
|
}
|
|
465
467
|
|
|
466
468
|
const labelOptions = lodash.get(opts.chartOptions, 'label') || lodash.get(opts.chartOptions, 'label_pie');
|
|
467
|
-
const othersName = opts.total_value_options ?
|
|
468
|
-
|
|
469
|
-
undefined;
|
|
470
|
-
var drOthersInColumn = lodash.find(
|
|
471
|
-
pivotData.getColKeys(),
|
|
472
|
-
keys => keys.length && (lodash.includes(keys, 'DR_Others') || lodash.includes(keys, othersName))
|
|
473
|
-
);
|
|
469
|
+
const othersName = opts.total_value_options ? highchartsRenderer.getOthersName(opts) : undefined;
|
|
470
|
+
const drOthersInAxis = highchartsRenderer.getDrOthersInAxisState(pivotData, othersName);
|
|
474
471
|
|
|
475
472
|
var func = function () {
|
|
476
473
|
var value = parseFloat(this.y);
|
|
@@ -497,17 +494,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
497
494
|
cols = this.point.name;
|
|
498
495
|
}
|
|
499
496
|
|
|
500
|
-
|
|
501
|
-
if (!lodash.isArray(cols) && othersName === cols) {
|
|
502
|
-
cols = ['DR_Others'];
|
|
503
|
-
} else if (lodash.isArray(cols)) {
|
|
504
|
-
var index = cols.indexOf(othersName);
|
|
505
|
-
|
|
506
|
-
if (index !== -1) {
|
|
507
|
-
cols[index] = 'DR_Others';
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
497
|
+
highchartsRenderer.replaceDrOthersKeys(cols, rows, drOthersInAxis, othersName);
|
|
511
498
|
|
|
512
499
|
if (!lodash.isArray(cols)) {
|
|
513
500
|
cols = [cols];
|
|
@@ -619,6 +606,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
619
606
|
percentageLabels = opts.chartLabels;
|
|
620
607
|
}
|
|
621
608
|
|
|
609
|
+
const othersName = opts.total_value_options ? highchartsRenderer.getOthersName(opts) : undefined;
|
|
610
|
+
const drOthersInAxis = highchartsRenderer.getDrOthersInAxisState(pivotData, othersName);
|
|
611
|
+
|
|
622
612
|
var func = function () {
|
|
623
613
|
const isWaterfallBreakdown = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_BREAKDOWN;
|
|
624
614
|
const isWaterfallWalkthrough = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_WALKTHROUGH;
|
|
@@ -659,6 +649,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
659
649
|
rows = temp;
|
|
660
650
|
}
|
|
661
651
|
|
|
652
|
+
highchartsRenderer.replaceDrOthersKeys(cols, rows, drOthersInAxis, othersName);
|
|
653
|
+
|
|
662
654
|
var category_text = `<span style="font-weight: bold;">
|
|
663
655
|
${ lodash.get(this, 'point.options.colsForTotal') ? isWaterfallWalkthrough ? this.key : cols[0] : cols } ${ isWaterfallBreakdown ? ': ' : ' ' }
|
|
664
656
|
</span>`;
|
|
@@ -1040,13 +1032,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1040
1032
|
let squareXSum = 0;
|
|
1041
1033
|
ob.data = [];
|
|
1042
1034
|
if (row_n_value && row_n_value.length > 0) {
|
|
1043
|
-
ob.name = row_n_value.join(highchartsRenderer.delimer)
|
|
1035
|
+
ob.name = row_n_value.join(highchartsRenderer.delimer)
|
|
1036
|
+
.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
|
1044
1037
|
}
|
|
1045
1038
|
lodash.forEach(col_n_keys, function (col_n_value, index) {
|
|
1046
1039
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
1047
1040
|
var val = agg.value();
|
|
1048
1041
|
|
|
1049
|
-
if (col_n_value[0] ===
|
|
1042
|
+
if (col_n_value[0] === highchartsRenderer.DR_OTHERS_KEY) {
|
|
1050
1043
|
col_n_value[0] = othersName;
|
|
1051
1044
|
}
|
|
1052
1045
|
|
|
@@ -1187,7 +1180,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1187
1180
|
var ob = {};
|
|
1188
1181
|
ob.data = [];
|
|
1189
1182
|
if (row_n_value && row_n_value.length > 0) {
|
|
1190
|
-
ob.name = lodash.unescape(row_n_value.join(highchartsRenderer.delimer)
|
|
1183
|
+
ob.name = lodash.unescape(row_n_value.join(highchartsRenderer.delimer)
|
|
1184
|
+
.replace(highchartsRenderer.DR_OTHERS_KEY, othersName));
|
|
1191
1185
|
}
|
|
1192
1186
|
|
|
1193
1187
|
ob.dataLabels = {
|
|
@@ -1227,7 +1221,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1227
1221
|
tmoobj.name = lodash.unescape(key);
|
|
1228
1222
|
|
|
1229
1223
|
if (tmoobj.name) {
|
|
1230
|
-
tmoobj.name = tmoobj.name.replace(
|
|
1224
|
+
tmoobj.name = tmoobj.name.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
|
1231
1225
|
}
|
|
1232
1226
|
|
|
1233
1227
|
if (lodash.isEmpty(String(tmoobj.name))) {
|
|
@@ -1372,7 +1366,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1372
1366
|
const totalColumnValue = pivotData.getAggregator([], col_n_value).value();
|
|
1373
1367
|
resultObject.data.push({
|
|
1374
1368
|
y: totalColumnValue,
|
|
1375
|
-
name: lodash.unescape(col_n_value)
|
|
1369
|
+
name: lodash.unescape(col_n_value)
|
|
1370
|
+
.replace(highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts)),
|
|
1376
1371
|
isSum: !!col_index,
|
|
1377
1372
|
isTotal: true,
|
|
1378
1373
|
color: colorOptions.total,
|
|
@@ -1390,7 +1385,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1390
1385
|
tmoobj.name = lodash.unescape(key);
|
|
1391
1386
|
|
|
1392
1387
|
if (tmoobj.name) {
|
|
1393
|
-
tmoobj.name = tmoobj.name
|
|
1388
|
+
tmoobj.name = tmoobj.name
|
|
1389
|
+
.replace(highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts));
|
|
1394
1390
|
}
|
|
1395
1391
|
|
|
1396
1392
|
if (lodash.isEmpty(String(tmoobj.name))) {
|
|
@@ -1496,7 +1492,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1496
1492
|
|
|
1497
1493
|
resultObject.data.push({
|
|
1498
1494
|
y: val,
|
|
1499
|
-
name: lodash.replace(
|
|
1495
|
+
name: lodash.replace(
|
|
1496
|
+
lodash.unescape(name), highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts)
|
|
1497
|
+
),
|
|
1500
1498
|
totalIndex: value.trend === 'total' ? index : undefined,
|
|
1501
1499
|
isSum: value.trend === 'total',
|
|
1502
1500
|
isTotal: value.trend === 'total',
|
|
@@ -1634,7 +1632,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1634
1632
|
var num_cols = col_n_keys.length;
|
|
1635
1633
|
var num_rows = row_n_keys.length;
|
|
1636
1634
|
|
|
1637
|
-
const isOthersIncludedInRow = num_rows === 1 && lodash.includes(row_n_keys[0],
|
|
1635
|
+
const isOthersIncludedInRow = num_rows === 1 && lodash.includes(row_n_keys[0], highchartsRenderer.DR_OTHERS_KEY);
|
|
1638
1636
|
const othersName = highchartsRenderer.getOthersName(opts);
|
|
1639
1637
|
|
|
1640
1638
|
lodash.forEach(col_n_keys, function (col_n_value) {
|
|
@@ -1654,7 +1652,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1654
1652
|
ob.name = "[blank]";
|
|
1655
1653
|
}
|
|
1656
1654
|
|
|
1657
|
-
if (ob.name ===
|
|
1655
|
+
if (ob.name === highchartsRenderer.DR_OTHERS_KEY) {
|
|
1658
1656
|
ob.name = othersName;
|
|
1659
1657
|
}
|
|
1660
1658
|
|
|
@@ -1689,7 +1687,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1689
1687
|
var col_n = col_n_value[0];
|
|
1690
1688
|
if (col_n != undefined) {
|
|
1691
1689
|
col_ob.id = !isNaN(col_n) ? Number(col_n) : col_n;
|
|
1692
|
-
col_ob.name = col_n ===
|
|
1690
|
+
col_ob.name = col_n === highchartsRenderer.DR_OTHERS_KEY ? othersName : col_n;
|
|
1693
1691
|
col_ob.data = [];
|
|
1694
1692
|
lodash.forEach(row_n_keys, function (row_n_value) {
|
|
1695
1693
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
@@ -1704,7 +1702,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1704
1702
|
// }
|
|
1705
1703
|
}
|
|
1706
1704
|
|
|
1707
|
-
const row_name = row_n_value[0] ===
|
|
1705
|
+
const row_name = row_n_value[0] === highchartsRenderer.DR_OTHERS_KEY ? othersName : row_n_value[0];
|
|
1708
1706
|
col_ob.data.push([row_name, val]);
|
|
1709
1707
|
}
|
|
1710
1708
|
});
|
|
@@ -8688,7 +8686,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8688
8686
|
if ($.pivotUtilities && !$.pivotUtilities.additionalFieldsList) {
|
|
8689
8687
|
$.pivotUtilities.additionalFieldsList = [
|
|
8690
8688
|
{key: 'DR_Average', name: 'DR_Average'},
|
|
8691
|
-
{key:
|
|
8689
|
+
{key: highchartsRenderer.DR_OTHERS_KEY, name: highchartsRenderer.getOthersName(widget.options)}
|
|
8692
8690
|
];
|
|
8693
8691
|
}
|
|
8694
8692
|
|
|
@@ -9196,7 +9194,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
9196
9194
|
highchartsRenderer.transformRowsAndColsForBreakdown = function(rows, cols, point, opts) {
|
|
9197
9195
|
const othersIndex = cols.indexOf(highchartsRenderer.getOthersName(opts));
|
|
9198
9196
|
if (othersIndex !== -1) {
|
|
9199
|
-
cols[othersIndex] =
|
|
9197
|
+
cols[othersIndex] = highchartsRenderer.DR_OTHERS_KEY;
|
|
9200
9198
|
}
|
|
9201
9199
|
if (point.options.isTotal) {
|
|
9202
9200
|
rows = [];
|
|
@@ -9254,23 +9252,46 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
9254
9252
|
|
|
9255
9253
|
highchartsRenderer.buildFilterValuesFromWalkthroughColKey = function(widget, field, filter, colKey) {
|
|
9256
9254
|
const isTotal = lodash.isArray(colKey);
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9255
|
+
if (!filter.values) {
|
|
9256
|
+
filter.values = [];
|
|
9257
|
+
}
|
|
9258
|
+
if (isTotal) {
|
|
9259
|
+
lodash.forEach(colKey, colValue => {
|
|
9260
|
+
filter.values.push(colValue);
|
|
9261
|
+
});
|
|
9262
|
+
} else {
|
|
9263
|
+
filter.values = field.type === 'Date'
|
|
9264
|
+
? highchartsRenderer.createDateTypeFromValue(colKey, highchartsRenderer.getDateFieldFormat(widget, field))
|
|
9265
|
+
: [colKey];
|
|
9266
|
+
filter.value_to_show = colKey;
|
|
9267
|
+
}
|
|
9268
|
+
}
|
|
9271
9269
|
|
|
9272
|
-
|
|
9273
|
-
|
|
9270
|
+
highchartsRenderer.getDrOthersInAxisState = function(pivotData, othersName) {
|
|
9271
|
+
const drOthersInAxis = { cols: false, rows: false };
|
|
9272
|
+
lodash.forEach(lodash.keys(drOthersInAxis), axisName => {
|
|
9273
|
+
drOthersInAxis[axisName] = lodash.some(
|
|
9274
|
+
axisName === 'cols' ? pivotData.getColKeys() : pivotData.getRowKeys(),
|
|
9275
|
+
keys => keys.length && (lodash.includes(keys, highchartsRenderer.DR_OTHERS_KEY) || lodash.includes(keys, othersName))
|
|
9276
|
+
);
|
|
9277
|
+
});
|
|
9278
|
+
return drOthersInAxis;
|
|
9279
|
+
}
|
|
9280
|
+
|
|
9281
|
+
highchartsRenderer.replaceDrOthersKeys = function(cols, rows, drOthersInAxis, othersName) {
|
|
9282
|
+
lodash.forEach(lodash.keys(drOthersInAxis), axisName => {
|
|
9283
|
+
if (drOthersInAxis[axisName]) {
|
|
9284
|
+
const isCols = axisName === 'cols';
|
|
9285
|
+
const axisKeys = isCols ? cols : rows;
|
|
9286
|
+
|
|
9287
|
+
if (!lodash.isArray(axisKeys) && othersName === axisKeys) {
|
|
9288
|
+
isCols ? cols = [highchartsRenderer.DR_OTHERS_KEY] : rows = [highchartsRenderer.DR_OTHERS_KEY];
|
|
9289
|
+
} else if (lodash.isArray(axisKeys)) {
|
|
9290
|
+
const index = axisKeys.indexOf(othersName);
|
|
9291
|
+
if (index !== -1) {
|
|
9292
|
+
axisKeys[index] = highchartsRenderer.DR_OTHERS_KEY;
|
|
9293
|
+
}
|
|
9294
|
+
}
|
|
9274
9295
|
}
|
|
9275
9296
|
});
|
|
9276
9297
|
}
|