|
|
@ -45,9 +45,7 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = { |
|
|
|
stat: Stat.CURRENT, |
|
|
|
stat: Stat.CURRENT, |
|
|
|
innerRadius: DEFAULT_INNER_RADIUS, |
|
|
|
innerRadius: DEFAULT_INNER_RADIUS, |
|
|
|
outerRadius: DEFAULT_OUTER_RADIUS, |
|
|
|
outerRadius: DEFAULT_OUTER_RADIUS, |
|
|
|
valueTextFormat: { |
|
|
|
valueFormatter: val => val.toString()
|
|
|
|
decimals: DEFAULT_VALUE_TEXT_Decimals |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> { |
|
|
|
export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> { |
|
|
@ -198,8 +196,11 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private get _valueText(): string { |
|
|
|
private get _valueText(): string { |
|
|
|
const decimalsCount = this._valueTextDecimals; |
|
|
|
if(this.options.valueFormatter) { |
|
|
|
return this.aggregatedValue.toFixed(decimalsCount); |
|
|
|
console.log('valueFormatter function is not specified, rendering raw value'); |
|
|
|
|
|
|
|
return this.aggregatedValue.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.options.valueFormatter(this.aggregatedValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private get _valueTextFontSize(): number { |
|
|
|
private get _valueTextFontSize(): number { |
|
|
@ -246,13 +247,6 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions |
|
|
|
return scale; |
|
|
|
return scale; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private get _valueTextDecimals(): number { |
|
|
|
|
|
|
|
if(this.options.valueTextFormat === undefined) { |
|
|
|
|
|
|
|
throw new Error(`Options has no valueTextFormat`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.options.valueTextFormat.decimals; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private get aggregatedValue(): number { |
|
|
|
private get aggregatedValue(): number { |
|
|
|
switch(this._stat) { |
|
|
|
switch(this._stat) { |
|
|
|
case Stat.CURRENT: |
|
|
|
case Stat.CURRENT: |
|
|
|