mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-20 05:48:14 +08:00
Merge pull request #1303 from nils-a/feature/GH-684
This commit is contained in:
@ -30,6 +30,11 @@ public sealed class BreakdownChart : Renderable, IHasCulture, IExpandable
|
||||
/// </summary>
|
||||
public Func<double, CultureInfo, string>? ValueFormatter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Color in which the values will be shown.
|
||||
/// </summary>
|
||||
public Color ValueColor { get; set; } = Color.Grey;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether or not the
|
||||
/// chart and tags should be rendered in compact mode.
|
||||
@ -94,6 +99,7 @@ public sealed class BreakdownChart : Renderable, IHasCulture, IExpandable
|
||||
Culture = Culture,
|
||||
ShowTagValues = ShowTagValues,
|
||||
ValueFormatter = ValueFormatter,
|
||||
ValueColor = ValueColor,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ internal sealed class BreakdownTags : Renderable
|
||||
public CultureInfo? Culture { get; set; }
|
||||
public bool ShowTagValues { get; set; } = true;
|
||||
public Func<double, CultureInfo, string>? ValueFormatter { get; set; }
|
||||
public Color ValueColor { get; set; } = Color.Grey;
|
||||
|
||||
public BreakdownTags(List<IBreakdownChartItem> data)
|
||||
{
|
||||
@ -55,8 +56,9 @@ internal sealed class BreakdownTags : Renderable
|
||||
|
||||
if (ShowTagValues)
|
||||
{
|
||||
return string.Format(culture, "{0} [grey]{1}[/]",
|
||||
return string.Format(culture, "{0} [{1}]{2}[/]",
|
||||
item.Label.EscapeMarkup(),
|
||||
ValueColor.ToMarkup(),
|
||||
formatter(item.Value, culture));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user