diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/cards/aggregated-value-card-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/cards/aggregated-value-card-widget.component.ts index 5380874811..e81cb270e7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/cards/aggregated-value-card-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/cards/aggregated-value-card-widget.component.ts @@ -116,7 +116,7 @@ export class AggregatedValueCardWidgetComponent implements OnInit, AfterViewInit ngOnInit(): void { this.ctx.$scope.aggregatedValueCardWidget = this; this.settings = {...aggregatedValueCardDefaultSettings, ...this.ctx.settings}; - this.showSubtitle = this.settings.showSubtitle; + this.showSubtitle = this.settings.showSubtitle && this.ctx.datasources?.length > 0; const subtitle = this.settings.subtitle; this.subtitle$ = this.ctx.registerLabelPattern(subtitle, this.subtitle$); this.subtitleStyle = textStyle(this.settings.subtitleFont, '0.25px'); @@ -156,7 +156,7 @@ export class AggregatedValueCardWidgetComponent implements OnInit, AfterViewInit } ngAfterViewInit(): void { - if (this.showChart) { + if (this.showChart && this.ctx.datasources?.length) { const settings = { shadowSize: 0, enableSelection: false, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.component.ts index 9272295a27..1494e987ce 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.component.ts @@ -60,7 +60,9 @@ export class FlotWidgetComponent implements OnInit { this.settings = this.ctx.settings; this.chartType = this.chartType || 'line'; this.configureLegend(); - this.flot = new TbFlot(this.ctx, this.chartType, $(this.flotElement.nativeElement)); + if (this.ctx.datasources?.length) { + this.flot = new TbFlot(this.ctx, this.chartType, $(this.flotElement.nativeElement)); + } } private configureLegend(): void {