@datarailsshared/dr_renderer 1.2.444 → 1.2.445

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.444",
3
+ "version": "1.2.445",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1567,6 +1567,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1567
1567
  totalSeries.className = 'totalSeries';
1568
1568
  totalSeries.name = 'Total';
1569
1569
  totalSeries.data = [];
1570
+
1571
+ // DEV_FF: DR-31422
1572
+ if (opts.devFixDrollDownByTotal) {
1573
+ totalSeries.initialName = 'Total';
1574
+ totalSeries.isTotal = true;
1575
+ }
1570
1576
 
1571
1577
  if (colors && colors[i]) {
1572
1578
  totalSeries.color = colors[i];
@@ -6882,7 +6882,174 @@ describe('highcharts_renderer', () => {
6882
6882
  color: '#b3060e'
6883
6883
  }
6884
6884
  ]);
6885
- })
6885
+ });
6886
+
6887
+ describe("DR-31214 - Fix drilldown by total", () => {
6888
+ const originResponse = [{
6889
+ color: '#ff0202',
6890
+ data: [
6891
+ {
6892
+ drilldown: true,
6893
+ initialName: 'col 1',
6894
+ name: 'col 1',
6895
+ y: 12345
6896
+ },
6897
+ {
6898
+ drilldown: true,
6899
+ initialName: 'col 2',
6900
+ name: 'col 2',
6901
+ y: 54321
6902
+ },
6903
+ {
6904
+ drilldown: true,
6905
+ initialName: 'Others',
6906
+ name: 'Others',
6907
+ y: 99999
6908
+ }
6909
+ ],
6910
+ dataLabels: {
6911
+ allowOverlap: false,
6912
+ color: '#151a41',
6913
+ enabled: true,
6914
+ formatter: expect.any(Function),
6915
+ style: {
6916
+ fontFamily: 'Poppins',
6917
+ fontSize: '11',
6918
+ fontWeight: 'normal'
6919
+ }
6920
+ },
6921
+ initialName: 'row 1',
6922
+ name: 'row 1'
6923
+ },
6924
+ {
6925
+ color: '#b3060e',
6926
+ data: [
6927
+ {
6928
+ drilldown: true,
6929
+ initialName: 'col 1',
6930
+ name: 'col 1',
6931
+ y: 123450
6932
+ },
6933
+ {
6934
+ drilldown: true,
6935
+ initialName: 'col 2',
6936
+ name: 'col 2',
6937
+ y: 11111
6938
+ },
6939
+ {
6940
+ drilldown: true,
6941
+ initialName: 'Others',
6942
+ name: 'Others',
6943
+ y: 99991
6944
+ }
6945
+ ],
6946
+ dataLabels: {
6947
+ allowOverlap: false,
6948
+ color: '#151a41',
6949
+ enabled: true,
6950
+ formatter: expect.any(Function),
6951
+ style: {
6952
+ fontFamily: 'Poppins',
6953
+ fontSize: '11',
6954
+ fontWeight: 'normal'
6955
+ }
6956
+ },
6957
+ initialName: 'row 2',
6958
+ name: 'row 2'
6959
+ },
6960
+ {
6961
+ className: 'totalSeries',
6962
+ color: '#70000a',
6963
+ data: [
6964
+ {
6965
+ initialName: 'col 1',
6966
+ name: 'col 1',
6967
+ y: 123450
6968
+ },
6969
+ {
6970
+ initialName: 'col 2',
6971
+ name: 'col 2',
6972
+ y: 123451
6973
+ },
6974
+ {
6975
+ initialName: 'DR_Others',
6976
+ name: 'DR_Others',
6977
+ y: 123452
6978
+ }
6979
+ ],
6980
+ dataLabels: {
6981
+ allowOverlap: false,
6982
+ color: '#151a41',
6983
+ enabled: true,
6984
+ formatter: expect.any(Function),
6985
+ style: {
6986
+ fontFamily: 'Poppins',
6987
+ fontSize: '11',
6988
+ fontWeight: 'normal'
6989
+ }
6990
+ },
6991
+ initialName: 'row 2',
6992
+ name: 'Total'
6993
+ }];
6994
+
6995
+ it("should mark the series as total if the feature flag is on", () => {
6996
+ additionalOptionsMock = {};
6997
+ opts = {
6998
+ total: true,
6999
+ devFixDrollDownByTotal: true,
7000
+ };
7001
+ pivotDataMock.colTotals = {
7002
+ "col 1": { value: () => 123450 },
7003
+ "col 2": { value: () => 123451 },
7004
+ DR_Others: { value: () => 123452 },
7005
+ };
7006
+ const value = highchartsRenderer.ptCreateColumnSeries(
7007
+ pivotDataMock,
7008
+ colors,
7009
+ onlyNumbers,
7010
+ isUniqueVals,
7011
+ isNotDrillDown,
7012
+ additionalOptionsMock,
7013
+ opts,
7014
+ chartOptions,
7015
+ chartType
7016
+ );
7017
+ const fixedResponse = [...originResponse];
7018
+ fixedResponse[fixedResponse.length - 1] = {
7019
+ ...fixedResponse[fixedResponse.length - 1],
7020
+ ...{
7021
+ initialName: "Total",
7022
+ isTotal: true,
7023
+ },
7024
+ };
7025
+ expect(value).toEqual(fixedResponse);
7026
+ });
7027
+
7028
+ it("should not change the original series if the feature flag is off", () => {
7029
+ additionalOptionsMock = {};
7030
+ opts = {
7031
+ total: true,
7032
+ devFixDrollDownByTotal: false,
7033
+ };
7034
+ pivotDataMock.colTotals = {
7035
+ "col 1": { value: () => 123450 },
7036
+ "col 2": { value: () => 123451 },
7037
+ DR_Others: { value: () => 123452 },
7038
+ };
7039
+ const value = highchartsRenderer.ptCreateColumnSeries(
7040
+ pivotDataMock,
7041
+ colors,
7042
+ onlyNumbers,
7043
+ isUniqueVals,
7044
+ isNotDrillDown,
7045
+ additionalOptionsMock,
7046
+ opts,
7047
+ chartOptions,
7048
+ chartType
7049
+ );
7050
+ expect(value).toEqual(originResponse);
7051
+ });
7052
+ });
6886
7053
  });
6887
7054
  describe('Function ptCreateBasicLineSeries', () => {
6888
7055
  const format = null;