@datarailsshared/dr_renderer 1.2.63 → 1.2.67

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.63",
3
+ "version": "1.2.67",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -146,7 +146,7 @@ let initDRPivotTable = function($, window, document) {
146
146
  DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
147
147
  if (useTotalsCalculation) {
148
148
  if (!this.notFirst) {
149
- this.keysLength = Object.keys(record).length - 1;
149
+ this.keysLength = _.keys(record).length - 1;
150
150
  this.notFirst = true;
151
151
  }
152
152
  let getRowAggregator = (function(_this) {
@@ -213,9 +213,9 @@ let initDRPivotTable = function($, window, document) {
213
213
  var colKey, fColKey, fRowKey, flatColKey, flatRowKey, i, j, k, m, n, ref, results, rowKey;
214
214
  rowKey = [];
215
215
  colKey = [];
216
- const recordValues = Object.values(record);
217
- const containsAverage = recordValues.includes('DR_Average');
218
- const containsOthers = recordValues.includes('DR_Others');
216
+ const recordValues = _.values(record);
217
+ const containsAverage = _.includes(recordValues, 'DR_Average');
218
+ const containsOthers = _.includes(recordValues, 'DR_Others');
219
219
  if (!containsAverage && !containsOthers) {
220
220
  this.allTotal.push(record);
221
221
  }
@@ -485,6 +485,8 @@ 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 getAdditionalAggregation, buildAdditionalHeaderCols, buildAdditionalHeaderRows, buildAdditionalColValues, buildAdditionalRowValues, buildAdditionalRowTotals, buildAdditionalColTotals;
489
+ var additionalFieldsCol, additionalFieldsRow, additionalFieldsList;
488
490
  var edit_assumptions;
489
491
 
490
492
  var horizontalFreezePaneClass = opts.chartOptions.table_options.freeze_panes ? ' horizontal-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,143 @@ 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
+ let totalRowValue = 0;
1359
+
1360
+ for (let i = 0; i < colHeaderCols.length; i++) {
1361
+ const colKey = colHeaderCols[i].flatKey;
1362
+ const totalAggregator = getAdditionalAggregation(rowKey, colKey);
1363
+ const val = totalAggregator.value();
1364
+ const formattedValue = getFormattedNumber(val, totalAggregator, opts)
1365
+ totalRowValue += +formattedValue;
1366
+
1367
+ let className = " col" + i + " colcol" + 0;
1368
+ const td = createElement("td", className, formattedValue, {
1369
+ "data-value": val,
1370
+ "data-for": "col" + 0,
1371
+ "data-colnode": "" + i
1372
+ });
1373
+
1374
+ tr.appendChild(td);
1375
+ }
1376
+
1377
+ if(opts.chartOptions.table_options.show_row_total) {
1378
+ buildAdditionalRowTotals(tr, totalRowValue)
1379
+ }
1380
+ }
1381
+
1382
+ buildAdditionalRowTotals = function (tr, totalRowValue) {
1383
+ let style = "pvtTotal pvtAddFiled rowTotal";
1384
+
1385
+ const td = createElement("td", style, totalRowValue, {
1386
+ "data-value": totalRowValue
1387
+ });
1388
+
1389
+ tr.appendChild(td);
1390
+ }
1391
+
1392
+ buildAdditionalColTotals = function (tr, rowHeaderRows, colKey, colHeader) {
1393
+ let othersVal = 0;
1394
+ let val;
1395
+
1396
+ for (let i = 0; i < rowHeaderRows.length; i++) {
1397
+ const rowKey = rowHeaderRows[i].flatKey;
1398
+ const totalAggregator = getAdditionalAggregation(rowKey, colKey);
1399
+ val = totalAggregator.value();
1400
+
1401
+ othersVal += +getFormattedNumber(val, totalAggregator, opts);
1402
+ }
1403
+
1404
+ let style = "pvtTotal pvtAddField colTotal";
1405
+ style += " col" + colHeader.row + " colcol" + colHeader.col;
1406
+
1407
+ const td = createElement("td", style, othersVal, {
1408
+ "data-value": othersVal,
1409
+ "data-rowcol": "col" + colHeader.col,
1410
+ "data-rownode": "" + colHeader.node
1411
+ }, getTableEventHandlers(othersVal, [], colHeader.key));
1412
+
1413
+
1414
+ return td;
1415
+ }
1416
+
1257
1417
  buildValues = function(rowHeaderRows, colHeaderCols, rowAttrs, colAttrs) {
1258
1418
  var aggregator, colHeader, eventHandlers, flatColKey, flatRowKey, isColSubtotal, isRowSubtotal, k, l, len, len1, ref8, results, rowHeader, style, td, totalAggregator, tr, val;
1419
+
1259
1420
  results = [];
1260
1421
  for (k = 0, len = rowHeaderRows.length; k < len; k++) {
1261
1422
  rowHeader = rowHeaderRows[k];
@@ -1305,6 +1466,11 @@ let initDRPivotTable = function($, window, document) {
1305
1466
 
1306
1467
  tr.appendChild(td);
1307
1468
  }
1469
+
1470
+ if (additionalFieldsCol.length > 0) {
1471
+ buildAdditionalColValues(tr, flatRowKey, rowHeader);
1472
+ }
1473
+
1308
1474
  totalAggregator = rowTotals[flatRowKey];
1309
1475
  if(!totalAggregator){
1310
1476
  totalAggregator = {
@@ -1406,12 +1572,13 @@ let initDRPivotTable = function($, window, document) {
1406
1572
  tr.appendChild(th);
1407
1573
  return tr;
1408
1574
  };
1409
- buildColTotals = function(tr, colHeaderCols, rowAttrs, colAttrs) {
1575
+ buildColTotals = function(tr, colHeaderCols, rowHeaderRows, rowAttrs, colAttrs) {
1410
1576
  var h, isColSubtotal, k, len, results, style, td, totalAggregator, val;
1411
1577
  results = [];
1412
1578
  for (k = 0, len = colHeaderCols.length; k < len; k++) {
1413
1579
  h = colHeaderCols[k];
1414
1580
  isColSubtotal = h.children.length !== 0;
1581
+
1415
1582
  totalAggregator = colTotals[h.flatKey];
1416
1583
  if(!totalAggregator){
1417
1584
  totalAggregator = {
@@ -1444,11 +1611,22 @@ let initDRPivotTable = function($, window, document) {
1444
1611
 
1445
1612
  results.push(tr.appendChild(td));
1446
1613
  }
1614
+
1615
+ if (additionalFieldsCol.length > 0) {
1616
+ for (let i = 0; i < additionalFieldsCol.length; i++) {
1617
+ const colKey = additionalFieldsCol[i].key;
1618
+
1619
+ td = buildAdditionalColTotals(tr, rowHeaderRows, colKey, h);
1620
+ results.push(tr.appendChild(td));
1621
+ }
1622
+ }
1623
+
1447
1624
  createGrandTotalBolder(tr);
1448
1625
  return results;
1449
1626
  };
1450
1627
  buildGrandTotal = function(result, tr, rowAttrs, colAttrs) {
1451
1628
  var td, totalAggregator, val;
1629
+
1452
1630
  totalAggregator = allTotal;
1453
1631
  val = totalAggregator.value();
1454
1632
  td = createElement("td", "pvtGrandTotal", getFormattedNumber(val, totalAggregator, opts), {
@@ -2115,7 +2293,7 @@ let initDRPivotTable = function($, window, document) {
2115
2293
  };
2116
2294
 
2117
2295
  selectFreezableElements = function(wrapper) {
2118
- const selectString =_.map(Object.values(elementToTransform), function (item) {
2296
+ const selectString =_.map(_.values(elementToTransform), function (item) {
2119
2297
  return `.${item.replace(' ', '')}`;
2120
2298
  }).join(',');
2121
2299
  return Array.from(wrapper.querySelectorAll(selectString));
@@ -2154,10 +2332,20 @@ let initDRPivotTable = function($, window, document) {
2154
2332
  }
2155
2333
  if (rowAttrs.length > 0) {
2156
2334
  buildRowHeaderHeaders(thead, rowHeaderHeaders, rowAttrs, colAttrs);
2335
+
2336
+ if (colAttrs.length === 0 && additionalFieldsCol.length > 0) {
2337
+ buildAdditionalHeaderCols(rowHeaderHeaders.tr, rowAttrs, colAttrs)
2338
+ }
2339
+
2157
2340
  if (colAttrs.length === 0 && opts.chartOptions.table_options.show_row_total) {
2158
2341
  buildRowTotalsHeader(rowHeaderHeaders.tr, rowAttrs, colAttrs);
2159
2342
  }
2160
2343
  }
2344
+
2345
+ if (colAttrs.length > 0 && additionalFieldsCol.length > 0) {
2346
+ buildAdditionalHeaderCols(colHeaderHeaders[0].tr, rowAttrs, colAttrs)
2347
+ }
2348
+
2161
2349
  if (colAttrs.length > 0 && opts.chartOptions.table_options.show_row_total) {
2162
2350
  buildRowTotalsHeader(colHeaderHeaders[0].tr, rowAttrs, colAttrs);
2163
2351
  if(opts.chartOptions.table_options.colorize_headers == true){
@@ -2186,10 +2374,24 @@ let initDRPivotTable = function($, window, document) {
2186
2374
  }
2187
2375
  buildRowHeaderHeadersClickEvents(rowHeaderHeaders, rowHeaderRows, rowAttrs);
2188
2376
  buildValues(rowHeaderRows, colHeaderCols, rowAttrs, colAttrs);
2377
+
2378
+ if (additionalFieldsRow.length > 0) {
2379
+ for (let i = 0; i < additionalFieldsRow.length; i++) {
2380
+ const field = additionalFieldsRow[i];
2381
+ tr = buildAdditionalHeaderRows(field.name, rowAttrs, colAttrs);
2382
+
2383
+ if (colAttrs.length > 0) {
2384
+ buildAdditionalRowValues(tr, colHeaderCols, field.key);
2385
+ }
2386
+
2387
+ tbody.appendChild(tr);
2388
+ }
2389
+ }
2390
+
2189
2391
  if(opts.chartOptions.table_options.show_column_total){
2190
2392
  tr = buildColTotalsHeader(rowAttrs, colAttrs);
2191
2393
  if (colAttrs.length > 0) {
2192
- buildColTotals(tr, colHeaderCols, rowAttrs, colAttrs);
2394
+ buildColTotals(tr, colHeaderCols, rowHeaderRows, rowAttrs, colAttrs);
2193
2395
  }
2194
2396
  if(opts.chartOptions.table_options.show_row_total)
2195
2397
  buildGrandTotal(tbody, tr, rowAttrs, colAttrs);
@@ -1,10 +1,14 @@
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) {
7
- useTotalsCalculation = _.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
11
+ useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
8
12
  useNewUx = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.use_new_ux;
9
13
  }
10
14
  const textColor = "#151a41";
@@ -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": {
@@ -1020,7 +1027,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1020
1027
  if (lodash.isArray(columnKey)) {
1021
1028
  totalKey = totalKey.join(' , ');
1022
1029
  }
1023
- newSeries.data.push(pivotData.colTotals[totalKey].sum);
1030
+ const value = pivotData.colTotals[totalKey] ? pivotData.colTotals[totalKey].value() : 0;
1031
+ newSeries.data.push(value);
1024
1032
  })
1025
1033
 
1026
1034
  chart_series.push(newSeries);
@@ -1153,7 +1161,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1153
1161
 
1154
1162
  let weights = { line: 2,spline: 3 ,area:-2, areaspline: -1, scatter:4, column: 1 };
1155
1163
 
1156
- if (opts.comboOptions && chartType.includes('combo') && !lodash.isEqual(row_n_keys, [[]])) {
1164
+ if (opts.comboOptions && lodash.includes(chartType,'combo') && !lodash.isEqual(row_n_keys, [[]])) {
1157
1165
  chart_series.forEach((series, seriesIndex) => {
1158
1166
  const savedSeriesOption = lodash.find(opts.comboOptions.seriesOptions, {series: series.name});
1159
1167
  if (savedSeriesOption) {
@@ -1175,12 +1183,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1175
1183
  if (opts.total) {
1176
1184
  const totalSeries = lodash.clone(ethalonSeries);
1177
1185
  if (opts.totalSeriesSettings) {
1178
- if (chartType.includes('combo')) {
1186
+ if (lodash.includes(chartType, 'combo')) {
1179
1187
  highchartsRenderer.setChartTypeBySeriesType(opts.totalSeriesSettings.chartType, totalSeries);
1180
1188
  }
1181
1189
 
1182
1190
  totalSeries.yAxis = opts.totalSeriesSettings.secondaryAxis ? 1 : undefined;
1183
- } else if (chartType.includes('combo')) {
1191
+ } else if (lodash.includes(chartType,'combo')) {
1184
1192
  if (has_delta) {
1185
1193
  totalSeries.type = 'column';
1186
1194
  } else {
@@ -1197,7 +1205,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1197
1205
  key = columnKey[0];
1198
1206
  totalKey = totalKey.join(' , ');
1199
1207
  }
1200
- totalSeries.data.push({name: lodash.unescape(key), y: pivotData.colTotals[totalKey].sum});
1208
+ const value = pivotData.colTotals[totalKey] ? pivotData.colTotals[totalKey].value() : 0;
1209
+ totalSeries.data.push({name: lodash.unescape(key), y: value});
1201
1210
  });
1202
1211
 
1203
1212
  chart_series.push(totalSeries);
@@ -1423,7 +1432,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1423
1432
  }
1424
1433
 
1425
1434
  highchartsRenderer.encodeHTMLBrackets = function (string) {
1426
- return string.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
1435
+ return string.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1427
1436
  };
1428
1437
 
1429
1438
  highchartsRenderer.addSecondYAxis = function (pivotData, chartOptions, additionOptions, opts) {
@@ -1998,7 +2007,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1998
2007
  };
1999
2008
 
2000
2009
  highchartsRenderer.setTitleAndSubTitle = function (chartOptions, opts, additionOptions) {
2001
- chartOptions.title = opts.chartOptions.hideChartHeader ? null : {
2010
+ chartOptions.title = opts.chartOptions.hideChartHeader ? { text: '' } : {
2002
2011
  align: 'center',
2003
2012
  text: opts && opts.chart_title ? opts.chart_title : "",
2004
2013
  style: {
@@ -3026,13 +3035,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3026
3035
 
3027
3036
  highchartsRenderer.ignoreIfCalculatedValue = function(data, rowKey, colKey, record, associatedFields, renderOptions, isGraph) {
3028
3037
  var eliminate = renderOptions && renderOptions.chartOptions && renderOptions.chartOptions.table_options &&
3029
- renderOptions.chartOptions.table_options.eliminate_calc_totals && !_.isEmpty(associatedFields) && !isGraph;
3038
+ renderOptions.chartOptions.table_options.eliminate_calc_totals && !lodash.isEmpty(associatedFields) && !isGraph;
3030
3039
  let ignore = false;
3031
3040
 
3032
3041
  if (eliminate && !(data.colAttrs.length === colKey.length && data.rowAttrs.length === rowKey.length)) {
3033
- const keys = Object.keys(associatedFields);
3034
- _.forEach(keys, key => {
3035
- if (~_.indexOf(associatedFields[key], record[key]) || ~_.indexOf(associatedFields[key], record['DR_Values'])) {
3042
+ const keys = lodash.keys(associatedFields);
3043
+ lodash.forEach(keys, key => {
3044
+ if (~lodash.indexOf(associatedFields[key], record[key]) || ~lodash.indexOf(associatedFields[key], record['DR_Values'])) {
3036
3045
  ignore = true;
3037
3046
  }
3038
3047
  });
@@ -4129,14 +4138,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4129
4138
  formats: {},
4130
4139
  associated_fields: {},
4131
4140
  };
4132
- _.forEach(widget.calculated_values, item => {
4141
+ lodash.forEach(widget.calculated_values, item => {
4133
4142
  calculated_values_info.formats[item.name] = item.format
4134
4143
 
4135
4144
  let fieldName = item.field_name;
4136
4145
 
4137
4146
  if (!fieldName) {
4138
- const sourceArr = _.concat(widget.cols, widget.rows);
4139
- const filed = _.find(sourceArr, {id: item.field})
4147
+ const sourceArr = lodash.concat(widget.cols, widget.rows);
4148
+ const filed = lodash.find(sourceArr, {id: item.field})
4140
4149
  fieldName = filed ? filed.name : '';
4141
4150
  }
4142
4151
 
@@ -4259,6 +4268,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4259
4268
  }
4260
4269
 
4261
4270
  if (typeof (value) != 'number') {
4271
+ const drAdditionalField = _.find($.pivotUtilities.additionalFieldsList, {key: value});
4272
+ if (drAdditionalField && drAdditionalField.key)
4273
+ return drAdditionalField.key;
4274
+
4262
4275
  value = 0;
4263
4276
  }
4264
4277
 
@@ -4426,7 +4439,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4426
4439
  };
4427
4440
 
4428
4441
  highchartsRenderer.updateBackwardCompatibleWidgetOptions = function(options, type) {
4429
- if (_.get(options, 'chartOptions.chart.hideLegends', false)) {
4442
+ if (lodash.get(options, 'chartOptions.chart.hideLegends', false)) {
4430
4443
  options.chartOptions.legends_position = { value: 'none' };
4431
4444
  delete options.chartOptions.chart.hideLegends;
4432
4445
  }
@@ -6622,12 +6635,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
6622
6635
  options = {};
6623
6636
  } else {
6624
6637
  options = options.replace(/(\r\n|\n|\r)/gm, "");
6625
- try {
6626
- options = JSON.parse(options);
6627
- } catch (e) {
6628
- options = options.replaceAllC("{u'", "{'").replaceAllC(": u'", ": '").replaceAllC(", u'", ", '").replaceAllC("'", "\"")
6629
- options = JSON.parse(options);
6630
- }
6638
+ options = JSON.parse(options);
6631
6639
  }
6632
6640
  return options;
6633
6641
  };
@@ -7413,6 +7421,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7413
7421
  enabled: false,
7414
7422
  };
7415
7423
 
7424
+ if ((!additionOptions.legends_position || additionOptions.legends_position.value !== 'none') && highchartsRenderer.isMobile) {
7425
+ return topPosition;
7426
+ }
7427
+
7416
7428
  if (additionOptions.legends_position && additionOptions.legends_position.value) {
7417
7429
  switch (additionOptions.legends_position.value) {
7418
7430
  case 'top':
@@ -108,7 +108,7 @@ let initNovixRenderer = function($, window, document, Handsontable){
108
108
  visibility: 'hidden',
109
109
  };
110
110
  let td = document.createElement('td');
111
- for (let [key, value] of Object.entries(tdStyles)) {
111
+ for (let [key, value] of _.entries(tdStyles)) {
112
112
  td.style[key] = value;
113
113
  };
114
114
  td.innerHTML = item.str;