@datarailsshared/dr_renderer 1.2.461 → 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.461",
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 () {
@@ -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", () => {