Skip to content

Commit 107d2d5

Browse files
Fix wait stats cleanup: duplicate using, label overlap, avg label clipping
- Remove duplicate `using System;` in WaitStatsProfileControl - Clamp avg line label position to prevent clipping at top of chart - Skip day boundary labels when too dense to prevent overlap on wide ranges Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fbd47b0 commit 107d2d5

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/PlanViewer.App/Controls/WaitStatsProfileControl.axaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System;
32
using System.Collections.Generic;
43
using System.Linq;
54
using Avalonia;

src/PlanViewer.App/Controls/WaitStatsRibbonControl.axaml.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private void Redraw()
228228
},
229229
};
230230
Canvas.SetLeft(avgLabel, 2);
231-
Canvas.SetTop(avgLabel, avgY - 16);
231+
Canvas.SetTop(avgLabel, Math.Max(0, avgY - 16));
232232
RibbonCanvas.Children.Add(avgLabel);
233233
}
234234
}
@@ -246,8 +246,18 @@ private void Redraw()
246246

247247
if (dayIndices.Count > 0)
248248
{
249-
foreach (var i in dayIndices)
249+
// Skip labels when day boundaries are too dense to avoid overlap
250+
// ~40px per label is a reasonable minimum at fontSize=8
251+
int labelSkip = 1;
252+
if (dayIndices.Count > 1)
250253
{
254+
var avgGapPx = (dayIndices[^1] - dayIndices[0]) * stepX / (dayIndices.Count - 1);
255+
if (avgGapPx < 40) labelSkip = (int)Math.Ceiling(40.0 / avgGapPx);
256+
}
257+
258+
for (int li = 0; li < dayIndices.Count; li += labelSkip)
259+
{
260+
var i = dayIndices[li];
251261
var dt = allHours[i];
252262
var tb = new TextBlock
253263
{

0 commit comments

Comments
 (0)