From aa82a478cbc704a37a5449b844e752868ca9cd82 Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Tue, 6 Oct 2020 10:36:21 +0300 Subject: [PATCH] Fix wrong number of digits after floating point in legend --- ui-ngx/src/app/core/api/widget-subscription.ts | 4 ++-- .../src/app/modules/home/components/widget/lib/flot-widget.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/core/api/widget-subscription.ts b/ui-ngx/src/app/core/api/widget-subscription.ts index 9d046bbf83..c574fd426a 100644 --- a/ui-ngx/src/app/core/api/widget-subscription.ts +++ b/ui-ngx/src/app/core/api/widget-subscription.ts @@ -47,7 +47,7 @@ import { import { forkJoin, Observable, of, ReplaySubject, Subject, throwError } from 'rxjs'; import { CancelAnimationFrame } from '@core/services/raf.service'; import { EntityType } from '@shared/models/entity-type.models'; -import { createLabelFromDatasource, deepClone, isDefined, isEqual } from '@core/utils'; +import { createLabelFromDatasource, deepClone, isDefined, isDefinedAndNotNull, isEqual } from '@core/utils'; import { EntityId } from '@app/shared/models/id/entity-id'; import * as moment_ from 'moment'; import { emptyPageData, PageData } from '@shared/models/page/page-data'; @@ -1332,7 +1332,7 @@ export class WidgetSubscription implements IWidgetSubscription { private updateLegend(dataIndex: number, data: DataSet, detectChanges: boolean) { const dataKey = this.legendData.keys.find(key => key.dataIndex === dataIndex).dataKey; - const decimals = isDefined(dataKey.decimals) ? dataKey.decimals : this.decimals; + const decimals = isDefinedAndNotNull(dataKey.decimals) ? dataKey.decimals : this.decimals; const units = dataKey.units && dataKey.units.length ? dataKey.units : this.units; const legendKeyData = this.legendData.data[dataIndex]; if (this.legendConfig.showMin) { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts index d334d5c99a..03f6d1b975 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts @@ -380,7 +380,7 @@ export class TbFlot { const yaxesMap: {[units: string]: TbFlotAxisOptions} = {}; const predefinedThresholds: TbFlotThresholdMarking[] = []; const thresholdsDatasources: Datasource[] = []; - if (this.settings.customLegendEnabled) { + if (this.settings.customLegendEnabled && this.settings.dataKeysListForLabels?.length) { this.labelPatternsSourcesData = []; const labelPatternsDatasources: Datasource[] = []; this.settings.dataKeysListForLabels.forEach((item) => {