@datarailsshared/dr_renderer 1.3.23 → 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
@@ -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) {
|
@@ -1298,7 +1298,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1298
1298
|
);
|
1299
1299
|
});
|
1300
1300
|
|
1301
|
-
if (additionOptions.series_colors) {
|
1301
|
+
if (additionOptions && additionOptions.series_colors) {
|
1302
1302
|
ob.color = additionOptions.series_colors[row_n_value] || undefined;
|
1303
1303
|
} else if (colors && colors[i]) {
|
1304
1304
|
ob.color = colors[i];
|
@@ -1493,7 +1493,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1493
1493
|
ob.data.push(tmoobj);
|
1494
1494
|
});
|
1495
1495
|
|
1496
|
-
if (additionOptions.series_colors) {
|
1496
|
+
if (additionOptions && additionOptions.series_colors) {
|
1497
1497
|
ob.color = additionOptions.series_colors[row_n_value] || undefined;
|
1498
1498
|
} else if (colors && colors[i]) {
|
1499
1499
|
ob.color = colors[i];
|
@@ -1923,7 +1923,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1923
1923
|
// check string contains hebrew
|
1924
1924
|
ob.initialName = (/[\u0590-\u05FF]/).test(key) ? ('\u200E' + key) : key;
|
1925
1925
|
|
1926
|
-
if (additionOptions.series_colors) {
|
1926
|
+
if (additionOptions && additionOptions.series_colors) {
|
1927
1927
|
ob.color = additionOptions.series_colors[key] || undefined;
|
1928
1928
|
}
|
1929
1929
|
|
@@ -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
|
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
|
});
|