@datarailsshared/dr_renderer 1.2.422 → 1.2.424

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.422",
3
+ "version": "1.2.424",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -788,10 +788,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
788
788
  }
789
789
 
790
790
  var cols = highchartsRenderer.getColsInFormatterContext(this);
791
- if (!cols && is_drill_down_pie) {
791
+ if (lodash.isNil(cols) && is_drill_down_pie) {
792
792
  cols = this.name;
793
793
  }
794
- if (!cols) {
794
+ if (lodash.isNil(cols)) {
795
795
  cols = [];
796
796
  }
797
797
 
@@ -1902,8 +1902,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1902
1902
  // it displays negative values as empty segments in version <= 8.2.2
1903
1903
  ob.y = val >= 0 || chartOptions.chart.type !== 'pie' ? val : 0;
1904
1904
 
1905
- if (!isNaN(key))
1906
- key = Number(key)
1905
+ if (lodash.isBoolean(key)) {
1906
+ key = key.toString();
1907
+ } else if (!isNaN(key)) {
1908
+ key = Number(key);
1909
+ }
1910
+
1907
1911
  ob.drilldown = key;
1908
1912
  pie_series.push(ob);
1909
1913
  });
@@ -1931,7 +1935,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1931
1935
  var col_ob = {};
1932
1936
  var col_n = col_n_value[0];
1933
1937
  if (col_n != undefined) {
1934
- col_ob.id = !isNaN(col_n) ? Number(col_n) : col_n;
1938
+
1939
+ col_ob.id = col_n;
1940
+ if (lodash.isBoolean(col_ob.id)) {
1941
+ col_ob.id = col_ob.id.toString();
1942
+ } else if (!isNaN(col_ob.id)) {
1943
+ col_ob.id = Number(col_ob.id);
1944
+ }
1945
+
1935
1946
  col_ob.initialName = col_n === highchartsRenderer.DR_OTHERS_KEY ? othersName : col_n;
1936
1947
  col_ob.name = highchartsRenderer.getFormattedColKey(col_ob.initialName, pivotData);
1937
1948
  col_ob.data = [];
@@ -1974,7 +1985,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1974
1985
  highchartsRenderer.getDataLabelsStylesForDrillDown = function(additionOptions) {
1975
1986
  let result = highchartsRenderer.getDataLabelsOptions(additionOptions, { dataLabels: {} });
1976
1987
 
1977
- if (!result.dataLabels) return {};
1978
1988
  return {
1979
1989
  activeDataLabelStyle: {
1980
1990
  color: result.dataLabels.color,
@@ -9690,10 +9700,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9690
9700
  }
9691
9701
 
9692
9702
  highchartsRenderer.getColsInFormatterContext = function(context) {
9693
- return lodash.get(context, 'point.options.colsForTotal')
9694
- || lodash.get(context, 'point.initialName')
9695
- || lodash.get(context, 'options.initialName')
9696
- || context.key;
9703
+ const colsForTotal = lodash.get(context, "point.options.colsForTotal");
9704
+ const pointInitialName = lodash.get(context, "point.initialName");
9705
+ const optionsInitialName = lodash.get(context, "options.initialName");
9706
+
9707
+ switch(true) {
9708
+ case !lodash.isNil(colsForTotal): return colsForTotal;
9709
+ case !lodash.isNil(pointInitialName): return pointInitialName;
9710
+ case !lodash.isNil(optionsInitialName): return optionsInitialName;
9711
+ default: return context.key;
9712
+ }
9697
9713
  }
9698
9714
 
9699
9715
  highchartsRenderer.getTableFormatInfosForWidgetFields = function(widget, pivotOptions, fields) {
@@ -8931,4 +8931,19 @@ describe('highcharts_renderer', () => {
8931
8931
  });
8932
8932
  });
8933
8933
 
8934
+ describe('Function getDataLabelsStylesForDrillDown', () => {
8935
+
8936
+ it('should return an object with activeDataLabelStyle containing color from dataLabels', () => {
8937
+ const mockColor = 'red';
8938
+ const additionalOptions = {
8939
+ label_option: {
8940
+ font_color: mockColor,
8941
+ },
8942
+ };
8943
+
8944
+ const result = highchartsRenderer.getDataLabelsStylesForDrillDown(additionalOptions);
8945
+ expect(result).toEqual({ activeDataLabelStyle: { color: mockColor } });
8946
+ });
8947
+ });
8948
+
8934
8949
  });