@datarailsshared/dr_renderer 1.2.340 → 1.2.342

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.340",
3
+ "version": "1.2.342",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1243,14 +1243,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1243
1243
  i++;
1244
1244
  });
1245
1245
 
1246
- lodash.forEach(col_n_keys, (col_n_value, index) => {
1247
- if (lodash.isArray(col_n_value)) {
1248
- col_n_keys[index] = lodash.map(
1249
- lodash.filter(col_n_value, value => !!value),
1250
- value => lodash.replace(value, highchartsRenderer.DR_OTHERS_KEY, othersName)
1251
- );
1252
- }
1253
- });
1246
+ if (lodash.get(chartOptions, 'xAxis.categories')) {
1247
+ lodash.forEach(chartOptions.xAxis.categories, (col_n_value, index) => {
1248
+ if (lodash.isArray(col_n_value)) {
1249
+ chartOptions.xAxis.categories[index] = lodash.map(
1250
+ lodash.filter(col_n_value, value => !!value),
1251
+ value => lodash.replace(value, highchartsRenderer.DR_OTHERS_KEY, othersName)
1252
+ );
1253
+ }
1254
+ });
1255
+ }
1254
1256
 
1255
1257
  const ethalonSeries = chart_series[chart_series.length - 1];
1256
1258
 
@@ -5007,7 +5009,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5007
5009
  })
5008
5010
  };
5009
5011
 
5010
- highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
5012
+ highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert, isFormattingNumbers) {
5011
5013
  if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
5012
5014
  return value;
5013
5015
  }
@@ -5072,8 +5074,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5072
5074
  return 'Wrong date format';
5073
5075
  }
5074
5076
  } else {
5077
+ const isFormatting = highchartsRenderer.isFormattingAxisFeatureOn() && isFormattingNumbers && format && !isNaN(value);
5075
5078
  if (value === null || value === '[null]') {
5076
5079
  return '[null]';
5080
+ } else if (isFormatting) {
5081
+ return highchartsRenderer.formatValue('n', format, value).value;
5077
5082
  }
5078
5083
  }
5079
5084
 
@@ -8008,7 +8013,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8008
8013
  suboptions: []
8009
8014
  };
8010
8015
 
8011
- highchartsRenderer.getFilterLabel = function (fieldFilter, showTemplateName) {
8016
+ highchartsRenderer.getFilterLabel = function (fieldFilter, showTemplateName, isFormattingNumbers) {
8012
8017
  var displayname;
8013
8018
  if (fieldFilter.new_name)
8014
8019
  displayname = fieldFilter.new_name.replace('RH_DIM_', '');
@@ -8031,7 +8036,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8031
8036
  var tooltip = '';
8032
8037
  var all_vals = [];
8033
8038
  if (fieldFilter.type == 'Date') {
8034
- all_vals = [];
8035
8039
  var invertValueFormatMap = lodash.invert(fieldFilter.valueFormatMap);
8036
8040
  lodash.forEach(fieldFilter.includes, function (val) {
8037
8041
  if (invertValueFormatMap && invertValueFormatMap[val]) {
@@ -8041,6 +8045,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8041
8045
  }
8042
8046
  all_vals.push(val);
8043
8047
  });
8048
+ } else if (isFormattingNumbers && highchartsRenderer.isFormattingAxisFeatureOn()) {
8049
+ all_vals = lodash.map(lodash.cloneDeep(fieldFilter.includes), val =>
8050
+ highchartsRenderer.returnRawDataValue(fieldFilter.type, val, fieldFilter.format || '', null, null, true) + ""
8051
+ );
8044
8052
  } else {
8045
8053
  all_vals = lodash.clone(fieldFilter.includes);
8046
8054
  }
@@ -9331,7 +9339,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9331
9339
  }
9332
9340
 
9333
9341
  highchartsRenderer.isFormattingAxis = function (pivotData) {
9334
- return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), FEATURES.FORMAT_AXIS) && pivotData.isFormattingAxisLabels;
9342
+ return highchartsRenderer.isFormattingAxisFeatureOn() && pivotData.isFormattingAxisLabels;
9343
+ }
9344
+
9345
+ highchartsRenderer.isFormattingAxisFeatureOn = function () {
9346
+ return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), FEATURES.FORMAT_AXIS);
9335
9347
  }
9336
9348
 
9337
9349
  // Method for getting formatted kyes for Axis (cols, rows)