@datarailsshared/dr_renderer 1.2.463 → 1.3.2

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.
@@ -917,7 +917,7 @@ describe('highcharts_renderer', () => {
917
917
 
918
918
  it('should return filter icon for matching axis', () => {
919
919
  const axis = 'row'
920
- const expected = '<i class="fa fa-filter"></i>'
920
+ const expected = '<i class="dr-icon-filter-old"></i>'
921
921
  const result = highchartsRenderer.getIconsForTotalOptions(options, axis)
922
922
  expect(result).toEqual(expected)
923
923
  });
@@ -6811,6 +6811,7 @@ describe('highcharts_renderer', () => {
6811
6811
  formatter: expect.any(Function),
6812
6812
  },
6813
6813
  color: '#ff0202',
6814
+ connectNulls: false,
6814
6815
  type: 'area'
6815
6816
  },
6816
6817
  {data: [
@@ -6846,6 +6847,7 @@ describe('highcharts_renderer', () => {
6846
6847
  enabled: true,
6847
6848
  formatter: expect.any(Function),
6848
6849
  },
6850
+ connectNulls: false,
6849
6851
  color: '#b3060e',
6850
6852
  type: 'line'
6851
6853
  }
@@ -7082,7 +7084,11 @@ describe('highcharts_renderer', () => {
7082
7084
  "#70000a"
7083
7085
  ];
7084
7086
  opts = {};
7085
- chartOptions = {};
7087
+ chartOptions = {
7088
+ chart: {
7089
+ type: '',
7090
+ }
7091
+ };
7086
7092
  pivotDataMock = {
7087
7093
  getAggregator: (rows, cols) => {
7088
7094
  let aggregator = highchartsRenderer.rhPivotAggregatorSum([''], format, true, {}, {});
@@ -8349,166 +8355,6 @@ describe('highcharts_renderer', () => {
8349
8355
  });
8350
8356
  });
8351
8357
 
8352
- describe('Function ptCreateGaugeSeries', () => {
8353
-
8354
- const pivotDataMock = {
8355
- getAggregator: () => ({
8356
- value: () => 1000,
8357
- format: (val) => `formatted(${ val })`,
8358
- })
8359
- }
8360
-
8361
- beforeEach(() => {
8362
- spyOn(highchartsRenderer, 'getSingleValueAgg').and.callFake(
8363
- (_gaugeOpts, aggfunc, base) => ({ aggfunc, base })
8364
- );
8365
- spyOn(highchartsRenderer, 'getDataLabelsStyle').and.returnValue('test_style');
8366
- spyOn(highchartsRenderer, 'getDataLabelsOptions').and.callFake(
8367
- (_gaugeOpts, seriesElement) => ({...seriesElement, additionalOptions: 'test_additional_opts'})
8368
- );
8369
- });
8370
-
8371
- describe('with two calc values', () => {
8372
-
8373
- const mockGaugeOpts = {
8374
- label: {
8375
- overlap: true,
8376
- show: false,
8377
- }
8378
- };
8379
-
8380
- beforeEach(() => {
8381
- spyOn(highchartsRenderer, 'ptCreateBasicLineSeries').and.returnValue([
8382
- {
8383
- data: [39],
8384
- initialName: "Test Calc",
8385
- name: "Test Calc"
8386
- },
8387
- {
8388
- data: [21],
8389
- initialName: "Test Calc 2",
8390
- name: "Test Calc 2"
8391
- }
8392
- ]);
8393
- });
8394
-
8395
- it('should create gauge series, two calc values, isSolidGauge = false, labels disabled', () => {
8396
- expect(highchartsRenderer.ptCreateGaugeSeries(pivotDataMock, {}, {}, mockGaugeOpts, false)).toEqual([
8397
- {
8398
- additionalOptions: 'test_additional_opts',
8399
- colorByPoint: true,
8400
- data: [60],
8401
- dataLabels: {
8402
- allowOverlap: true,
8403
- enabled: false,
8404
- format: '<div style="text-align:center"><span style="font-size:15px;color:black">formatted(60)</span><br/><span style="font-size:12px;color:silver"></span></div>',
8405
- style: 'test_style',
8406
- },
8407
- name: '',
8408
- },
8409
- ]);
8410
- });
8411
-
8412
- it('should create gauge series, two calc values, isSolidGauge = false, labels enabled', () => {
8413
- const gaugeOpts = lodash.cloneDeep(mockGaugeOpts);
8414
- gaugeOpts.label.show = true;
8415
- expect(highchartsRenderer.ptCreateGaugeSeries(pivotDataMock, {}, {}, gaugeOpts, false)).toEqual([
8416
- {
8417
- additionalOptions: 'test_additional_opts',
8418
- colorByPoint: true,
8419
- data: [60],
8420
- dataLabels: {
8421
- allowOverlap: true,
8422
- enabled: true,
8423
- format: '<div style="text-align:center"><span style="font-size:15px;color:black">formatted(60)</span><br/><span style="font-size:12px;color:silver"></span></div>',
8424
- style: 'test_style',
8425
- },
8426
- name: '',
8427
- },
8428
- ]);
8429
- });
8430
-
8431
- it('should create gauge series, two calc values, isSolidGauge = true', () => {
8432
- expect(highchartsRenderer.ptCreateGaugeSeries(pivotDataMock, {}, {}, mockGaugeOpts, true)).toEqual([
8433
- {
8434
- additionalOptions: 'test_additional_opts',
8435
- colorByPoint: true,
8436
- data: [60],
8437
- dataLabels: {
8438
- allowOverlap: true,
8439
- enabled: true,
8440
- format: '<div style="text-align:center"><span style="font-size:25px;color:black">formatted(60)</span><br/><span style="font-size:12px;color:silver"></span></div>',
8441
- style: 'test_style',
8442
- },
8443
- name: '',
8444
- },
8445
- ]);
8446
- });
8447
- });
8448
-
8449
- it('should create gauge series, one calc value', () => {
8450
- const mockGaugeOpts = {
8451
- label: {
8452
- overlap: true,
8453
- show: false,
8454
- }
8455
- };
8456
-
8457
- spyOn(highchartsRenderer, 'ptCreateBasicLineSeries').and.returnValue([
8458
- {
8459
- data: [39],
8460
- initialName: "Test Calc",
8461
- name: "Test Calc"
8462
- },
8463
- ]);
8464
-
8465
- expect(highchartsRenderer.ptCreateGaugeSeries(pivotDataMock, {}, {}, mockGaugeOpts, false)).toEqual([
8466
- {
8467
- additionalOptions: 'test_additional_opts',
8468
- colorByPoint: true,
8469
- data: [39],
8470
- dataLabels: {
8471
- allowOverlap: true,
8472
- enabled: false,
8473
- format: '<div style="text-align:center"><span style="font-size:15px;color:black">formatted(39)</span><br/><span style="font-size:12px;color:silver"></span></div>',
8474
- style: 'test_style',
8475
- },
8476
- name: '',
8477
- },
8478
- ]);
8479
- });
8480
-
8481
- it('should create gauge series, no calculated, one value field', () => {
8482
- const mockGaugeOpts = {
8483
- label: {
8484
- overlap: true,
8485
- show: false,
8486
- }
8487
- };
8488
-
8489
- spyOn(highchartsRenderer, 'ptCreateBasicLineSeries').and.returnValue([
8490
- {
8491
- data: [32605]
8492
- },
8493
- ]);
8494
-
8495
- expect(highchartsRenderer.ptCreateGaugeSeries(pivotDataMock, {}, {}, mockGaugeOpts, false)).toEqual([
8496
- {
8497
- additionalOptions: 'test_additional_opts',
8498
- colorByPoint: true,
8499
- data: [32605],
8500
- dataLabels: {
8501
- allowOverlap: true,
8502
- enabled: false,
8503
- format: '<div style="text-align:center"><span style="font-size:15px;color:black">formatted(32605)</span><br/><span style="font-size:12px;color:silver"></span></div>',
8504
- style: 'test_style',
8505
- },
8506
- name: '',
8507
- },
8508
- ]);
8509
- });
8510
- });
8511
-
8512
8358
  describe('highchartsRenderer.ptRenderPieWithDrillDown', () => {
8513
8359
  beforeEach(() => {
8514
8360
  jest.spyOn(highchartsRenderer, 'ptCreateSeriesToDrillDownChart')
@@ -8869,241 +8715,6 @@ describe('highcharts_renderer', () => {
8869
8715
  });
8870
8716
  });
8871
8717
 
8872
- describe('Function ptRenderGauge', () => {
8873
-
8874
- const pivotDataMock = {
8875
- getColKeys: () => [[1], [2], [3]],
8876
- };
8877
-
8878
- const commonExpectedOptions = {
8879
- chart: { animation: true, type: 'gauge' },
8880
- credits: { enabled: false },
8881
- pane: {
8882
- background: [
8883
- {
8884
- backgroundColor: {
8885
- linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
8886
- stops: [
8887
- [0, '#fff'],
8888
- [1, '#333'],
8889
- ],
8890
- },
8891
- borderWidth: 0,
8892
- outerRadius: '109%',
8893
- },
8894
- {
8895
- backgroundColor: {
8896
- linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
8897
- stops: [
8898
- [0, '#333'],
8899
- [1, '#fff'],
8900
- ],
8901
- },
8902
- borderWidth: 1,
8903
- outerRadius: '107%',
8904
- },
8905
- {},
8906
- { backgroundColor: '#DDD', borderWidth: 0, innerRadius: '103%', outerRadius: '105%' },
8907
- ],
8908
- endAngle: 150,
8909
- startAngle: -150,
8910
- },
8911
- plotOptions: {
8912
- series: { animation: true },
8913
- solidgauge: {
8914
- additionalOptions: 'test_additional_opts',
8915
- allowPointSelect: true,
8916
- cursor: 'pointer',
8917
- dataLabels: { allowOverlap: true, borderWidth: 0, style: 'test_style', useHTML: true, y: 5 },
8918
- },
8919
- },
8920
- series: 'test_gauge_series',
8921
- subtitle: 'test_subtitle',
8922
- title: 'test_title',
8923
- xAxis: { categories: ['formatted(1)', 'formatted(2)', 'formatted(3)'] },
8924
- };
8925
-
8926
- const gaugeDefaultChartOptions = {
8927
- label: {
8928
- overlap: true,
8929
- show: false,
8930
- },
8931
- range: {
8932
- min: 0,
8933
- max: 12345,
8934
- low: 100,
8935
- medium: 200,
8936
- high: 300,
8937
- },
8938
- };
8939
-
8940
- const chartOptionsInOpts = {
8941
- label: {
8942
- overlap: false,
8943
- show: true,
8944
- },
8945
- range: {
8946
- min: 1,
8947
- max: 234567,
8948
- low: 500,
8949
- medium: 800,
8950
- high: 1000,
8951
- },
8952
- };
8953
-
8954
- beforeEach(() => {
8955
- spyOn(highchartsRenderer, 'getDefaultValueForChart').and.returnValue(gaugeDefaultChartOptions);
8956
- spyOn(highchartsRenderer, 'getDataLabelsStyle').and.returnValue('test_style');
8957
- spyOn(highchartsRenderer, 'getDataLabelsOptions').and.callFake(
8958
- (_gaugeOpts, seriesElement) => ({...seriesElement, additionalOptions: 'test_additional_opts'})
8959
- );
8960
- spyOn(highchartsRenderer, 'getFormattedColKeys').and.callFake(
8961
- (pivotData, _keys) => pivotData.getColKeys().map(key => `formatted(${ key })`)
8962
- );
8963
- spyOn(highchartsRenderer, 'ptCreateGaugeSeries').and.returnValue('test_gauge_series');
8964
- spyOn(highchartsRenderer, 'setTitleAndSubTitle').and.callFake((chartOptions, _opts, _gaugeopts) => {
8965
- chartOptions.title = 'test_title';
8966
- chartOptions.subtitle = 'test_subtitle';
8967
- });
8968
- spyOn(highchartsRenderer, 'ptCreateElementAndDraw').and.returnValue();
8969
- });
8970
-
8971
- it('should call ptCreateElementAndDraw with proper options: no chartOptions passed in opts', () => {
8972
- const optsMock = {
8973
- testOptsField: 'test_opts_field_value',
8974
- };
8975
-
8976
- highchartsRenderer.ptRenderGauge(pivotDataMock, lodash.cloneDeep(optsMock));
8977
-
8978
- const expectedChartOptions = {
8979
- ...commonExpectedOptions,
8980
- yAxis: {
8981
- labels: { rotation: 'auto', step: 2 },
8982
- max: 12345,
8983
- min: 0,
8984
- minorTickColor: '#666',
8985
- minorTickInterval: 'auto',
8986
- minorTickLength: 10,
8987
- minorTickPosition: 'inside',
8988
- minorTickWidth: 1,
8989
- plotBands: [
8990
- { color: '#55BF3B', from: 0, to: 12345 },
8991
- { color: '#DDDF0D', from: 12345, to: 24690 },
8992
- { color: '#DF5353', from: 24690, to: 12345 },
8993
- ],
8994
- tickColor: '#666',
8995
- tickLength: 10,
8996
- tickPixelInterval: 30,
8997
- tickPosition: 'inside',
8998
- tickWidth: 2,
8999
- title: { text: '' },
9000
- },
9001
- };
9002
-
9003
- expect(highchartsRenderer.ptCreateGaugeSeries)
9004
- .toHaveBeenCalledWith(pivotDataMock, optsMock, expectedChartOptions, gaugeDefaultChartOptions, false);
9005
- expect(highchartsRenderer.ptCreateElementAndDraw).toHaveBeenCalledWith(expectedChartOptions, optsMock);
9006
- });
9007
-
9008
- it('should call ptCreateElementAndDraw with proper options: chartOptions passed in opts', () => {
9009
- const optsMock = {
9010
- testOptsField: 'test_opts_field_value',
9011
- chartOptions: chartOptionsInOpts,
9012
- };
9013
-
9014
- highchartsRenderer.ptRenderGauge(pivotDataMock, lodash.cloneDeep(optsMock));
9015
-
9016
- const expectedChartOptions = {
9017
- ...commonExpectedOptions,
9018
- yAxis: {
9019
- labels: { rotation: 'auto', step: 2 },
9020
- max: 234567,
9021
- min: 0,
9022
- minorTickColor: '#666',
9023
- minorTickInterval: 'auto',
9024
- minorTickLength: 10,
9025
- minorTickPosition: 'inside',
9026
- minorTickWidth: 1,
9027
- plotBands: [
9028
- { color: '#55BF3B', from: 0, to: 1172835 },
9029
- { color: '#DDDF0D', from: 1172835, to: 1876536 },
9030
- { color: '#DF5353', from: 1876536, to: 234567 },
9031
- ],
9032
- tickColor: '#666',
9033
- tickLength: 10,
9034
- tickPixelInterval: 30,
9035
- tickPosition: 'inside',
9036
- tickWidth: 2,
9037
- title: { text: '' },
9038
- },
9039
- };
9040
- lodash.set(expectedChartOptions, 'plotOptions.solidgauge.dataLabels.allowOverlap', false);
9041
-
9042
- expect(highchartsRenderer.ptCreateGaugeSeries)
9043
- .toHaveBeenCalledWith(pivotDataMock, optsMock, expectedChartOptions, optsMock.chartOptions, false);
9044
- expect(highchartsRenderer.ptCreateElementAndDraw).toHaveBeenCalledWith(expectedChartOptions, optsMock);
9045
- });
9046
-
9047
- it('should call ptCreateElementAndDraw with proper options: for solid gauge', () => {
9048
- const optsMock = {
9049
- testOptsField: 'test_opts_field_value',
9050
- chartOptions: chartOptionsInOpts,
9051
- };
9052
-
9053
- highchartsRenderer.ptRenderGauge(pivotDataMock, lodash.cloneDeep(optsMock), true);
9054
-
9055
- const expectedChartOptions = {
9056
- chart: { animation: true, type: 'solidgauge' },
9057
- credits: { enabled: false },
9058
- pane: {
9059
- background: { backgroundColor: '#fff', innerRadius: '60%', outerRadius: '100%', shape: 'arc' },
9060
- center: ['50%', '85%'],
9061
- endAngle: 90,
9062
- size: '140%',
9063
- startAngle: -90,
9064
- },
9065
- plotOptions: {
9066
- series: { animation: true },
9067
- solidgauge: {
9068
- additionalOptions: 'test_additional_opts',
9069
- allowPointSelect: true,
9070
- cursor: 'pointer',
9071
- dataLabels: { allowOverlap: false, borderWidth: 0, style: 'test_style', useHTML: true, y: 5 },
9072
- },
9073
- },
9074
- series: 'test_gauge_series',
9075
- subtitle: 'test_subtitle',
9076
- title: 'test_title',
9077
- xAxis: { categories: ['formatted(1)', 'formatted(2)', 'formatted(3)'] },
9078
- yAxis: {
9079
- labels: { y: 16 },
9080
- lineWidth: 0,
9081
- max: 234567,
9082
- min: 0,
9083
- minorTickInterval: null,
9084
- stops: [
9085
- [5, '#55BF3B'],
9086
- [8, '#DDDF0D'],
9087
- [10, '#DF5353'],
9088
- ],
9089
- tickPixelInterval: 400,
9090
- tickWidth: 0,
9091
- },
9092
- };
9093
- lodash.set(expectedChartOptions, 'plotOptions.solidgauge.dataLabels.allowOverlap', false);
9094
-
9095
- expect(highchartsRenderer.ptCreateGaugeSeries)
9096
- .toHaveBeenCalledWith(pivotDataMock, optsMock, expectedChartOptions, optsMock.chartOptions, true);
9097
- expect(highchartsRenderer.ptCreateElementAndDraw).toHaveBeenCalledWith(expectedChartOptions, optsMock);
9098
- });
9099
- });
9100
-
9101
- it('ptRenderSolidGauge should call ptRenderGauge with isSolidGauge = true', () => {
9102
- spyOn(highchartsRenderer, 'ptRenderGauge').and.returnValue();
9103
- highchartsRenderer.ptRenderSolidGauge('mock_pivot_data', 'mock_opts');
9104
- expect(highchartsRenderer.ptRenderGauge).toHaveBeenCalledWith('mock_pivot_data', 'mock_opts', true);
9105
- });
9106
-
9107
8718
  describe("Function ptCreateWaterfallBreakdownSeries", () => {
9108
8719
  const format = null;
9109
8720
  const additionalOptionsMock = { testOption: 'test additional option 1' }