diff --git a/src/PlanViewer.App/Controls/WaitStatsProfileControl.axaml.cs b/src/PlanViewer.App/Controls/WaitStatsProfileControl.axaml.cs index 1f5aa26..647b40a 100644 --- a/src/PlanViewer.App/Controls/WaitStatsProfileControl.axaml.cs +++ b/src/PlanViewer.App/Controls/WaitStatsProfileControl.axaml.cs @@ -1,5 +1,4 @@ using System; -using System; using System.Collections.Generic; using System.Linq; using Avalonia; diff --git a/src/PlanViewer.App/Controls/WaitStatsRibbonControl.axaml.cs b/src/PlanViewer.App/Controls/WaitStatsRibbonControl.axaml.cs index 5805bea..123e96e 100644 --- a/src/PlanViewer.App/Controls/WaitStatsRibbonControl.axaml.cs +++ b/src/PlanViewer.App/Controls/WaitStatsRibbonControl.axaml.cs @@ -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); } } @@ -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 {