Commit 8aedf811 by Torkel Ödegaard Committed by GitHub

Graph: Legend decimals now work as expected (#24931)

* Graph: Legend decimals now work as expected

* removed new test that I could not get green
parent 6099398c
......@@ -25,6 +25,7 @@ const formatTests: ValueFormatTest[] = [
{ id: 'ms', decimals: 0, value: 1200, result: '1 s' },
{ id: 'short', decimals: 0, scaledDecimals: -1, value: 98765, result: '98.77 K' },
{ id: 'short', decimals: 0, scaledDecimals: 0, value: 9876543, result: '9.876543 Mil' },
{ id: 'short', decimals: 2, scaledDecimals: null, value: 9876543, result: '9.88 Mil' },
{ id: 'kbytes', decimals: 3, value: 10000000, result: '9.537 GiB' },
{ id: 'deckbytes', decimals: 3, value: 10000000, result: '10.000 GB' },
{ id: 'megwatt', decimals: 3, value: 1000, result: '1.000 GW' },
......
......@@ -98,8 +98,8 @@ export default class TimeSeries {
hideTooltip: boolean;
allIsNull: boolean;
allIsZero: boolean;
decimals: number;
scaledDecimals: number;
decimals: DecimalCount;
scaledDecimals: DecimalCount;
hasMsResolution: boolean;
isOutsideRange: boolean;
......@@ -344,8 +344,8 @@ export default class TimeSeries {
updateLegendValues(formater: ValueFormatter, decimals: DecimalCount, scaledDecimals: DecimalCount) {
this.valueFormater = formater;
this.decimals = decimals ?? 0;
this.scaledDecimals = scaledDecimals ?? 0;
this.decimals = decimals;
this.scaledDecimals = scaledDecimals;
}
formatValue(value: number) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment