@datarailsshared/dr_renderer 1.2.373 → 1.2.375

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.373",
3
+ "version": "1.2.375",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -8726,14 +8726,22 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8726
8726
  }
8727
8727
  filter.values = [];
8728
8728
  for (let i = 0; i < colKey.length; i++) {
8729
- filter.values.push(
8730
- widget.cols[0].type === 'Date' && colKey[i] !== NULL_VALUE && !isFormattingDatesAsOtherAxisTypes
8731
- ? highchartsRenderer.createDateFromString(
8732
- colKey[i],
8733
- highchartsRenderer.getDateFieldFormat(widget, widget.cols[0])
8734
- )
8735
- : +colKey[i]
8736
- );
8729
+ let value = colKey[i];
8730
+ switch (widget.cols[0].type) {
8731
+ case 'Date':
8732
+ if (value !== NULL_VALUE && !isFormattingDatesAsOtherAxisTypes) {
8733
+ value = highchartsRenderer.createDateFromString(
8734
+ value,
8735
+ highchartsRenderer.getDateFieldFormat(widget, widget.cols[0])
8736
+ );
8737
+ }
8738
+ break;
8739
+ case 'Integer':
8740
+ case 'Float':
8741
+ value = +value;
8742
+ break;
8743
+ }
8744
+ filter.values.push(value);
8737
8745
  }
8738
8746
  } else if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
8739
8747
  lodash.forEach(colKey, function (colKeyElement, index) {
@@ -8914,7 +8922,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8914
8922
  }
8915
8923
 
8916
8924
  if (datesFields.length > 0) {
8917
- const invertedDateStringMap = {};
8925
+ widget.pivot.invertedDateStringMap = {};
8918
8926
  lodash.forEach(res, function (element) {
8919
8927
  for (var i in datesFields) {
8920
8928
  if (element.hasOwnProperty(datesFields[i].name)) {
@@ -8930,7 +8938,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8930
8938
  widget.pivot.dateValuesDictionary = {}
8931
8939
  }
8932
8940
  widget.pivot.dateValuesDictionary[dateStringValue] = element[datesFields[i].name];
8933
- invertedDateStringMap[element[datesFields[i].name]] = dateStringValue;
8941
+ widget.pivot.invertedDateStringMap[element[datesFields[i].name]] = dateStringValue;
8934
8942
  }
8935
8943
  element[datesFields[i].name] = dateStringValue;
8936
8944
  }
@@ -8941,7 +8949,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8941
8949
 
8942
8950
  lodash.forEach(['col_keys', 'row_keys', 'row_keys_by_cols'], (keysListName) => {
8943
8951
  const widgetFields = keysListName === 'col_keys' ? widget.cols : widget.rows;
8944
- highchartsRenderer.replaceSortingKeysWithMappedValues(lodash.get(keysObject, keysListName), invertedDateStringMap, widgetFields);
8952
+ highchartsRenderer
8953
+ .replaceSortingKeysWithMappedValues(lodash.get(keysObject, keysListName), widget.pivot.invertedDateStringMap, widgetFields);
8945
8954
  });
8946
8955
  }
8947
8956
  });
@@ -9026,12 +9035,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9026
9035
  });
9027
9036
  }
9028
9037
  } else if (field.sorting && field.sorting.type == "CustomOrder" && field.sorting.values) {
9029
- datesFields.push({
9030
- "format": field.format,
9031
- "name": field.name,
9032
- "type": field.type,
9033
- "values": field.sorting.values
9034
- });
9038
+ if (field.type === 'Date' && field.sorting.values.length && widget.pivot.invertedDateStringMap) {
9039
+ const fieldInList = lodash.find(datesFields, { name: field.name });
9040
+ fieldInList.values = lodash.map(field.sorting.values, value => widget.pivot.invertedDateStringMap[value] || value);
9041
+ } else {
9042
+ datesFields.push({
9043
+ "format": field.format,
9044
+ "name": field.name,
9045
+ "type": field.type,
9046
+ "values": field.sorting.values
9047
+ });
9048
+ }
9035
9049
  }
9036
9050
  });
9037
9051