Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
Expand Down
14 changes: 12 additions & 2 deletions src/PlanViewer.App/Controls/WaitStatsRibbonControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void Redraw()
},
};
Canvas.SetLeft(avgLabel, 2);
Canvas.SetTop(avgLabel, avgY - 16);
Canvas.SetTop(avgLabel, Math.Max(0, avgY - 16));
RibbonCanvas.Children.Add(avgLabel);
}
}
Expand All @@ -246,8 +246,18 @@ private void Redraw()

if (dayIndices.Count > 0)
{
foreach (var i in dayIndices)
// Skip labels when day boundaries are too dense to avoid overlap
// ~40px per label is a reasonable minimum at fontSize=8
int labelSkip = 1;
if (dayIndices.Count > 1)
{
var avgGapPx = (dayIndices[^1] - dayIndices[0]) * stepX / (dayIndices.Count - 1);
if (avgGapPx < 40) labelSkip = (int)Math.Ceiling(40.0 / avgGapPx);
}

for (int li = 0; li < dayIndices.Count; li += labelSkip)
{
var i = dayIndices[li];
var dt = allHours[i];
var tb = new TextBlock
{
Expand Down
Loading