@datarailsshared/dr_renderer 1.2.254-dragons → 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 +73 -51
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,14 +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
|
-
|
|
1046
1038
|
lodash.forEach(col_n_keys, function (col_n_value, index) {
|
|
1047
1039
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
1048
1040
|
var val = agg.value();
|
|
1049
1041
|
|
|
1050
|
-
if (col_n_value[0] ===
|
|
1042
|
+
if (col_n_value[0] === highchartsRenderer.DR_OTHERS_KEY) {
|
|
1051
1043
|
col_n_value[0] = othersName;
|
|
1052
1044
|
}
|
|
1053
1045
|
|
|
@@ -1188,7 +1180,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1188
1180
|
var ob = {};
|
|
1189
1181
|
ob.data = [];
|
|
1190
1182
|
if (row_n_value && row_n_value.length > 0) {
|
|
1191
|
-
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));
|
|
1192
1185
|
}
|
|
1193
1186
|
|
|
1194
1187
|
ob.dataLabels = {
|
|
@@ -1228,7 +1221,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1228
1221
|
tmoobj.name = lodash.unescape(key);
|
|
1229
1222
|
|
|
1230
1223
|
if (tmoobj.name) {
|
|
1231
|
-
tmoobj.name = tmoobj.name.replace(
|
|
1224
|
+
tmoobj.name = tmoobj.name.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
|
1232
1225
|
}
|
|
1233
1226
|
|
|
1234
1227
|
if (lodash.isEmpty(String(tmoobj.name))) {
|
|
@@ -1259,7 +1252,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1259
1252
|
if (opts.trendLine) {
|
|
1260
1253
|
const a = ((ySum * squareXSum) - (xSum * xySum)) / ((n * squareXSum) - (xSum * xSum));
|
|
1261
1254
|
const b = ((n * xySum) - (xSum* ySum)) / ((n * squareXSum) - (xSum * xSum));
|
|
1262
|
-
|
|
1263
1255
|
const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
|
|
1264
1256
|
trendSeries.className = 'trendSeries';
|
|
1265
1257
|
trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
|
|
@@ -1270,7 +1262,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1270
1262
|
if (colors && colors[i]) {
|
|
1271
1263
|
trendSeries.color = colors[i];
|
|
1272
1264
|
}
|
|
1273
|
-
|
|
1274
1265
|
trendSerieses.push(trendSeries);
|
|
1275
1266
|
}
|
|
1276
1267
|
i++;
|
|
@@ -1287,7 +1278,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1287
1278
|
}
|
|
1288
1279
|
|
|
1289
1280
|
let weights = { line: 2,spline: 3 ,area:-2, areaspline: -1, scatter:4, column: 1 };
|
|
1290
|
-
|
|
1291
1281
|
if (opts.comboOptions && lodash.includes(chartType,'combo') && !lodash.isEqual(row_n_keys, EMPTY_ROW_N_KEYS)) {
|
|
1292
1282
|
chart_series.forEach((series, seriesIndex) => {
|
|
1293
1283
|
const savedSeriesOption = lodash.find(opts.comboOptions.seriesOptions, {series: series.name});
|
|
@@ -1376,7 +1366,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1376
1366
|
const totalColumnValue = pivotData.getAggregator([], col_n_value).value();
|
|
1377
1367
|
resultObject.data.push({
|
|
1378
1368
|
y: totalColumnValue,
|
|
1379
|
-
name: lodash.unescape(col_n_value)
|
|
1369
|
+
name: lodash.unescape(col_n_value)
|
|
1370
|
+
.replace(highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts)),
|
|
1380
1371
|
isSum: !!col_index,
|
|
1381
1372
|
isTotal: true,
|
|
1382
1373
|
color: colorOptions.total,
|
|
@@ -1394,7 +1385,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1394
1385
|
tmoobj.name = lodash.unescape(key);
|
|
1395
1386
|
|
|
1396
1387
|
if (tmoobj.name) {
|
|
1397
|
-
tmoobj.name = tmoobj.name
|
|
1388
|
+
tmoobj.name = tmoobj.name
|
|
1389
|
+
.replace(highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts));
|
|
1398
1390
|
}
|
|
1399
1391
|
|
|
1400
1392
|
if (lodash.isEmpty(String(tmoobj.name))) {
|
|
@@ -1500,7 +1492,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1500
1492
|
|
|
1501
1493
|
resultObject.data.push({
|
|
1502
1494
|
y: val,
|
|
1503
|
-
name: lodash.replace(
|
|
1495
|
+
name: lodash.replace(
|
|
1496
|
+
lodash.unescape(name), highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts)
|
|
1497
|
+
),
|
|
1504
1498
|
totalIndex: value.trend === 'total' ? index : undefined,
|
|
1505
1499
|
isSum: value.trend === 'total',
|
|
1506
1500
|
isTotal: value.trend === 'total',
|
|
@@ -1638,7 +1632,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1638
1632
|
var num_cols = col_n_keys.length;
|
|
1639
1633
|
var num_rows = row_n_keys.length;
|
|
1640
1634
|
|
|
1641
|
-
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);
|
|
1642
1636
|
const othersName = highchartsRenderer.getOthersName(opts);
|
|
1643
1637
|
|
|
1644
1638
|
lodash.forEach(col_n_keys, function (col_n_value) {
|
|
@@ -1658,7 +1652,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1658
1652
|
ob.name = "[blank]";
|
|
1659
1653
|
}
|
|
1660
1654
|
|
|
1661
|
-
if (ob.name ===
|
|
1655
|
+
if (ob.name === highchartsRenderer.DR_OTHERS_KEY) {
|
|
1662
1656
|
ob.name = othersName;
|
|
1663
1657
|
}
|
|
1664
1658
|
|
|
@@ -1693,7 +1687,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1693
1687
|
var col_n = col_n_value[0];
|
|
1694
1688
|
if (col_n != undefined) {
|
|
1695
1689
|
col_ob.id = !isNaN(col_n) ? Number(col_n) : col_n;
|
|
1696
|
-
col_ob.name = col_n ===
|
|
1690
|
+
col_ob.name = col_n === highchartsRenderer.DR_OTHERS_KEY ? othersName : col_n;
|
|
1697
1691
|
col_ob.data = [];
|
|
1698
1692
|
lodash.forEach(row_n_keys, function (row_n_value) {
|
|
1699
1693
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
@@ -1708,7 +1702,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1708
1702
|
// }
|
|
1709
1703
|
}
|
|
1710
1704
|
|
|
1711
|
-
const row_name = row_n_value[0] ===
|
|
1705
|
+
const row_name = row_n_value[0] === highchartsRenderer.DR_OTHERS_KEY ? othersName : row_n_value[0];
|
|
1712
1706
|
col_ob.data.push([row_name, val]);
|
|
1713
1707
|
}
|
|
1714
1708
|
});
|
|
@@ -3360,6 +3354,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3360
3354
|
formatter: highchartsRenderer.defaultDataLabelFormatter(pivotData, opts),
|
|
3361
3355
|
style: highchartsRenderer.getDataLabelsStyle(additionOptions),
|
|
3362
3356
|
inside: false
|
|
3357
|
+
},
|
|
3358
|
+
events: {
|
|
3359
|
+
legendItemClick: () => {
|
|
3360
|
+
return false;
|
|
3361
|
+
}
|
|
3363
3362
|
}
|
|
3364
3363
|
}
|
|
3365
3364
|
};
|
|
@@ -8687,7 +8686,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8687
8686
|
if ($.pivotUtilities && !$.pivotUtilities.additionalFieldsList) {
|
|
8688
8687
|
$.pivotUtilities.additionalFieldsList = [
|
|
8689
8688
|
{key: 'DR_Average', name: 'DR_Average'},
|
|
8690
|
-
{key:
|
|
8689
|
+
{key: highchartsRenderer.DR_OTHERS_KEY, name: highchartsRenderer.getOthersName(widget.options)}
|
|
8691
8690
|
];
|
|
8692
8691
|
}
|
|
8693
8692
|
|
|
@@ -9195,7 +9194,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
9195
9194
|
highchartsRenderer.transformRowsAndColsForBreakdown = function(rows, cols, point, opts) {
|
|
9196
9195
|
const othersIndex = cols.indexOf(highchartsRenderer.getOthersName(opts));
|
|
9197
9196
|
if (othersIndex !== -1) {
|
|
9198
|
-
cols[othersIndex] =
|
|
9197
|
+
cols[othersIndex] = highchartsRenderer.DR_OTHERS_KEY;
|
|
9199
9198
|
}
|
|
9200
9199
|
if (point.options.isTotal) {
|
|
9201
9200
|
rows = [];
|
|
@@ -9253,23 +9252,46 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
9253
9252
|
|
|
9254
9253
|
highchartsRenderer.buildFilterValuesFromWalkthroughColKey = function(widget, field, filter, colKey) {
|
|
9255
9254
|
const isTotal = lodash.isArray(colKey);
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
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
|
+
}
|
|
9270
9269
|
|
|
9271
|
-
|
|
9272
|
-
|
|
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
|
+
}
|
|
9273
9295
|
}
|
|
9274
9296
|
});
|
|
9275
9297
|
}
|