@datarailsshared/dr_renderer 1.2.177-dragons → 1.2.179

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.177-dragons",
3
+ "version": "1.2.179",
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 = _.filter(_.keys(record), key => !['data_types', 'formats', 'values_formats'].includes(key)).length - 1;
149
+ this.keysLength = _.filter(_.keys(record), key => !_.includes(['data_types', 'formats', 'values_formats'], key)).length - 1;
150
150
  this.notFirst = true;
151
151
  }
152
152
  let getRowAggregator = (function(_this) {
@@ -458,7 +458,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
458
458
 
459
459
  const labelOptions = lodash.get(opts.chartOptions, 'label') || lodash.get(opts.chartOptions, 'label_pie');
460
460
  const othersName = opts.total_value_options ?
461
- lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others' :
461
+ highchartsRenderer.getOthersName(opts) :
462
462
  undefined;
463
463
  var drOthersInColumn = lodash.find(
464
464
  pivotData.getColKeys(),
@@ -1013,16 +1013,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1013
1013
  if (row_n_keys.length == 0)
1014
1014
  row_n_keys.push([]);
1015
1015
 
1016
- if (!col_n_keys.length && lodash.get(chartOptions, "chart.type") === 'kpi' && isUniqueVals) {
1017
- col_n_keys.push([]);
1018
- }
1019
-
1020
1016
  var i = 0;
1021
1017
  var variat_serias = null;
1022
1018
  const n = col_n_keys.length;
1023
1019
  const xSum = (1 + n) / 2 * n;
1024
1020
  const trendSerieses = [];
1025
- const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
1021
+ const othersName = highchartsRenderer.getOthersName(opts);
1026
1022
 
1027
1023
  lodash.forEach(row_n_keys, function (row_n_value) {
1028
1024
  var ob = {};
@@ -1170,7 +1166,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1170
1166
  const n = col_n_keys.length;
1171
1167
  const xSum = (1 + n) / 2 * n;
1172
1168
  const trendSerieses = [];
1173
- const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
1169
+ const othersName = highchartsRenderer.getOthersName(opts);
1174
1170
 
1175
1171
  lodash.forEach(row_n_keys, function (row_n_value) {
1176
1172
  let ySum = 0;
@@ -1543,7 +1539,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1543
1539
  var num_rows = row_n_keys.length;
1544
1540
 
1545
1541
  const isOthersIncludedInRow = num_rows === 1 && lodash.includes(row_n_keys[0], 'DR_Others');
1546
- const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
1542
+ const othersName = highchartsRenderer.getOthersName(opts);
1547
1543
 
1548
1544
  lodash.forEach(col_n_keys, function (col_n_value) {
1549
1545
  const row_n_value = isOthersIncludedInRow ? row_n_keys[0] : [];
@@ -1590,7 +1586,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1590
1586
  var num_cols = col_n_keys.length;
1591
1587
  var num_rows = row_n_keys.length;
1592
1588
 
1593
- const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
1589
+ const othersName = highchartsRenderer.getOthersName(opts);
1594
1590
 
1595
1591
  lodash.forEach(col_n_keys, function (col_n_value) {
1596
1592
  var col_ob = {};
@@ -2101,13 +2097,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2101
2097
  var kpioptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart('kpi');
2102
2098
 
2103
2099
  chartOptions.chart = {
2104
- type: 'kpi'
2100
+ type: ''
2105
2101
  };
2106
2102
  if (disableAnimation) {
2107
2103
  chartOptions.chart.animation = false;
2108
2104
  }
2109
2105
  var uniqueVals = kpioptions.value.value == "Unique";
2110
2106
 
2107
+ if (!pivotData.colKeys.length) {
2108
+ pivotData.colKeys.push([]);
2109
+ }
2110
+
2111
2111
  let temp_series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, true, uniqueVals, null, opts, chartOptions);
2112
2112
 
2113
2113
  var total = [];
@@ -4354,16 +4354,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4354
4354
  const breakdownSettings = widget.options.breakdown_options.settings;
4355
4355
  const maxCategories = breakdownSettings.maxCategoriesCount;
4356
4356
  const minCategories = breakdownSettings.minCategoriesCount;
4357
- const categoryFieldName = widget.cols[0].name;
4358
- const uniqueCategories = lodash.filter(lodash.uniq(lodash.map(rowData, row => row[categoryFieldName])), value => !!value);
4357
+ const uniqueCategories = lodash.filter(
4358
+ lodash.uniq(
4359
+ lodash.map(rowData, row => row[widget.cols[0].name])
4360
+ ),
4361
+ value => !!value
4362
+ );
4359
4363
 
4360
4364
  if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
4361
- const commonErrorSentence = `Please choose ${minCategories}-${maxCategories} items in the Category section.`
4365
+ const commonErrorSentence = `Please choose ${ minCategories }-${ maxCategories } items in the Category section.`
4362
4366
  options.error_has_occurred = true;
4363
4367
  options.error_params = {
4364
4368
  title: uniqueCategories.length > maxCategories
4365
- ? `There is too much data. ${commonErrorSentence}`
4366
- : `Not enough data. ${commonErrorSentence}`,
4369
+ ? `There is too much data. ${ commonErrorSentence }`
4370
+ : `Not enough data. ${ commonErrorSentence }`,
4367
4371
  text: '',
4368
4372
  btnText: 'Edit Widget',
4369
4373
  class: 'too-much-data',
@@ -8167,7 +8171,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8167
8171
  if ($.pivotUtilities && !$.pivotUtilities.additionalFieldsList) {
8168
8172
  $.pivotUtilities.additionalFieldsList = [
8169
8173
  {key: 'DR_Average', name: 'DR_Average'},
8170
- {key: 'DR_Others', name: _.get(widget.options, "total_value_options.filter_options.filteredOutFieldName") || 'Others'}
8174
+ {key: 'DR_Others', name: highchartsRenderer.getOthersName(widget.options)}
8171
8175
  ];
8172
8176
  }
8173
8177