@datarailsshared/dr_renderer 1.2.64 → 1.2.68
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/dr_pivottable.js +231 -5
- package/src/highcharts_renderer.js +21 -11
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -127,10 +127,10 @@ let initDRPivotTable = function($, window, document) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (containsAverage || containsOthers) {
|
|
130
|
-
if (containsAverage && key[0] === 'DR_Average') {
|
|
130
|
+
if (containsAverage && !containsOthers && key[0] === 'DR_Average') {
|
|
131
131
|
totals[flatKey].push(record);
|
|
132
132
|
}
|
|
133
|
-
if (containsOthers && key[0] === 'DR_Others') {
|
|
133
|
+
if (containsOthers && !containsAverage && key[0] === 'DR_Others') {
|
|
134
134
|
totals[flatKey].push(record);
|
|
135
135
|
}
|
|
136
136
|
} else {
|
|
@@ -485,7 +485,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
485
485
|
SubtotalRenderer = function(pivotData, opts, charttype, tooMuch = false, error_params) {
|
|
486
486
|
var addClass, allTotal, arrowCollapsed, arrowExpanded, buildColHeaderHeader, buildColHeaderHeaders, buildColHeaderHeadersClickEvents, buildColHeaders, buildColTotals, buildColTotalsHeader, buildGrandTotal, buildRowHeaderHeaders, buildRowHeaderHeadersClickEvents, buildRowHeaders, buildRowTotalsHeader, buildValues, classColCollapsed, classColExpanded, classColHide, classColShow, classCollapsed, classExpanded, classRowCollapsed, classRowExpanded, classRowHide, classRowShow, clickStatusCollapsed, clickStatusExpanded, colAttrs, colDisableAfter, colKeys, colTotals, collapseCol, collapseColsAt, collapseHideDescendantRow, collapseRow, collapseRowsAt, collapseShowColSubtotal, collapseShowRowSubtotal, createElement, defaults, expandChildCol, expandChildRow, expandCol, expandColsAt, expandHideColSubtotal, expandHideRowSubtotal, expandRow, expandRowsAt, expandShowColSubtotal, expandShowRowSubtotal, getTableEventHandlers, hasClass, hideDescendantCol, isColDisable, isColDisableExpandCollapse, isColHideOnExpand, isRowDisable, isRowDisableExpandCollapse, isRowHideOnExpand, main, getSubtotalInBrackets, processKeys, encodeHtmlEntities, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, removeClass, replaceClass, rowAttrs, rowDisableAfter, rowKeys, rowTotals, setAttributes, showChildCol, showChildRow, toggleCol, toggleColHeaderHeader, toggleRow, toggleRowHeaderHeader, tree, assumptionSubscribe;
|
|
487
487
|
var createTotalValsBolder, createGrandTotalBolder, getHeaderColorProperties, colorizeRowLabelHeaders, colorizeTableIfNeed, valueNoDashes, getColorsWithOffsetForTable, offsetColors, handleFreezePanesScroll, selectFreezableElements, removeRowHeaderNullValue;
|
|
488
|
-
var
|
|
488
|
+
var getAdditionalAggregation, buildAdditionalHeaderCols, buildAdditionalHeaderRows, buildAdditionalColValues, buildAdditionalRowValues, buildAdditionalRowTotals, buildAdditionalColTotals;
|
|
489
|
+
var additionalFieldsCol, additionalFieldsRow, additionalFieldsList;
|
|
490
|
+
var edit_assumptions, getExistingAggregator;
|
|
489
491
|
|
|
490
492
|
var horizontalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' horizontal-freeze-pane' : '';
|
|
491
493
|
var verticalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' vertical-freeze-pane' : '';
|
|
@@ -497,6 +499,14 @@ let initDRPivotTable = function($, window, document) {
|
|
|
497
499
|
XY: axisFreezePaneClass,
|
|
498
500
|
}
|
|
499
501
|
|
|
502
|
+
additionalFieldsCol = [];
|
|
503
|
+
additionalFieldsRow = [];
|
|
504
|
+
additionalFieldsList = [
|
|
505
|
+
{key: 'DR_Average', name: 'DR_Average'},
|
|
506
|
+
{key: 'DR_Others', name: _.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others'}
|
|
507
|
+
];
|
|
508
|
+
$.pivotUtilities.additionalFieldsList = additionalFieldsList;
|
|
509
|
+
|
|
500
510
|
defaults = {
|
|
501
511
|
table: {
|
|
502
512
|
clickCallback: null
|
|
@@ -796,6 +806,16 @@ let initDRPivotTable = function($, window, document) {
|
|
|
796
806
|
};
|
|
797
807
|
|
|
798
808
|
processKeys = function(keysArr, className, dimention, attrs) {
|
|
809
|
+
for (let i = 0; i < keysArr.length; i++) {
|
|
810
|
+
const additionalField = _.find(additionalFieldsList, {key: keysArr[i][0]})
|
|
811
|
+
|
|
812
|
+
if (additionalField) {
|
|
813
|
+
dimention === 'rows'
|
|
814
|
+
? additionalFieldsRow.push(additionalField)
|
|
815
|
+
: additionalFieldsCol.push(additionalField);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
799
819
|
var c, headers, k, key, lastCol, lastRow, node, nodePos, r, rMark, ref8, repeats, th, x;
|
|
800
820
|
const showAllData = opts && opts.chartOptions && opts.chartOptions.table_options && opts.chartOptions.table_options.show_all;
|
|
801
821
|
|
|
@@ -1015,6 +1035,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1015
1035
|
return results;
|
|
1016
1036
|
};
|
|
1017
1037
|
buildColHeaders = function(colHeaderHeaders, colHeaderCols, colHeader, rowAttrs, colAttrs) {
|
|
1038
|
+
const additionalField = _.find(additionalFieldsList, {key: colHeader.key[0]})
|
|
1039
|
+
if (additionalField) return;
|
|
1040
|
+
|
|
1018
1041
|
var colspan, h, hh, isColSubtotal, k, len, ref8, rowspan, sTh, style, th, tr;
|
|
1019
1042
|
ref8 = colHeader.children;
|
|
1020
1043
|
for (k = 0, len = ref8.length; k < len; k++) {
|
|
@@ -1177,6 +1200,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1177
1200
|
}
|
|
1178
1201
|
};
|
|
1179
1202
|
buildRowHeaders = function(tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs, highlighted, hasColLabels) {
|
|
1203
|
+
const additionalField = _.find(additionalFieldsList, {key: rowHeader.key[0]})
|
|
1204
|
+
if (additionalField) return;
|
|
1205
|
+
|
|
1180
1206
|
var colspan, h, hh, isRowSubtotal, k, len, ref8, results, style, th, tr;
|
|
1181
1207
|
hh = rowHeaderHeaders.hh[rowHeader.col];
|
|
1182
1208
|
++hh.expandedCount;
|
|
@@ -1254,8 +1280,167 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1254
1280
|
}
|
|
1255
1281
|
return results;
|
|
1256
1282
|
};
|
|
1283
|
+
|
|
1284
|
+
getAdditionalAggregation = function (rowKey, colKey) {
|
|
1285
|
+
if ((tree && tree[rowKey] && tree[rowKey][colKey])
|
|
1286
|
+
&& (rowKey !== '...' || colKey !== '...')) {
|
|
1287
|
+
return tree[rowKey][colKey];
|
|
1288
|
+
} else {
|
|
1289
|
+
return {
|
|
1290
|
+
value: (function() {
|
|
1291
|
+
return null;
|
|
1292
|
+
}),
|
|
1293
|
+
format: function() {
|
|
1294
|
+
return "";
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
buildAdditionalHeaderCols = function (tr, rowAttrs, colAttrs) {
|
|
1301
|
+
let rowspan, th;
|
|
1302
|
+
|
|
1303
|
+
rowspan = 1;
|
|
1304
|
+
if (colAttrs.length !== 0) {
|
|
1305
|
+
rowspan = colAttrs.length + (rowAttrs.length === 0 ? 0 : 1);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
for (let i = 0; i < additionalFieldsCol.length; i++) {
|
|
1309
|
+
const col = additionalFieldsCol[i];
|
|
1310
|
+
th = createElement("th", "pvtColLabel" + verticalFreezePaneClass , col.name, {
|
|
1311
|
+
rowspan: rowspan
|
|
1312
|
+
});
|
|
1313
|
+
|
|
1314
|
+
if (opts.chartOptions.table_options.freeze_panes) {
|
|
1315
|
+
tr.appendChild(th);
|
|
1316
|
+
getHeaderColorProperties(tr);
|
|
1317
|
+
} else {
|
|
1318
|
+
return tr.appendChild(th);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
buildAdditionalHeaderRows = function (fieldName, rowAttrs, colAttrs) {
|
|
1324
|
+
let colspan, th, tr;
|
|
1325
|
+
|
|
1326
|
+
tr = createElement("tr");
|
|
1327
|
+
colspan = rowAttrs.length + (colAttrs.length === 0 ? 0 : 1);
|
|
1328
|
+
th = createElement("th", "pvtRowLabel" + horizontalFreezePaneClass, fieldName, {
|
|
1329
|
+
colspan: colspan
|
|
1330
|
+
});
|
|
1331
|
+
|
|
1332
|
+
tr.appendChild(th);
|
|
1333
|
+
return tr;
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
buildAdditionalColValues = function (tr, rowKey, rowHeader) {
|
|
1337
|
+
for (let i = 0; i < additionalFieldsCol.length; i++) {
|
|
1338
|
+
const colKey = additionalFieldsCol[i].key;
|
|
1339
|
+
const totalAggregator = getAdditionalAggregation(rowKey, colKey);
|
|
1340
|
+
const val = totalAggregator.value();
|
|
1341
|
+
const formattedValue = getFormattedNumber(val, totalAggregator, opts)
|
|
1342
|
+
|
|
1343
|
+
let className = "pvtVal rowshow colshow";
|
|
1344
|
+
className += " row" + rowHeader.row + " rowcol" + rowHeader.col;
|
|
1345
|
+
|
|
1346
|
+
const td = createElement("td", className, formattedValue, {
|
|
1347
|
+
"data-value": val,
|
|
1348
|
+
"data-row": "row" + rowHeader.row,
|
|
1349
|
+
"data-rowcol": "col" + rowHeader.col,
|
|
1350
|
+
"data-rownode": rowHeader.node
|
|
1351
|
+
}, getTableEventHandlers(val, rowHeader.key, []));
|
|
1352
|
+
|
|
1353
|
+
tr.appendChild(td)
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
buildAdditionalRowValues = function (tr, colHeaderCols, rowKey) {
|
|
1358
|
+
for (let i = 0; i < colHeaderCols.length; i++) {
|
|
1359
|
+
const colKey = colHeaderCols[i].flatKey;
|
|
1360
|
+
const totalAggregator = getAdditionalAggregation(rowKey, colKey);
|
|
1361
|
+
const val = totalAggregator.value();
|
|
1362
|
+
const formattedValue = getFormattedNumber(val, totalAggregator, opts)
|
|
1363
|
+
|
|
1364
|
+
let className = " col" + i + " colcol" + 0;
|
|
1365
|
+
const td = createElement("td", className, formattedValue, {
|
|
1366
|
+
"data-value": val,
|
|
1367
|
+
"data-for": "col" + 0,
|
|
1368
|
+
"data-colnode": "" + i
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
tr.appendChild(td);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
if (additionalFieldsCol.length) {
|
|
1375
|
+
for (let i = 0; i < additionalFieldsCol.length; i++) {
|
|
1376
|
+
const totalAggregator = getAdditionalAggregation(rowKey, additionalFieldsCol[i].key);
|
|
1377
|
+
const val = totalAggregator.value();
|
|
1378
|
+
const formattedValue = getFormattedNumber(val, totalAggregator, opts)
|
|
1379
|
+
|
|
1380
|
+
let className = " col" + i + " colcol" + 0;
|
|
1381
|
+
const td = createElement("td", className, formattedValue, {
|
|
1382
|
+
"data-value": val,
|
|
1383
|
+
"data-for": "col" + 0,
|
|
1384
|
+
"data-colnode": "" + i
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
tr.appendChild(td);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
if(opts.chartOptions.table_options.show_row_total) {
|
|
1392
|
+
buildAdditionalRowTotals(tr, rowKey)
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
buildAdditionalRowTotals = function (tr, rowKey) {
|
|
1397
|
+
const totalAggregator = getExistingAggregator(rowTotals, rowKey);
|
|
1398
|
+
const value = totalAggregator.value();
|
|
1399
|
+
const formattedValue = getFormattedNumber(value, totalAggregator, opts)
|
|
1400
|
+
|
|
1401
|
+
let style = "pvtTotal pvtAddFiled rowTotal";
|
|
1402
|
+
const td = createElement("td", style, formattedValue, {
|
|
1403
|
+
"data-value": value
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
tr.appendChild(td);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
buildAdditionalColTotals = function (tr, rowHeaderRows, colKey, colHeader) {
|
|
1410
|
+
const totalAggregator = getExistingAggregator(colTotals, colKey)
|
|
1411
|
+
const value = totalAggregator.value();
|
|
1412
|
+
const formattedValue = getFormattedNumber(value, totalAggregator, opts);
|
|
1413
|
+
|
|
1414
|
+
let style = "pvtTotal pvtAddField colTotal";
|
|
1415
|
+
style += " col" + colHeader.row + " colcol" + colHeader.col;
|
|
1416
|
+
|
|
1417
|
+
const td = createElement("td", style, formattedValue, {
|
|
1418
|
+
"data-value": value,
|
|
1419
|
+
"data-rowcol": "col" + colHeader.col,
|
|
1420
|
+
"data-rownode": "" + colHeader.node
|
|
1421
|
+
}, getTableEventHandlers(value, [], colHeader.key));
|
|
1422
|
+
|
|
1423
|
+
return td;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
getExistingAggregator = function (aggregator, key) {
|
|
1427
|
+
if (!aggregator[key]) {
|
|
1428
|
+
return {
|
|
1429
|
+
value: (function () {
|
|
1430
|
+
return null;
|
|
1431
|
+
}),
|
|
1432
|
+
format: function () {
|
|
1433
|
+
return "";
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
return aggregator[key];
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1257
1441
|
buildValues = function(rowHeaderRows, colHeaderCols, rowAttrs, colAttrs) {
|
|
1258
1442
|
var aggregator, colHeader, eventHandlers, flatColKey, flatRowKey, isColSubtotal, isRowSubtotal, k, l, len, len1, ref8, results, rowHeader, style, td, totalAggregator, tr, val;
|
|
1443
|
+
|
|
1259
1444
|
results = [];
|
|
1260
1445
|
for (k = 0, len = rowHeaderRows.length; k < len; k++) {
|
|
1261
1446
|
rowHeader = rowHeaderRows[k];
|
|
@@ -1305,6 +1490,11 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1305
1490
|
|
|
1306
1491
|
tr.appendChild(td);
|
|
1307
1492
|
}
|
|
1493
|
+
|
|
1494
|
+
if (additionalFieldsCol.length > 0) {
|
|
1495
|
+
buildAdditionalColValues(tr, flatRowKey, rowHeader);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1308
1498
|
totalAggregator = rowTotals[flatRowKey];
|
|
1309
1499
|
if(!totalAggregator){
|
|
1310
1500
|
totalAggregator = {
|
|
@@ -1406,12 +1596,13 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1406
1596
|
tr.appendChild(th);
|
|
1407
1597
|
return tr;
|
|
1408
1598
|
};
|
|
1409
|
-
buildColTotals = function(tr, colHeaderCols, rowAttrs, colAttrs) {
|
|
1599
|
+
buildColTotals = function(tr, colHeaderCols, rowHeaderRows, rowAttrs, colAttrs) {
|
|
1410
1600
|
var h, isColSubtotal, k, len, results, style, td, totalAggregator, val;
|
|
1411
1601
|
results = [];
|
|
1412
1602
|
for (k = 0, len = colHeaderCols.length; k < len; k++) {
|
|
1413
1603
|
h = colHeaderCols[k];
|
|
1414
1604
|
isColSubtotal = h.children.length !== 0;
|
|
1605
|
+
|
|
1415
1606
|
totalAggregator = colTotals[h.flatKey];
|
|
1416
1607
|
if(!totalAggregator){
|
|
1417
1608
|
totalAggregator = {
|
|
@@ -1444,11 +1635,22 @@ let initDRPivotTable = function($, window, document) {
|
|
|
1444
1635
|
|
|
1445
1636
|
results.push(tr.appendChild(td));
|
|
1446
1637
|
}
|
|
1638
|
+
|
|
1639
|
+
if (additionalFieldsCol.length > 0) {
|
|
1640
|
+
for (let i = 0; i < additionalFieldsCol.length; i++) {
|
|
1641
|
+
const colKey = additionalFieldsCol[i].key;
|
|
1642
|
+
|
|
1643
|
+
td = buildAdditionalColTotals(tr, rowHeaderRows, colKey, h);
|
|
1644
|
+
results.push(tr.appendChild(td));
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1447
1648
|
createGrandTotalBolder(tr);
|
|
1448
1649
|
return results;
|
|
1449
1650
|
};
|
|
1450
1651
|
buildGrandTotal = function(result, tr, rowAttrs, colAttrs) {
|
|
1451
1652
|
var td, totalAggregator, val;
|
|
1653
|
+
|
|
1452
1654
|
totalAggregator = allTotal;
|
|
1453
1655
|
val = totalAggregator.value();
|
|
1454
1656
|
td = createElement("td", "pvtGrandTotal", getFormattedNumber(val, totalAggregator, opts), {
|
|
@@ -2154,10 +2356,20 @@ let initDRPivotTable = function($, window, document) {
|
|
|
2154
2356
|
}
|
|
2155
2357
|
if (rowAttrs.length > 0) {
|
|
2156
2358
|
buildRowHeaderHeaders(thead, rowHeaderHeaders, rowAttrs, colAttrs);
|
|
2359
|
+
|
|
2360
|
+
if (colAttrs.length === 0 && additionalFieldsCol.length > 0) {
|
|
2361
|
+
buildAdditionalHeaderCols(rowHeaderHeaders.tr, rowAttrs, colAttrs)
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2157
2364
|
if (colAttrs.length === 0 && opts.chartOptions.table_options.show_row_total) {
|
|
2158
2365
|
buildRowTotalsHeader(rowHeaderHeaders.tr, rowAttrs, colAttrs);
|
|
2159
2366
|
}
|
|
2160
2367
|
}
|
|
2368
|
+
|
|
2369
|
+
if (colAttrs.length > 0 && additionalFieldsCol.length > 0) {
|
|
2370
|
+
buildAdditionalHeaderCols(colHeaderHeaders[0].tr, rowAttrs, colAttrs)
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2161
2373
|
if (colAttrs.length > 0 && opts.chartOptions.table_options.show_row_total) {
|
|
2162
2374
|
buildRowTotalsHeader(colHeaderHeaders[0].tr, rowAttrs, colAttrs);
|
|
2163
2375
|
if(opts.chartOptions.table_options.colorize_headers == true){
|
|
@@ -2186,10 +2398,24 @@ let initDRPivotTable = function($, window, document) {
|
|
|
2186
2398
|
}
|
|
2187
2399
|
buildRowHeaderHeadersClickEvents(rowHeaderHeaders, rowHeaderRows, rowAttrs);
|
|
2188
2400
|
buildValues(rowHeaderRows, colHeaderCols, rowAttrs, colAttrs);
|
|
2401
|
+
|
|
2402
|
+
if (additionalFieldsRow.length > 0) {
|
|
2403
|
+
for (let i = 0; i < additionalFieldsRow.length; i++) {
|
|
2404
|
+
const field = additionalFieldsRow[i];
|
|
2405
|
+
tr = buildAdditionalHeaderRows(field.name, rowAttrs, colAttrs);
|
|
2406
|
+
|
|
2407
|
+
if (colAttrs.length > 0) {
|
|
2408
|
+
buildAdditionalRowValues(tr, colHeaderCols, field.key);
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
tbody.appendChild(tr);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2189
2415
|
if(opts.chartOptions.table_options.show_column_total){
|
|
2190
2416
|
tr = buildColTotalsHeader(rowAttrs, colAttrs);
|
|
2191
2417
|
if (colAttrs.length > 0) {
|
|
2192
|
-
buildColTotals(tr, colHeaderCols, rowAttrs, colAttrs);
|
|
2418
|
+
buildColTotals(tr, colHeaderCols, rowHeaderRows, rowAttrs, colAttrs);
|
|
2193
2419
|
}
|
|
2194
2420
|
if(opts.chartOptions.table_options.show_row_total)
|
|
2195
2421
|
buildGrandTotal(tbody, tr, rowAttrs, colAttrs);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
|
|
2
2
|
DataFormatter, lodash, moment_lib) {
|
|
3
3
|
|
|
4
|
+
if(!lodash){
|
|
5
|
+
lodash = _;
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
let useNewUx = false;
|
|
5
9
|
let useTotalsCalculation = false;
|
|
6
10
|
if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
|
|
@@ -19,10 +23,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
if(!lodash){
|
|
23
|
-
lodash = _;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
26
|
if(!moment_lib){
|
|
27
27
|
moment_lib = moment;
|
|
28
28
|
}
|
|
@@ -41,6 +41,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
41
41
|
highchartsRenderer.variance_color = default_colors.variance_color;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
const mobileBrowserRegex = new RegExp([
|
|
45
|
+
'(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)',
|
|
46
|
+
'|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/',
|
|
47
|
+
'|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino',
|
|
48
|
+
].join(''), 'i');
|
|
49
|
+
highchartsRenderer.isMobile = mobileBrowserRegex.test(navigator.userAgent);
|
|
50
|
+
|
|
44
51
|
highchartsRenderer.highcharts_theme = {
|
|
45
52
|
"colors": highchartsRenderer.defaults_colors,
|
|
46
53
|
"chart": {
|
|
@@ -1425,7 +1432,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1425
1432
|
}
|
|
1426
1433
|
|
|
1427
1434
|
highchartsRenderer.encodeHTMLBrackets = function (string) {
|
|
1428
|
-
return string.
|
|
1435
|
+
return string.replace(/</g, '<').replace(/>/g, '>');
|
|
1429
1436
|
};
|
|
1430
1437
|
|
|
1431
1438
|
highchartsRenderer.addSecondYAxis = function (pivotData, chartOptions, additionOptions, opts) {
|
|
@@ -4261,6 +4268,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4261
4268
|
}
|
|
4262
4269
|
|
|
4263
4270
|
if (typeof (value) != 'number') {
|
|
4271
|
+
const drAdditionalField = _.find($.pivotUtilities.additionalFieldsList, {key: value});
|
|
4272
|
+
if (drAdditionalField && drAdditionalField.key)
|
|
4273
|
+
return drAdditionalField.key;
|
|
4274
|
+
|
|
4264
4275
|
value = 0;
|
|
4265
4276
|
}
|
|
4266
4277
|
|
|
@@ -6624,12 +6635,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6624
6635
|
options = {};
|
|
6625
6636
|
} else {
|
|
6626
6637
|
options = options.replace(/(\r\n|\n|\r)/gm, "");
|
|
6627
|
-
|
|
6628
|
-
options = JSON.parse(options);
|
|
6629
|
-
} catch (e) {
|
|
6630
|
-
options = options.replaceAllC("{u'", "{'").replaceAllC(": u'", ": '").replaceAllC(", u'", ", '").replaceAllC("'", "\"")
|
|
6631
|
-
options = JSON.parse(options);
|
|
6632
|
-
}
|
|
6638
|
+
options = JSON.parse(options);
|
|
6633
6639
|
}
|
|
6634
6640
|
return options;
|
|
6635
6641
|
};
|
|
@@ -7415,6 +7421,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7415
7421
|
enabled: false,
|
|
7416
7422
|
};
|
|
7417
7423
|
|
|
7424
|
+
if ((!additionOptions.legends_position || additionOptions.legends_position.value !== 'none') && highchartsRenderer.isMobile) {
|
|
7425
|
+
return topPosition;
|
|
7426
|
+
}
|
|
7427
|
+
|
|
7418
7428
|
if (additionOptions.legends_position && additionOptions.legends_position.value) {
|
|
7419
7429
|
switch (additionOptions.legends_position.value) {
|
|
7420
7430
|
case 'top':
|