@datarailsshared/dr_renderer 1.5.171 → 1.5.180
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/dr_pivottable.js +1 -1
- package/src/highcharts_renderer.js +37 -53
- package/src/index.d.ts +0 -4
- package/src/index.js +0 -1
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -365,7 +365,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
365
365
|
pvtData.colKeys = [];
|
|
366
366
|
|
|
367
367
|
const tooMuchDataError = new TooMuchDataError();
|
|
368
|
-
console.error(tooMuchDataError
|
|
368
|
+
console.error(tooMuchDataError);
|
|
369
369
|
throw tooMuchDataError;
|
|
370
370
|
}
|
|
371
371
|
return SubtotalRenderer(pvtData, opts, charttype);
|
|
@@ -122,34 +122,29 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
122
122
|
const environment = envOptions || {};
|
|
123
123
|
highchartsRenderer.environment = environment;
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Handles errors that occur during pivot renderer processing.
|
|
127
|
+
*
|
|
128
|
+
* @param {Error} err - The error that occurred during pivot rendering
|
|
129
|
+
* @param {boolean} onlyOptions - If true, logs the error and returns empty options object instead of throwing
|
|
130
|
+
* @param {Error} fallbackError - The fallback error to throw when onlyOptions is false and err is not a BaseRendererError
|
|
131
|
+
* @returns {Object|void} Returns empty object when onlyOptions is true, otherwise throws an error
|
|
132
|
+
* @throws {BaseRendererError} Throws the original error if it's an instance of BaseRendererError
|
|
133
|
+
* @throws {Error} Throws the fallbackError when onlyOptions is false and err is not a BaseRendererError
|
|
134
|
+
*/
|
|
135
|
+
const _handlePivotRendererError = (err, onlyOptions, fallbackError) => {
|
|
126
136
|
if (err instanceof BaseRendererError) {
|
|
127
137
|
throw err;
|
|
128
138
|
}
|
|
129
139
|
|
|
130
|
-
|
|
140
|
+
console.error(err);
|
|
131
141
|
if (onlyOptions) {
|
|
132
|
-
console.error(genericError.title);
|
|
133
142
|
return {};
|
|
134
143
|
} else {
|
|
135
|
-
throw
|
|
144
|
+
throw fallbackError;
|
|
136
145
|
}
|
|
137
146
|
};
|
|
138
147
|
|
|
139
|
-
const _handleRenderingError = (err, onlyOptions) => {
|
|
140
|
-
if (err instanceof BaseRendererError) {
|
|
141
|
-
throw err;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const genericError = new GenericRenderingError();
|
|
145
|
-
console.error(genericError.title);
|
|
146
|
-
if (onlyOptions) {
|
|
147
|
-
return {};
|
|
148
|
-
} else {
|
|
149
|
-
throw genericError;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
148
|
/**
|
|
154
149
|
* Sanitizes series data for 100% stacking by converting negative values to 0.
|
|
155
150
|
* @param {Array<Object>} series - Array of Highcharts series objects
|
|
@@ -1206,11 +1201,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1206
1201
|
|
|
1207
1202
|
if (!seriesDataLength && !chartOptions.onlyText) {
|
|
1208
1203
|
const noDataError = new NoDataError();
|
|
1209
|
-
console.error(noDataError
|
|
1204
|
+
console.error(noDataError);
|
|
1210
1205
|
throw noDataError;
|
|
1211
1206
|
} else if (!chartOptions.onlyText && chartOptions.series && toMatch) {
|
|
1212
1207
|
const tooMuchDataError = new TooMuchDataError();
|
|
1213
|
-
console.error(tooMuchDataError
|
|
1208
|
+
console.error(tooMuchDataError);
|
|
1214
1209
|
throw tooMuchDataError;
|
|
1215
1210
|
} else {
|
|
1216
1211
|
chartOptions = highchartsRenderer.updateChartOptions(chartOptions, opts);
|
|
@@ -1821,14 +1816,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1821
1816
|
|
|
1822
1817
|
let color = '';
|
|
1823
1818
|
|
|
1824
|
-
if (!lodash.get(waterfallOptions, 'colors'
|
|
1819
|
+
if (!lodash.get(waterfallOptions, 'colors') && value.color) {
|
|
1825
1820
|
color = value.color;
|
|
1826
1821
|
} else if (value.trend === 'total') {
|
|
1827
|
-
color = lodash.get(waterfallOptions, 'colors'
|
|
1822
|
+
color = (lodash.get(waterfallOptions, 'colors') || {}).total || baseColor.total;
|
|
1828
1823
|
} else {
|
|
1829
1824
|
color = val > 0
|
|
1830
|
-
? lodash.get(waterfallOptions, 'colors'
|
|
1831
|
-
: lodash.get(waterfallOptions, 'colors'
|
|
1825
|
+
? (lodash.get(waterfallOptions, 'colors') || {}).increase || baseColor.increase
|
|
1826
|
+
: (lodash.get(waterfallOptions, 'colors') || {}).decrease || baseColor.decrease;
|
|
1832
1827
|
}
|
|
1833
1828
|
if (val !== 0) {
|
|
1834
1829
|
resultObject.data.push({
|
|
@@ -3999,9 +3994,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3999
3994
|
calculated_formats: calculated_info.formats,
|
|
4000
3995
|
isChangeable: false,
|
|
4001
3996
|
push: function (record) {
|
|
4002
|
-
|
|
4003
|
-
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4004
|
-
}
|
|
3997
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4005
3998
|
|
|
4006
3999
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
4007
4000
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -4168,9 +4161,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4168
4161
|
var val = parseFloat(record[attr]);
|
|
4169
4162
|
|
|
4170
4163
|
if (!isNaN(val)) {
|
|
4171
|
-
|
|
4172
|
-
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4173
|
-
}
|
|
4164
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4174
4165
|
|
|
4175
4166
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
4176
4167
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -4263,9 +4254,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4263
4254
|
var ref, x;
|
|
4264
4255
|
x = parseFloat(record[attr]);
|
|
4265
4256
|
if (!isNaN(x)) {
|
|
4266
|
-
|
|
4267
|
-
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4268
|
-
}
|
|
4257
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4269
4258
|
|
|
4270
4259
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
4271
4260
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -4356,9 +4345,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4356
4345
|
var ref, x;
|
|
4357
4346
|
x = parseFloat(record[attr]);
|
|
4358
4347
|
if (!isNaN(x)) {
|
|
4359
|
-
|
|
4360
|
-
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4361
|
-
}
|
|
4348
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4362
4349
|
|
|
4363
4350
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
4364
4351
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -4450,9 +4437,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4450
4437
|
var ref, x;
|
|
4451
4438
|
x = parseFloat(record[attr]);
|
|
4452
4439
|
if (!isNaN(x)) {
|
|
4453
|
-
|
|
4454
|
-
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4455
|
-
}
|
|
4440
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
|
4456
4441
|
|
|
4457
4442
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
|
4458
4443
|
this.data_types = this.data_types.concat(record['data_types']);
|
|
@@ -4676,7 +4661,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4676
4661
|
minCategories,
|
|
4677
4662
|
maxCategories
|
|
4678
4663
|
});
|
|
4679
|
-
console.error(dataConflictError
|
|
4664
|
+
console.error(dataConflictError);
|
|
4680
4665
|
throw dataConflictError;
|
|
4681
4666
|
}
|
|
4682
4667
|
}
|
|
@@ -4687,7 +4672,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4687
4672
|
}
|
|
4688
4673
|
|
|
4689
4674
|
const noDataError = new NoDataError();
|
|
4690
|
-
console.error(noDataError
|
|
4675
|
+
console.error(noDataError);
|
|
4691
4676
|
throw noDataError;
|
|
4692
4677
|
}
|
|
4693
4678
|
|
|
@@ -4697,7 +4682,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4697
4682
|
}
|
|
4698
4683
|
|
|
4699
4684
|
const tooMuchDataError = new TooMuchDataError();
|
|
4700
|
-
console.error(tooMuchDataError
|
|
4685
|
+
console.error(tooMuchDataError);
|
|
4701
4686
|
throw tooMuchDataError;
|
|
4702
4687
|
}
|
|
4703
4688
|
|
|
@@ -4738,10 +4723,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4738
4723
|
|
|
4739
4724
|
result = opts.renderer(pivotData, opts.rendererOptions);
|
|
4740
4725
|
} catch (_error) {
|
|
4741
|
-
result =
|
|
4726
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericRenderingError());
|
|
4742
4727
|
}
|
|
4743
4728
|
} catch (_error) {
|
|
4744
|
-
result =
|
|
4729
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericComputationalError());
|
|
4745
4730
|
}
|
|
4746
4731
|
|
|
4747
4732
|
return result;
|
|
@@ -4785,7 +4770,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4785
4770
|
minCategories,
|
|
4786
4771
|
maxCategories
|
|
4787
4772
|
});
|
|
4788
|
-
console.error(dataConflictError
|
|
4773
|
+
console.error(dataConflictError);
|
|
4789
4774
|
throw dataConflictError;
|
|
4790
4775
|
}
|
|
4791
4776
|
}
|
|
@@ -4796,7 +4781,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4796
4781
|
}
|
|
4797
4782
|
|
|
4798
4783
|
const noDataError = new NoDataError();
|
|
4799
|
-
console.error(noDataError
|
|
4784
|
+
console.error(noDataError);
|
|
4800
4785
|
throw noDataError;
|
|
4801
4786
|
}
|
|
4802
4787
|
|
|
@@ -4806,7 +4791,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4806
4791
|
}
|
|
4807
4792
|
|
|
4808
4793
|
const tooMuchDataError = new TooMuchDataError();
|
|
4809
|
-
console.error(tooMuchDataError
|
|
4794
|
+
console.error(tooMuchDataError);
|
|
4810
4795
|
throw tooMuchDataError;
|
|
4811
4796
|
}
|
|
4812
4797
|
|
|
@@ -4817,7 +4802,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4817
4802
|
|
|
4818
4803
|
if (noNeedleOrGoalSelected) {
|
|
4819
4804
|
const gaugeError = new GaugeConfigurationError();
|
|
4820
|
-
console.error(gaugeError
|
|
4805
|
+
console.error(gaugeError);
|
|
4821
4806
|
throw gaugeError;
|
|
4822
4807
|
}
|
|
4823
4808
|
}
|
|
@@ -4858,10 +4843,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4858
4843
|
|
|
4859
4844
|
result = opts.renderer(pivotData, opts.rendererOptions);
|
|
4860
4845
|
} catch (_error) {
|
|
4861
|
-
result =
|
|
4846
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericRenderingError());
|
|
4862
4847
|
}
|
|
4863
4848
|
} catch (_error) {
|
|
4864
|
-
result =
|
|
4849
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericComputationalError());
|
|
4865
4850
|
}
|
|
4866
4851
|
|
|
4867
4852
|
return result;
|
|
@@ -8179,12 +8164,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8179
8164
|
}
|
|
8180
8165
|
|
|
8181
8166
|
// Will be FALSE when all 4 conditions true: 1. User applies SecondaryAxis 2. Format on 'format editor panel' is same as any Value field table format
|
|
8182
|
-
// 3. Chart has more than one value fields in Values block
|
|
8183
|
-
// In that case we apply for both value fields their format from the table
|
|
8167
|
+
// 3. Chart has more than one value fields in Values block
|
|
8184
8168
|
// In all other cases we are applying format from editor panel to both of them (specification: DR-20955)
|
|
8185
8169
|
highchartsRenderer.isUsingWidgetValuesFormat = function (pivotData, render_options, widget_values_format) {
|
|
8186
8170
|
const { isSecondaryAxis, isCustomFormat } = highchartsRenderer.checkFormats(render_options, widget_values_format);
|
|
8187
|
-
return !highchartsRenderer.
|
|
8171
|
+
return !highchartsRenderer.isChartWithMultiValues(pivotData) || !isSecondaryAxis || isCustomFormat;
|
|
8188
8172
|
}
|
|
8189
8173
|
|
|
8190
8174
|
highchartsRenderer.isFormattingNumberAxis = function (pivotData) {
|
package/src/index.d.ts
CHANGED
|
@@ -71,10 +71,6 @@ export type EnvironmentOptions = {
|
|
|
71
71
|
* - Enable stacked percent charts
|
|
72
72
|
*/
|
|
73
73
|
enableStackedPercentCharts?: boolean | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* - TODO: remove in DR-42736
|
|
76
|
-
*/
|
|
77
|
-
enabledNewWidgetValueFormatting?: boolean | undefined;
|
|
78
74
|
/**
|
|
79
75
|
* - Allow custom gauge goal title
|
|
80
76
|
*/
|
package/src/index.js
CHANGED
|
@@ -22,7 +22,6 @@ const freezePanes = require('./pivot-table/freeze-panes');
|
|
|
22
22
|
* @property {number} [fiscal_year_starts_from] - Fiscal year start month
|
|
23
23
|
* @property {boolean} [fiscal_year_back] - Fiscal year direction
|
|
24
24
|
* @property {boolean} [enableStackedPercentCharts] - Enable stacked percent charts
|
|
25
|
-
* @property {boolean} [enabledNewWidgetValueFormatting] - TODO: remove in DR-42736
|
|
26
25
|
* @property {boolean} [enableGaugeDynamicGoal] - Allow custom gauge goal title
|
|
27
26
|
*/
|
|
28
27
|
|