mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00

committed by
Patrik Svensson

parent
1cf30f62fc
commit
7dccb310f3
15
examples/Charts/Charts.csproj
Normal file
15
examples/Charts/Charts.csproj
Normal file
@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Charts</Title>
|
||||
<Description>Demonstrates how to render charts in a console.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
21
examples/Charts/Program.cs
Normal file
21
examples/Charts/Program.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Spectre.Console;
|
||||
|
||||
namespace InfoExample
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
var chart = new BarChart()
|
||||
.Width(60)
|
||||
.Label("[green bold underline]Number of fruits[/]")
|
||||
.CenterLabel()
|
||||
.AddItem("Apple", 12, Color.Yellow)
|
||||
.AddItem("Orange", 54, Color.Green)
|
||||
.AddItem("Banana", 33, Color.Red);
|
||||
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(chart);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user