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