@datarailsshared/dr_renderer 1.5.174 → 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 +30 -35
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({
|
|
@@ -4666,7 +4661,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4666
4661
|
minCategories,
|
|
4667
4662
|
maxCategories
|
|
4668
4663
|
});
|
|
4669
|
-
console.error(dataConflictError
|
|
4664
|
+
console.error(dataConflictError);
|
|
4670
4665
|
throw dataConflictError;
|
|
4671
4666
|
}
|
|
4672
4667
|
}
|
|
@@ -4677,7 +4672,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4677
4672
|
}
|
|
4678
4673
|
|
|
4679
4674
|
const noDataError = new NoDataError();
|
|
4680
|
-
console.error(noDataError
|
|
4675
|
+
console.error(noDataError);
|
|
4681
4676
|
throw noDataError;
|
|
4682
4677
|
}
|
|
4683
4678
|
|
|
@@ -4687,7 +4682,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4687
4682
|
}
|
|
4688
4683
|
|
|
4689
4684
|
const tooMuchDataError = new TooMuchDataError();
|
|
4690
|
-
console.error(tooMuchDataError
|
|
4685
|
+
console.error(tooMuchDataError);
|
|
4691
4686
|
throw tooMuchDataError;
|
|
4692
4687
|
}
|
|
4693
4688
|
|
|
@@ -4728,10 +4723,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4728
4723
|
|
|
4729
4724
|
result = opts.renderer(pivotData, opts.rendererOptions);
|
|
4730
4725
|
} catch (_error) {
|
|
4731
|
-
result =
|
|
4726
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericRenderingError());
|
|
4732
4727
|
}
|
|
4733
4728
|
} catch (_error) {
|
|
4734
|
-
result =
|
|
4729
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericComputationalError());
|
|
4735
4730
|
}
|
|
4736
4731
|
|
|
4737
4732
|
return result;
|
|
@@ -4775,7 +4770,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4775
4770
|
minCategories,
|
|
4776
4771
|
maxCategories
|
|
4777
4772
|
});
|
|
4778
|
-
console.error(dataConflictError
|
|
4773
|
+
console.error(dataConflictError);
|
|
4779
4774
|
throw dataConflictError;
|
|
4780
4775
|
}
|
|
4781
4776
|
}
|
|
@@ -4786,7 +4781,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4786
4781
|
}
|
|
4787
4782
|
|
|
4788
4783
|
const noDataError = new NoDataError();
|
|
4789
|
-
console.error(noDataError
|
|
4784
|
+
console.error(noDataError);
|
|
4790
4785
|
throw noDataError;
|
|
4791
4786
|
}
|
|
4792
4787
|
|
|
@@ -4796,7 +4791,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4796
4791
|
}
|
|
4797
4792
|
|
|
4798
4793
|
const tooMuchDataError = new TooMuchDataError();
|
|
4799
|
-
console.error(tooMuchDataError
|
|
4794
|
+
console.error(tooMuchDataError);
|
|
4800
4795
|
throw tooMuchDataError;
|
|
4801
4796
|
}
|
|
4802
4797
|
|
|
@@ -4807,7 +4802,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4807
4802
|
|
|
4808
4803
|
if (noNeedleOrGoalSelected) {
|
|
4809
4804
|
const gaugeError = new GaugeConfigurationError();
|
|
4810
|
-
console.error(gaugeError
|
|
4805
|
+
console.error(gaugeError);
|
|
4811
4806
|
throw gaugeError;
|
|
4812
4807
|
}
|
|
4813
4808
|
}
|
|
@@ -4848,10 +4843,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4848
4843
|
|
|
4849
4844
|
result = opts.renderer(pivotData, opts.rendererOptions);
|
|
4850
4845
|
} catch (_error) {
|
|
4851
|
-
result =
|
|
4846
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericRenderingError());
|
|
4852
4847
|
}
|
|
4853
4848
|
} catch (_error) {
|
|
4854
|
-
result =
|
|
4849
|
+
result = _handlePivotRendererError(_error, options.onlyOptions, new GenericComputationalError());
|
|
4855
4850
|
}
|
|
4856
4851
|
|
|
4857
4852
|
return result;
|