Add support for bar charts

Closes #103
This commit is contained in:
Patrik Svensson
2020-12-22 22:26:17 +01:00
committed by Patrik Svensson
parent 1cf30f62fc
commit 7dccb310f3
21 changed files with 597 additions and 8 deletions

View File

@ -0,0 +1,4 @@
Number of fruits
Apple ████████ 12
Orange █████████████████████████████████████████████████ 54
Banana ████████████████████████████ 33

View File

@ -0,0 +1,28 @@
using System.Threading.Tasks;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
public sealed class BarChartTests
{
[Fact]
public async Task Should_Render_Correctly()
{
// Given
var console = new PlainConsole(width: 80);
// When
console.Render(new BarChart()
.Width(60)
.Label("Number of fruits")
.AddItem("Apple", 12)
.AddItem("Orange", 54)
.AddItem("Banana", 33));
// Then
await Verifier.Verify(console.Output);
}
}
}