UI: Fixed decimals value for analogue charts
This commit is contained in:
parent
8baa86b1dc
commit
7af6199cfc
@ -17,7 +17,7 @@
|
||||
import * as CanvasGauges from 'canvas-gauges';
|
||||
import { FontSettings, getFontFamily } from '@home/components/widget/lib/settings.models';
|
||||
import { WidgetContext } from '@home/models/widget-component.models';
|
||||
import { isDefined } from '@core/utils';
|
||||
import { isDefined, isDefinedAndNotNull } from '@core/utils';
|
||||
import tinycolor from 'tinycolor2';
|
||||
import Highlight = CanvasGauges.Highlight;
|
||||
import BaseGauge = CanvasGauges.BaseGauge;
|
||||
@ -264,8 +264,7 @@ function getValueDec(ctx: WidgetContext, settings: AnalogueGaugeSettings): numbe
|
||||
if (dataKey && isDefined(dataKey.decimals)) {
|
||||
return dataKey.decimals;
|
||||
} else {
|
||||
return (isDefined(settings.valueDec) && settings.valueDec !== null)
|
||||
? settings.valueDec : ctx.decimals;
|
||||
return isDefinedAndNotNull(ctx.decimals) ? ctx.decimals : (settings.valueDec || 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,6 +49,7 @@ export class AnalogueGaugeWidgetSettingsComponent extends WidgetSettingsComponen
|
||||
minorTicks: 2,
|
||||
valueBox: true,
|
||||
valueInt: 3,
|
||||
valueDec: 0,
|
||||
defaultColor: null,
|
||||
colorPlate: '#fff',
|
||||
colorMajorTicks: '#444',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user