@datarailsshared/dr_renderer 1.4.61 → 1.4.65

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.4.61",
3
+ "version": "1.4.65",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -5256,10 +5256,27 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5256
5256
  }
5257
5257
  };
5258
5258
 
5259
- highchartsRenderer.setMissingWidgetOptions = function(options, type) {
5260
- if (!lodash.has(options, 'chartOptions')) return;
5259
+ highchartsRenderer.setMissingWidgetOptions = function (options, type) {
5260
+ if (!options || !lodash.has(options, 'chartOptions')) return;
5261
+
5261
5262
  const defaultOptions = highchartsRenderer.getDefaultValueForChart(type);
5262
- options.chartOptions = lodash.merge(defaultOptions, options.chartOptions);
5263
+
5264
+ // User can remove segment and this part of code was made to
5265
+ // prevent a set of default value
5266
+ if (type === highchartsRenderer.CHART_TYPES.GAUGE_CHART_DYNAMIC_GOAL) {
5267
+ const chartOptions = options.chartOptions || {};
5268
+ const userSegments = chartOptions.segments;
5269
+ const merged = lodash.merge({}, defaultOptions, lodash.omit(chartOptions, 'segments'));
5270
+
5271
+ if (Array.isArray(userSegments)) {
5272
+ merged.segments = userSegments;
5273
+ }
5274
+
5275
+ options.chartOptions = merged;
5276
+ return;
5277
+ }
5278
+
5279
+ options.chartOptions = lodash.merge({}, defaultOptions, options.chartOptions);
5263
5280
  };
5264
5281
 
5265
5282
  highchartsRenderer.addPivotOptions = function (selectedTemplateWOData, widgetOptions, drilldownFunction, drillDownListFunction) {