@datarailsshared/dr_renderer 1.2.460 → 1.2.462

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.460",
3
+ "version": "1.2.462",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -444,8 +444,9 @@ function DrGaugeChart(pivotData, opts) {
444
444
  chart.goalIcon.toFront();
445
445
  };
446
446
 
447
- this.clampValueToPane = function (value, max = this.max) {
448
- return helpers.clamp(-0.02 * max, value, 1.02 * max);
447
+ this.clampValueToPane = function (value, max = this.max, min = this.min) {
448
+ const correction = Math.abs(max - min) * 0.02;
449
+ return helpers.clamp(min - correction, value, max + correction);
449
450
  };
450
451
 
451
452
  this.configChart = function () {
@@ -1569,12 +1569,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1569
1569
  totalSeries.className = 'totalSeries';
1570
1570
  totalSeries.name = 'Total';
1571
1571
  totalSeries.data = [];
1572
-
1573
- // DEV_FF: DR-31422
1574
- if (opts.devFixDrollDownByTotal) {
1575
- totalSeries.initialName = 'Total';
1576
- totalSeries.isTotal = true;
1577
- }
1572
+ totalSeries.initialName = 'Total';
1573
+ totalSeries.isTotal = true;
1578
1574
 
1579
1575
  if (colors && colors[i]) {
1580
1576
  totalSeries.color = colors[i];
@@ -1687,26 +1687,26 @@ describe("DrGaugeChart", () => {
1687
1687
 
1688
1688
  it("calls helpers.clamp with correct bounds and value", () => {
1689
1689
  const value = 50;
1690
- const result = chart.clampValueToPane(value, 100);
1690
+ const result = chart.clampValueToPane(value, 100, 0);
1691
1691
 
1692
1692
  expect(helpers.clamp).toHaveBeenCalledWith(-2, value, 102);
1693
1693
  expect(result).toBe(value); // Value is within range
1694
1694
  });
1695
1695
 
1696
1696
  it("returns clamped value when below range", () => {
1697
- const value = -10;
1698
- const result = chart.clampValueToPane(value, 100);
1697
+ const value = -1000;
1698
+ const result = chart.clampValueToPane(value, 100, -100);
1699
1699
 
1700
- expect(helpers.clamp).toHaveBeenCalledWith(-2, value, 102);
1701
- expect(result).toBe(-2); // Clamped to minimum
1700
+ expect(helpers.clamp).toHaveBeenCalledWith(-104, value, 104);
1701
+ expect(result).toBe(-104); // Clamped to minimum
1702
1702
  });
1703
1703
 
1704
1704
  it("returns clamped value when above range", () => {
1705
1705
  const value = 200;
1706
- const result = chart.clampValueToPane(value, 100);
1706
+ const result = chart.clampValueToPane(value, 100, -100);
1707
1707
 
1708
- expect(helpers.clamp).toHaveBeenCalledWith(-2, value, 102);
1709
- expect(result).toBe(102); // Clamped to maximum
1708
+ expect(helpers.clamp).toHaveBeenCalledWith(-104, value, 104);
1709
+ expect(result).toBe(104); // Clamped to maximum
1710
1710
  });
1711
1711
 
1712
1712
  it("uses the deafult max umless it is provided", () => {
@@ -6604,8 +6604,9 @@ describe('highcharts_renderer', () => {
6604
6604
  fontWeight: 'normal'
6605
6605
  }
6606
6606
  },
6607
- initialName: 'row 2',
6608
- name: 'Total'
6607
+ name: "Total",
6608
+ initialName: "Total",
6609
+ isTotal: true,
6609
6610
  }
6610
6611
  ]);
6611
6612
  });
@@ -7038,11 +7039,10 @@ describe('highcharts_renderer', () => {
7038
7039
  name: 'Total'
7039
7040
  }];
7040
7041
 
7041
- it("should mark the series as total if the feature flag is on", () => {
7042
+ it("should mark the series as total", () => {
7042
7043
  additionalOptionsMock = {};
7043
7044
  opts = {
7044
- total: true,
7045
- devFixDrollDownByTotal: true,
7045
+ total: true
7046
7046
  };
7047
7047
  pivotDataMock.colTotals = {
7048
7048
  "col 1": { value: () => 123450 },
@@ -7070,31 +7070,6 @@ describe('highcharts_renderer', () => {
7070
7070
  };
7071
7071
  expect(value).toEqual(fixedResponse);
7072
7072
  });
7073
-
7074
- it("should not change the original series if the feature flag is off", () => {
7075
- additionalOptionsMock = {};
7076
- opts = {
7077
- total: true,
7078
- devFixDrollDownByTotal: false,
7079
- };
7080
- pivotDataMock.colTotals = {
7081
- "col 1": { value: () => 123450 },
7082
- "col 2": { value: () => 123451 },
7083
- DR_Others: { value: () => 123452 },
7084
- };
7085
- const value = highchartsRenderer.ptCreateColumnSeries(
7086
- pivotDataMock,
7087
- colors,
7088
- onlyNumbers,
7089
- isUniqueVals,
7090
- isNotDrillDown,
7091
- additionalOptionsMock,
7092
- opts,
7093
- chartOptions,
7094
- chartType
7095
- );
7096
- expect(value).toEqual(originResponse);
7097
- });
7098
7073
  });
7099
7074
  });
7100
7075
  describe('Function ptCreateBasicLineSeries', () => {