@datarailsshared/dr_renderer 1.2.341 → 1.2.343

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.341",
3
+ "version": "1.2.343",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -143,6 +143,7 @@ const FEATURES = {
143
143
  ENABLE_NEW_WIDGET_VALUE_FORMATTING: 'enable_new_widget_value_formatting',
144
144
  ENABLE_SERVER_TOTALS_CALCULATION: 'enable_server_totals_calculation',
145
145
  FORMAT_AXIS: 'use_default_table_format_for_axis',
146
+ DASHBOARD_INSIGHT_TOOLTIP_RELATIVE_POSITION: 'dashboard_insight_tooltip_relative_position',
146
147
  }
147
148
 
148
149
  const TICKS_COUNT = 5;
@@ -175,11 +176,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
175
176
 
176
177
  highchartsRenderer.useTotalsCalculation = false;
177
178
  highchartsRenderer.enabledNewWidgetValueFormatting = false;
179
+ highchartsRenderer.relativePositionForInsightTooltips = false;
178
180
  let disableAnimation = false;
179
181
  if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
180
182
  highchartsRenderer.useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, FEATURES.ENABLE_SERVER_TOTALS_CALCULATION);
181
183
  disableAnimation = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.disable_animation
182
184
  highchartsRenderer.enabledNewWidgetValueFormatting = lodash.includes(document.ReportHippo.user.features, FEATURES.ENABLE_NEW_WIDGET_VALUE_FORMATTING);
185
+ highchartsRenderer.relativePositionForInsightTooltips = lodash.includes(document.ReportHippo.user.features, FEATURES.DASHBOARD_INSIGHT_TOOLTIP_RELATIVE_POSITION);
183
186
  }
184
187
 
185
188
  // fix issue of use tootip.stickOnContact with tooltip.outside , source: https://github.com/highcharts/highcharts/pull/15960
@@ -683,7 +686,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
683
686
  highchartsRenderer.customFormatterTooltipInsights = function(pivotData, opts) {
684
687
  return {
685
688
  useHTML: true,
686
- outside: true,
689
+ outside: !highchartsRenderer.relativePositionForInsightTooltips,
687
690
  backgroundColor: 'transparent',
688
691
  borderWidth: 0,
689
692
  borderRadius: 0,
@@ -5009,7 +5012,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5009
5012
  })
5010
5013
  };
5011
5014
 
5012
- highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
5015
+ highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert, isFormattingNumbers) {
5013
5016
  if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
5014
5017
  return value;
5015
5018
  }
@@ -5074,8 +5077,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5074
5077
  return 'Wrong date format';
5075
5078
  }
5076
5079
  } else {
5080
+ const isFormatting = highchartsRenderer.isFormattingAxisFeatureOn() && isFormattingNumbers && format && !isNaN(value);
5077
5081
  if (value === null || value === '[null]') {
5078
5082
  return '[null]';
5083
+ } else if (isFormatting) {
5084
+ return highchartsRenderer.formatValue('n', format, value).value;
5079
5085
  }
5080
5086
  }
5081
5087
 
@@ -8010,7 +8016,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8010
8016
  suboptions: []
8011
8017
  };
8012
8018
 
8013
- highchartsRenderer.getFilterLabel = function (fieldFilter, showTemplateName) {
8019
+ highchartsRenderer.getFilterLabel = function (fieldFilter, showTemplateName, isFormattingNumbers) {
8014
8020
  var displayname;
8015
8021
  if (fieldFilter.new_name)
8016
8022
  displayname = fieldFilter.new_name.replace('RH_DIM_', '');
@@ -8033,7 +8039,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8033
8039
  var tooltip = '';
8034
8040
  var all_vals = [];
8035
8041
  if (fieldFilter.type == 'Date') {
8036
- all_vals = [];
8037
8042
  var invertValueFormatMap = lodash.invert(fieldFilter.valueFormatMap);
8038
8043
  lodash.forEach(fieldFilter.includes, function (val) {
8039
8044
  if (invertValueFormatMap && invertValueFormatMap[val]) {
@@ -8043,6 +8048,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8043
8048
  }
8044
8049
  all_vals.push(val);
8045
8050
  });
8051
+ } else if (isFormattingNumbers && highchartsRenderer.isFormattingAxisFeatureOn()) {
8052
+ all_vals = lodash.map(lodash.cloneDeep(fieldFilter.includes), val =>
8053
+ highchartsRenderer.returnRawDataValue(fieldFilter.type, val, fieldFilter.format || '', null, null, true) + ""
8054
+ );
8046
8055
  } else {
8047
8056
  all_vals = lodash.clone(fieldFilter.includes);
8048
8057
  }
@@ -9333,7 +9342,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9333
9342
  }
9334
9343
 
9335
9344
  highchartsRenderer.isFormattingAxis = function (pivotData) {
9336
- return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), FEATURES.FORMAT_AXIS) && pivotData.isFormattingAxisLabels;
9345
+ return highchartsRenderer.isFormattingAxisFeatureOn() && pivotData.isFormattingAxisLabels;
9346
+ }
9347
+
9348
+ highchartsRenderer.isFormattingAxisFeatureOn = function () {
9349
+ return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), FEATURES.FORMAT_AXIS);
9337
9350
  }
9338
9351
 
9339
9352
  // Method for getting formatted kyes for Axis (cols, rows)