mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	* Fixes a bug with `SelectionPrompt` and page size. * Allow `IAnsiConsoleInput` to return `null`.
		
			
				
	
	
		
			20 lines
		
	
	
		
			610 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			610 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using Spectre.Console;
 | 
						|
 | 
						|
namespace Generator.Commands.Samples
 | 
						|
{
 | 
						|
    internal class BarChartSample : BaseSample
 | 
						|
    {
 | 
						|
        public override (int Cols, int Rows) ConsoleSize => (base.ConsoleSize.Cols, 5);
 | 
						|
 | 
						|
        public override void Run(IAnsiConsole console)
 | 
						|
        {
 | 
						|
            console.Write(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));
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |