Add toStringRounded
This commit is contained in:
parent
a2d9017326
commit
b5f025dc69
|
@ -14,7 +14,7 @@ public static class Flow
|
||||||
|
|
||||||
public static TextBlock Horizontal(Unit amount, Int32 width = 10)
|
public static TextBlock Horizontal(Unit amount, Int32 width = 10)
|
||||||
{
|
{
|
||||||
var label = amount.ToString();
|
var label = amount.ToStringRounded();
|
||||||
var arrowChar = amount.Value < 0 ? LeftArrowChar : RightArrowChar;
|
var arrowChar = amount.Value < 0 ? LeftArrowChar : RightArrowChar;
|
||||||
var arrow = Enumerable.Repeat(arrowChar, width).Join();
|
var arrow = Enumerable.Repeat(arrowChar, width).Join();
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public static class Flow
|
||||||
[SuppressMessage("ReSharper", "CoVariantArrayConversion")]
|
[SuppressMessage("ReSharper", "CoVariantArrayConversion")]
|
||||||
public static TextBlock Vertical(Unit amount, Int32 height = 4)
|
public static TextBlock Vertical(Unit amount, Int32 height = 4)
|
||||||
{
|
{
|
||||||
var label = amount.ToString();
|
var label = amount.ToStringRounded();
|
||||||
var arrowChar = amount.Value < 0 ? UpArrowChar : DownArrowChar;
|
var arrowChar = amount.Value < 0 ? UpArrowChar : DownArrowChar;
|
||||||
var halfArrow = Enumerable.Repeat(arrowChar, height/2);
|
var halfArrow = Enumerable.Repeat(arrowChar, height/2);
|
||||||
|
|
||||||
|
|
|
@ -8,4 +8,5 @@ public abstract class Unit
|
||||||
public Double Value { get; }
|
public Double Value { get; }
|
||||||
|
|
||||||
public override String ToString() => $"{Value} {Symbol}";
|
public override String ToString() => $"{Value} {Symbol}";
|
||||||
|
public String ToStringRounded() => $"{Math.Round(Value,3)} {Symbol}";
|
||||||
}
|
}
|
Loading…
Reference in New Issue