fix stats formatting again on export option
This commit is contained in:
Binary file not shown.
@@ -99,32 +99,27 @@ public static class StatsPanel
|
||||
/// </summary>
|
||||
private static IRenderable BuildBarRow(string label, double pct, int barWidth)
|
||||
{
|
||||
var filled = (int)Math.Round(pct / 100.0 * barWidth);
|
||||
filled = Math.Clamp(filled, 0, barWidth);
|
||||
var empty = barWidth - filled;
|
||||
var filled = (int)Math.Round(pct / 100.0 * barWidth);
|
||||
filled = Math.Clamp(filled, 0, barWidth);
|
||||
var empty = barWidth - filled;
|
||||
|
||||
var filledColor = CpuColor(pct);
|
||||
var filledStr = new string('\u2588', filled);
|
||||
var emptyStr = new string('\u2591', empty);
|
||||
var filledColor = CpuColor(pct);
|
||||
var filledStr = new string('\u2588', filled);
|
||||
var emptyStr = new string('\u2591', empty);
|
||||
|
||||
var row = new Grid();
|
||||
row.AddColumn(new GridColumn().NoWrap().Width(9)); // label
|
||||
row.AddColumn(new GridColumn().NoWrap()); // bar chars
|
||||
row.AddColumn(new GridColumn().NoWrap().Width(7)); // pct
|
||||
var row = new Grid();
|
||||
var colorMarkup = filledColor.ToMarkup();
|
||||
|
||||
row.AddRow(
|
||||
new Text($" {label,-5}", new Style(Color.Grey, decoration: Decoration.Dim)),
|
||||
// Bar: colored filled + dim empty, wrapped in plain Text objects side by side
|
||||
new Columns(
|
||||
new Text("[", new Style(Color.Grey)),
|
||||
new Text(filledStr, new Style(filledColor)),
|
||||
new Text(emptyStr, new Style(Color.Grey, decoration: Decoration.Dim)),
|
||||
new Text("]", new Style(Color.Grey))
|
||||
),
|
||||
new Text($" {pct,5:F1}%", new Style(Color.White, decoration: Decoration.Bold))
|
||||
);
|
||||
// Construct a seamless markup string
|
||||
var barMarkup = $"[grey][[[/][{colorMarkup}]{filledStr}[/][grey dim]{emptyStr}[/][grey]]][/]";
|
||||
|
||||
return row;
|
||||
row.AddRow(
|
||||
new Text($" {label,-5}", new Style(Color.Grey, decoration: Decoration.Dim)),
|
||||
new Markup(barMarkup), // Replace Columns with a single Markup object
|
||||
new Text($" {pct,5:F1}%", new Style(Color.White, decoration: Decoration.Bold))
|
||||
);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
private static Color CpuColor(double pct) => pct switch
|
||||
|
||||
Reference in New Issue
Block a user