@datarailsshared/dr_renderer 1.2.294 → 1.2.295
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 +1 -1
- package/src/highcharts_renderer.js +12 -11
- package/tests/highcharts_renderer.test.js +1932 -0
- package/tests/mock/tables.json +2258 -0
package/package.json
CHANGED
@@ -171,10 +171,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
171
171
|
}
|
172
172
|
lodash.assign(highchartsRenderer, HIGHCHARTS_CONSTANTS);
|
173
173
|
|
174
|
-
|
174
|
+
highchartsRenderer.useTotalsCalculation = false;
|
175
175
|
let disableAnimation = false;
|
176
176
|
if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
|
177
|
-
useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
|
177
|
+
highchartsRenderer.useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
|
178
178
|
disableAnimation = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.disable_animation
|
179
179
|
}
|
180
180
|
|
@@ -3883,7 +3883,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3883
3883
|
this.ignoreValue = true;
|
3884
3884
|
}
|
3885
3885
|
|
3886
|
-
if (useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
|
3886
|
+
if (highchartsRenderer.useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
|
3887
3887
|
return this.sum = parseFloat(record[attr]);
|
3888
3888
|
} else if (!isNaN(parseFloat(record[attr]))) {
|
3889
3889
|
return this.sum += parseFloat(record[attr]);
|
@@ -4037,7 +4037,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4037
4037
|
this.ignoreValue = true;
|
4038
4038
|
}
|
4039
4039
|
|
4040
|
-
if (useTotalsCalculation) {
|
4040
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4041
4041
|
return this.sum = val;
|
4042
4042
|
} else {
|
4043
4043
|
return this.sum += val;
|
@@ -4125,7 +4125,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4125
4125
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
4126
4126
|
this.ignoreValue = true;
|
4127
4127
|
}
|
4128
|
-
if (useTotalsCalculation) {
|
4128
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4129
4129
|
return this.val = x;
|
4130
4130
|
} else {
|
4131
4131
|
return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
|
@@ -4212,11 +4212,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4212
4212
|
this.ignoreValue = true;
|
4213
4213
|
}
|
4214
4214
|
|
4215
|
-
if (useTotalsCalculation) {
|
4215
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4216
4216
|
return this.val = x;
|
4217
4217
|
} else {
|
4218
|
-
return this.val = Math.
|
4219
|
-
}
|
4218
|
+
return this.val = Math.max(x, (ref = this.val) != null ? ref : x);
|
4219
|
+
}
|
4220
|
+
}
|
4220
4221
|
},
|
4221
4222
|
value: function () {
|
4222
4223
|
if (this.ignoreValue) {
|
@@ -4300,7 +4301,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4300
4301
|
}
|
4301
4302
|
|
4302
4303
|
|
4303
|
-
if (useTotalsCalculation) {
|
4304
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4304
4305
|
this.sum = parseFloat(x);
|
4305
4306
|
} else {
|
4306
4307
|
this.sum += parseFloat(x);
|
@@ -4313,7 +4314,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4313
4314
|
if (this.ignoreValue) {
|
4314
4315
|
return null;
|
4315
4316
|
}
|
4316
|
-
if (useTotalsCalculation) {
|
4317
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4317
4318
|
return this.sum;
|
4318
4319
|
}
|
4319
4320
|
return this.sum / this.len;
|
@@ -8630,7 +8631,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8630
8631
|
};
|
8631
8632
|
|
8632
8633
|
highchartsRenderer.setNewFieldNames = function (res) {
|
8633
|
-
if (useTotalsCalculation) {
|
8634
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
8634
8635
|
return res;
|
8635
8636
|
}
|
8636
8637
|
|