@datarailsshared/dr_renderer 1.2.295 → 1.2.297

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.295",
3
+ "version": "1.2.297",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -502,7 +502,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
502
502
  var topSlot = '';
503
503
  if (labelOpts.show_percentage_in_labels) {
504
504
  rightSlot = `(${(this.point.percentage).toFixed(2)}%)`;
505
- if (labelOpts.show_value_in_labels && value) topSlot = `${value}<br>`;
505
+ if (labelOpts.show_value_in_labels && value) {
506
+ topSlot = `${value}<br>`;
507
+ }
506
508
  } else if (labelOpts.show_value_in_labels && value) {
507
509
  rightSlot = value;
508
510
  }
@@ -540,7 +542,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
540
542
 
541
543
  const labelOptions = lodash.get(opts.chartOptions, 'label') || lodash.get(opts.chartOptions, 'label_pie');
542
544
  const othersName = opts.total_value_options ? highchartsRenderer.getOthersName(opts) : undefined;
543
- const drOthersInAxis = highchartsRenderer.getDrOthersInAxisState(pivotData, othersName);
545
+ const drOthersInAxis = pivotData ? highchartsRenderer.getDrOthersInAxisState(pivotData, othersName) : {};
544
546
 
545
547
  var func = function () {
546
548
  var value = parseFloat(this.y);
@@ -687,8 +689,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
687
689
  stickOnContact: true,
688
690
  hideDelay: 1500,
689
691
  formatter: function () {
690
- const rowKey = pivotData.rowAttrs.length ? _.get(this.point, 'series.name') || "" : "";
691
- const colKey = _.get(this.point, 'name') || this.x.name[0] || "";
692
+ const rowKey = pivotData.rowAttrs.length ? lodash.get(this.point, 'series.name') || "" : "";
693
+ const colKey = lodash.get(this.point, 'name') || this.x.name[0] || "";
692
694
  const insight = pivotData.getInsight(colKey, rowKey) || {};
693
695
  setTimeout(() => {
694
696
  var aggr = highchartsRenderer.defaultFormatterToTooltip(pivotData, opts);
@@ -717,7 +719,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
717
719
  }
718
720
 
719
721
  const othersName = opts.total_value_options ? highchartsRenderer.getOthersName(opts) : undefined;
720
- const drOthersInAxis = highchartsRenderer.getDrOthersInAxisState(pivotData, othersName);
722
+ const drOthersInAxis = pivotData ? highchartsRenderer.getDrOthersInAxisState(pivotData, othersName) : {};
721
723
 
722
724
  var func = function () {
723
725
  const isWaterfallBreakdown = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_BREAKDOWN;
@@ -1598,7 +1600,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1598
1600
  if (value.trend === 'total') {
1599
1601
  keys = value.key;
1600
1602
  } else {
1601
- _.forEach(value.key, (item) => {
1603
+ lodash.forEach(value.key, (item) => {
1602
1604
  const findKeyByValue = lodash.find(
1603
1605
  Object.keys(pivotData.dateValuesDictionary || {}),
1604
1606
  key => pivotData.dateValuesDictionary[key] === item
@@ -3579,7 +3581,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3579
3581
  chartOptions.legend.useHTML = true;
3580
3582
  chartOptions.legend.labelFormatter = function() {
3581
3583
  const name = this.name;
3582
- const findTotal = _.find(this.options.data, {isTotal: true});
3584
+ const findTotal = lodash.find(this.options.data, {isTotal: true});
3583
3585
  const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3584
3586
  return `<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: ${color};
3585
3587
  width: 12px; height: 12px; border-radius: 50%"></span>
@@ -3699,7 +3701,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3699
3701
  chartOptions.legend.useHTML = true;
3700
3702
  chartOptions.legend.labelFormatter = function() {
3701
3703
  const name = this.options.className ? 'Total': this.name;
3702
- const findTotal = _.find(this.options.data, {isTotal: true});
3704
+ const findTotal = lodash.find(this.options.data, {isTotal: true});
3703
3705
  const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3704
3706
  return '<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: '+ color + '; width: 12px; height: 12px; border-radius: 50%"></span><span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">' + name + '</span>';
3705
3707
  }
@@ -4936,7 +4938,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4936
4938
  }
4937
4939
 
4938
4940
  if (typeof (value) != 'number') {
4939
- const drAdditionalField = _.find($.pivotUtilities.additionalFieldsList, {key: value});
4941
+ const drAdditionalField = lodash.find($.pivotUtilities.additionalFieldsList, {key: value});
4940
4942
  if (drAdditionalField && drAdditionalField.key)
4941
4943
  return drAdditionalField.key;
4942
4944
 
@@ -8045,8 +8047,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8045
8047
  };
8046
8048
  }
8047
8049
  } else {
8048
- if (fieldFilter && fieldFilter.type && fieldFilter.type === 'Date'
8049
- && fieldFilter.datetypevalues && fieldFilter.datetypevalues) {
8050
+ if (fieldFilter && fieldFilter.type && fieldFilter.type === 'Date' && fieldFilter.datetypevalues) {
8050
8051
  if (fieldFilter.datetypevalues.datetype === "frame") {
8051
8052
  displayname += ` (${fieldFilter.datetypevalues.val.timeframe})`;
8052
8053
  } else if (fieldFilter.datetypevalues.datetype === "range") {
@@ -8058,7 +8059,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8058
8059
  // range timestamps currently are set presupposing that user selects UTC dates,
8059
8060
  // that is why for consistency we also should show in filters values which user selected
8060
8061
  // and not local dates, that can differ
8061
- _.forEach(Object.keys(dates), key => {
8062
+ lodash.forEach(Object.keys(dates), key => {
8062
8063
  const dateConfiguration = dates[key];
8063
8064
  const timestamp = dateConfiguration.timestamp;
8064
8065
  if (timestamp) {
@@ -8124,7 +8125,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8124
8125
  highchartsRenderer.getDashboardOverrideValues = function (data_model, graph, local_current_dashboard) {
8125
8126
  let overrideValues = [];
8126
8127
 
8127
- if (!local_current_dashboard == undefined) {
8128
+ if (!local_current_dashboard) {
8128
8129
  local_current_dashboard = data_model.current_dashboard;
8129
8130
  }
8130
8131
 
@@ -8200,11 +8201,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8200
8201
  local_current_dashboard = data_model.current_dashboard;
8201
8202
  }
8202
8203
 
8203
- if (local_current_dashboard.date_tags.length > 0) {
8204
+ if (local_current_dashboard.date_tags && local_current_dashboard.date_tags.length > 0) {
8204
8205
  return 'date_tags';
8205
8206
  }
8206
8207
 
8207
- if (local_current_dashboard.plan_tags.length > 0) {
8208
+ if (local_current_dashboard.plan_tags && local_current_dashboard.plan_tags.length > 0) {
8208
8209
  return 'plan_tags';
8209
8210
  }
8210
8211
  };
@@ -8230,7 +8231,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8230
8231
  };
8231
8232
 
8232
8233
  highchartsRenderer.getDashboardApplyScenarios = function (data_model, graph, local_current_dashboard) {
8233
- if (!local_current_dashboard == undefined) {
8234
+ if (local_current_dashboard == undefined) {
8234
8235
  local_current_dashboard = data_model.current_dashboard;
8235
8236
  }
8236
8237
 
@@ -8256,7 +8257,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8256
8257
  };
8257
8258
 
8258
8259
  highchartsRenderer.isDate = function (date) {
8259
- return ((new Date(date) !== "Invalid Date" && !isNaN(new Date(date))));
8260
+ return new Date(date) !== "Invalid Date" && !isNaN(new Date(date));
8260
8261
  };
8261
8262
 
8262
8263
  highchartsRenderer.isDateFormat = function (datestr, format) {
@@ -8264,7 +8265,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8264
8265
  };
8265
8266
 
8266
8267
  highchartsRenderer.containsIgnoreCase = function (str, it) {
8267
- return str.toLowerCase().indexOf(it) != -1;
8268
+ return str.toLowerCase().indexOf(it.toLowerCase()) != -1;
8268
8269
  };
8269
8270
 
8270
8271
  highchartsRenderer.createDateTypeFromValue = function (fieldnametoFilter, format, colName) {
@@ -9100,7 +9101,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9100
9101
 
9101
9102
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
9102
9103
  const aggregationConfig = widget.options && widget.options.date_aggregation_configs
9103
- ? _.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
9104
+ ? lodash.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
9104
9105
  : null;
9105
9106
 
9106
9107
  if (aggregationConfig && aggregationConfig.aggregate_by && aggregationConfig.is_formatting_by_aggregation_method) {
@@ -9174,7 +9175,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9174
9175
  rowData.splice(rowIndex, 1);
9175
9176
  } else {
9176
9177
  const totalRow = {};
9177
- _.forEach(categoryFields, (field, fieldKey) => {
9178
+ lodash.forEach(categoryFields, (field, fieldKey) => {
9178
9179
  totalRow[field.name] = value.key[fieldKey];
9179
9180
  });
9180
9181
  totalRow[valueField.name] = sum;
@@ -9232,7 +9233,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9232
9233
  });
9233
9234
  }
9234
9235
 
9235
-
9236
9236
  highchartsRenderer.getFiscalYearMonthModifier = function() {
9237
9237
  return lodash.get(document, 'ReportHippo.user.organization.fiscal_year_starts_from', 1) - 1;
9238
9238
  }