Browse Source
Merge pull request #13068 from vvlladd28/bug/chart-widget/switch-type
Fixed chart settings not updating when switching types in Advanced Mode
pull/13080/head
Igor Kulikov
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
11 additions and
0 deletions
-
ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts
|
|
|
@ -105,6 +105,17 @@ export class TimeSeriesChartWidgetSettingsComponent extends WidgetSettingsCompon |
|
|
|
const params = widgetConfig.typeParameters as any; |
|
|
|
if (isDefinedAndNotNull(params.chartType)) { |
|
|
|
this.chartType = params.chartType; |
|
|
|
} else { |
|
|
|
this.chartType = TimeSeriesChartType.default; |
|
|
|
} |
|
|
|
if (this.timeSeriesChartWidgetSettingsForm) { |
|
|
|
const isStateChartType = this.chartType === TimeSeriesChartType.state; |
|
|
|
const hasStatesControl = this.timeSeriesChartWidgetSettingsForm.contains('states'); |
|
|
|
if (isStateChartType && !hasStatesControl) { |
|
|
|
this.timeSeriesChartWidgetSettingsForm.addControl('states', this.fb.control(widgetConfig.config.settings.states), { emitEvent: false }); |
|
|
|
} else if (!isStateChartType && hasStatesControl) { |
|
|
|
this.timeSeriesChartWidgetSettingsForm.removeControl('states', { emitEvent: false }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|