Browse Source

UI: fixed message 'No data to display on widget' not showing when there is no data for timeseries and value chart widgets

pull/9447/head
rusikv 3 years ago
parent
commit
8d9f5f925e
  1. 4
      ui-ngx/src/app/modules/home/components/widget/lib/cards/aggregated-value-card-widget.component.ts
  2. 4
      ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.component.ts

4
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,

4
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 {

Loading…
Cancel
Save