mirror of
https://github.com/nasa/openmct.git
synced 2025-01-13 00:09:47 +00:00
[Data Format] Don't truncate data values
This commit is contained in:
parent
ad4c456ca2
commit
d6ab70447e
@ -26,10 +26,6 @@ define(
|
|||||||
function () {
|
function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Date format to use for domain values; in particular,
|
|
||||||
// use day-of-year instead of month/day
|
|
||||||
var VALUE_FORMAT_DIGITS = 3;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TelemetryFormatter is responsible for formatting (as text
|
* The TelemetryFormatter is responsible for formatting (as text
|
||||||
* for display) values along either the domain (usually time) or
|
* for display) values along either the domain (usually time) or
|
||||||
@ -73,7 +69,7 @@ define(
|
|||||||
* value, suitable for display.
|
* value, suitable for display.
|
||||||
*/
|
*/
|
||||||
TelemetryFormatter.prototype.formatRangeValue = function (v, key) {
|
TelemetryFormatter.prototype.formatRangeValue = function (v, key) {
|
||||||
return isNaN(v) ? String(v) : v.toFixed(VALUE_FORMAT_DIGITS);
|
return String(v);
|
||||||
};
|
};
|
||||||
|
|
||||||
return TelemetryFormatter;
|
return TelemetryFormatter;
|
||||||
|
@ -59,7 +59,10 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("formats ranges as values", function () {
|
it("formats ranges as values", function () {
|
||||||
expect(formatter.formatRangeValue(10)).toEqual("10.000");
|
var value = 3.14159265352979323846264338, // not pi
|
||||||
|
formatted = formatter.formatRangeValue(value);
|
||||||
|
// Make sure we don't lose information by formatting
|
||||||
|
expect(parseFloat(formatted)).toEqual(value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user