@datarailsshared/dr_renderer 1.3.24 → 1.3.25

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.3.24",
3
+ "version": "1.3.25",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -80,8 +80,8 @@ function DrGaugeChart(pivotData, opts) {
80
80
  return DrGaugeChart.highchartsRenderer.getSingleValueAgg(opts, aggfunc, base);
81
81
  };
82
82
 
83
- this.isLeftQuarter = function (value, max = this.max) {
84
- return value < max / 2;
83
+ this.isLeftQuarter = function (value, max = this.max, min = this.min) {
84
+ return (value - min) < (max - min) / 2;
85
85
  };
86
86
 
87
87
  this.createPlotBands = function (options) {
@@ -115,15 +115,19 @@ describe("DrGaugeChart", () => {
115
115
 
116
116
  describe("isLeftQuarter", () => {
117
117
  it("should check in which quarter the chart value is", () => {
118
- expect(chart.isLeftQuarter(20, 100)).toBe(true);
119
- expect(chart.isLeftQuarter(20, 30)).toBe(false);
120
- expect(chart.isLeftQuarter(20, 20)).toBe(false);
121
- expect(chart.isLeftQuarter(100, 200)).toBe(false);
122
- expect(chart.isLeftQuarter(99, 200)).toBe(true);
118
+ expect(chart.isLeftQuarter(20, 100, 0)).toBe(true);
119
+ expect(chart.isLeftQuarter(20, 30, 0)).toBe(false);
120
+ expect(chart.isLeftQuarter(20, 20, 0)).toBe(false);
121
+ expect(chart.isLeftQuarter(100, 200, 0)).toBe(false);
122
+ expect(chart.isLeftQuarter(99, 200, 0)).toBe(true);
123
+
124
+ expect(chart.isLeftQuarter(59, 100, 20)).toBe(true);
125
+ expect(chart.isLeftQuarter(60, 100, 20)).toBe(false);
123
126
  });
124
127
 
125
- it("should use default #max parameter", () => {
128
+ it("should use default #max and #min parameters", () => {
126
129
  // Max = 180
130
+ // Min = 0
127
131
  expect(chart.isLeftQuarter(20)).toBe(true);
128
132
  expect(chart.isLeftQuarter(120)).toBe(false);
129
133
  });