Browse Source

Fix wrong number of digits after floating point in legend

pull/3551/head
Chantsova Ekaterina 6 years ago
committed by Andrew Shvayka
parent
commit
aa82a478cb
  1. 4
      ui-ngx/src/app/core/api/widget-subscription.ts
  2. 2
      ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts

4
ui-ngx/src/app/core/api/widget-subscription.ts

@ -47,7 +47,7 @@ import {
import { forkJoin, Observable, of, ReplaySubject, Subject, throwError } from 'rxjs'; import { forkJoin, Observable, of, ReplaySubject, Subject, throwError } from 'rxjs';
import { CancelAnimationFrame } from '@core/services/raf.service'; import { CancelAnimationFrame } from '@core/services/raf.service';
import { EntityType } from '@shared/models/entity-type.models'; 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 { EntityId } from '@app/shared/models/id/entity-id';
import * as moment_ from 'moment'; import * as moment_ from 'moment';
import { emptyPageData, PageData } from '@shared/models/page/page-data'; 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) { private updateLegend(dataIndex: number, data: DataSet, detectChanges: boolean) {
const dataKey = this.legendData.keys.find(key => key.dataIndex === dataIndex).dataKey; 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 units = dataKey.units && dataKey.units.length ? dataKey.units : this.units;
const legendKeyData = this.legendData.data[dataIndex]; const legendKeyData = this.legendData.data[dataIndex];
if (this.legendConfig.showMin) { if (this.legendConfig.showMin) {

2
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 yaxesMap: {[units: string]: TbFlotAxisOptions} = {};
const predefinedThresholds: TbFlotThresholdMarking[] = []; const predefinedThresholds: TbFlotThresholdMarking[] = [];
const thresholdsDatasources: Datasource[] = []; const thresholdsDatasources: Datasource[] = [];
if (this.settings.customLegendEnabled) { if (this.settings.customLegendEnabled && this.settings.dataKeysListForLabels?.length) {
this.labelPatternsSourcesData = []; this.labelPatternsSourcesData = [];
const labelPatternsDatasources: Datasource[] = []; const labelPatternsDatasources: Datasource[] = [];
this.settings.dataKeysListForLabels.forEach((item) => { this.settings.dataKeysListForLabels.forEach((item) => {

Loading…
Cancel
Save