mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-05-02 15:52:49 +08:00

This also cleans up the bar chart code slightly and fixes some minor bugs that were detected in related code. Closes #244
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
|
|
namespace Spectre.Console
|
|
{
|
|
/// <summary>
|
|
/// An item that's shown in a breakdown chart.
|
|
/// </summary>
|
|
public sealed class BreakdownChartItem : IBreakdownChartItem
|
|
{
|
|
/// <summary>
|
|
/// Gets the item label.
|
|
/// </summary>
|
|
public string Label { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the item value.
|
|
/// </summary>
|
|
public double Value { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the item color.
|
|
/// </summary>
|
|
public Color Color { get; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="BreakdownChartItem"/> class.
|
|
/// </summary>
|
|
/// <param name="label">The item label.</param>
|
|
/// <param name="value">The item value.</param>
|
|
/// <param name="color">The item color.</param>
|
|
public BreakdownChartItem(string label, double value, Color color)
|
|
{
|
|
Label = label ?? throw new ArgumentNullException(nameof(label));
|
|
Value = value;
|
|
Color = color;
|
|
}
|
|
}
|
|
}
|