Skip to content

Commit

Permalink
fix - Fixed showcase out of bounds
Browse files Browse the repository at this point in the history
---

Showcase in some charts goes out of bounds in certain conditions, so we've
decided to fix it.

---

Type: fix
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Jan 13, 2025
1 parent 57a11eb commit bdb26c8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion private/Terminaux.Console/Fixtures/FixtureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ internal static class FixtureManager
new TestSyntaxText(),
new TestLineChart(),
new TestWinsLosses(),
new TestAreaChart(),

// Input
new TestInputSelection(),
Expand Down
2 changes: 1 addition & 1 deletion public/Terminaux/Writer/CyclicWriters/BreakdownChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal static string RenderBreakdownChart(ChartElement[] elements, int Interio
if (showcase && i < shownElements.Length)
{
var element = shownElements[i];
int nameWidth = ConsoleChar.EstimateCellWidth(element.Name);
int nameWidth = ConsoleChar.EstimateCellWidth(element.Name.Truncate(nameLength - 4 - $"{maxValue}".Length));
int spaces = showcaseLength - (" ■ ".Length + nameWidth + 2 + $"{element.Value}".Length);
spaces = spaces < 0 ? 0 : spaces;
breakdownChart.Append(
Expand Down
2 changes: 1 addition & 1 deletion public/Terminaux/Writer/CyclicWriters/LineChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ internal static string RenderLineChart(ChartElement[] elements, int InteriorWidt
if (showcase && i < shownElements.Length)
{
var element = shownElements[i];
int nameWidth = ConsoleChar.EstimateCellWidth(element.Name);
int nameWidth = ConsoleChar.EstimateCellWidth(element.Name.Truncate(nameLength - 4 - $"{maxValue}".Length));
int spaces = showcaseLength - (" ■ ".Length + nameWidth + 2 + $"{element.Value}".Length);
spaces = spaces < 0 ? 0 : spaces;
lineChart.Append(
Expand Down
2 changes: 1 addition & 1 deletion public/Terminaux/Writer/CyclicWriters/StickChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ internal static string RenderStickChart(ChartElement[] elements, int InteriorWid
if (showcase && i < shownElements.Length)
{
var element = shownElements[i];
int nameWidth = ConsoleChar.EstimateCellWidth(element.Name);
int nameWidth = ConsoleChar.EstimateCellWidth(element.Name.Truncate(nameLength - 4 - $"{maxValue}".Length));
int spaces = showcaseLength - (" ■ ".Length + nameWidth + 2 + $"{element.Value}".Length);
spaces = spaces < 0 ? 0 : spaces;
stickChart.Append(
Expand Down

0 comments on commit bdb26c8

Please sign in to comment.