diff --git a/ui-ngx/src/app/shared/models/widget-settings.models.ts b/ui-ngx/src/app/shared/models/widget-settings.models.ts index 45f7f9f1fc..9c3cb68a30 100644 --- a/ui-ngx/src/app/shared/models/widget-settings.models.ts +++ b/ui-ngx/src/app/shared/models/widget-settings.models.ts @@ -361,19 +361,10 @@ export interface ColorProcessorSettings { export abstract class ColorProcessor { static fromSettings(color: ColorSettings, ctx?: WidgetContext): ColorProcessor { - const settings = color || constantColor(null); - switch (settings.type) { - case ColorType.constant: - return new ConstantColorProcessor(settings); - case ColorType.range: - return new RangeColorProcessor(settings, ctx); - case ColorType.function: - return new FunctionColorProcessor(settings); - case ColorType.gradient: - return new GradientColorProcessor(settings, ctx); - default: - return new ConstantColorProcessor(settings); - } + return ColorProcessor.fromColorProcessingSettings({ + settings: color, + ctx + }); } static fromColorProcessingSettings(setting: ColorProcessorSettings): ColorProcessor {