@@ -536,8 +536,8 @@ Include the latest event timestamp so acknowledgement is only
536536 DateTime ? latestEventTime = null ;
537537 if ( blockingCount > 0 || deadlockCount > 0 )
538538 {
539- var latestBlocking = blockedProcessTask . Result . Max ( r => ( DateTime ? ) r . CollectionTime ) ;
540- var latestDeadlock = deadlockTask . Result . Max ( r => ( DateTime ? ) r . CollectionTime ) ;
539+ var latestBlocking = blockedProcessTask . Result . Max ( r => ( DateTime ? ) r . EventTime ) ;
540+ var latestDeadlock = deadlockTask . Result . Max ( r => ( DateTime ? ) r . DeadlockTime ) ;
541541 latestEventTime = latestBlocking > latestDeadlock ? latestBlocking : latestDeadlock ;
542542 }
543543 AlertCountsChanged ? . Invoke ( blockingCount , deadlockCount , latestEventTime ) ;
@@ -849,12 +849,19 @@ private void UpdateBlockingTrendChart(List<TrendPoint> data, int hoursBack, Date
849849
850850 if ( data . Count == 0 )
851851 {
852- /* Show empty chart with correct time range */
852+ /* No blocking events — show a flat line at zero so the chart looks active */
853+ var zeroLine = BlockingTrendChart . Plot . Add . Scatter (
854+ new [ ] { rangeStart . ToOADate ( ) , rangeEnd . ToOADate ( ) } ,
855+ new [ ] { 0.0 , 0.0 } ) ;
856+ zeroLine . LegendText = "Blocking Incidents" ;
857+ zeroLine . Color = ScottPlot . Color . FromHex ( "#E57373" ) ;
858+ zeroLine . MarkerSize = 0 ;
853859 BlockingTrendChart . Plot . Axes . DateTimeTicksBottom ( ) ;
854860 BlockingTrendChart . Plot . Axes . SetLimitsX ( rangeStart . ToOADate ( ) , rangeEnd . ToOADate ( ) ) ;
855- BlockingTrendChart . Plot . Axes . SetLimitsY ( 0 , 1 ) ;
856861 ReapplyAxisColors ( BlockingTrendChart ) ;
857862 BlockingTrendChart . Plot . YLabel ( "Blocking Incidents" ) ;
863+ SetChartYLimitsWithLegendPadding ( BlockingTrendChart , 0 , 1 ) ;
864+ ShowChartLegend ( BlockingTrendChart ) ;
858865 BlockingTrendChart . Refresh ( ) ;
859866 return ;
860867 }
@@ -919,12 +926,19 @@ private void UpdateDeadlockTrendChart(List<TrendPoint> data, int hoursBack, Date
919926
920927 if ( data . Count == 0 )
921928 {
922- /* Show empty chart with correct time range */
929+ /* No deadlocks — show a flat line at zero so the chart looks active */
930+ var zeroLine = DeadlockTrendChart . Plot . Add . Scatter (
931+ new [ ] { rangeStart . ToOADate ( ) , rangeEnd . ToOADate ( ) } ,
932+ new [ ] { 0.0 , 0.0 } ) ;
933+ zeroLine . LegendText = "Deadlocks" ;
934+ zeroLine . Color = ScottPlot . Color . FromHex ( "#FFB74D" ) ;
935+ zeroLine . MarkerSize = 0 ;
923936 DeadlockTrendChart . Plot . Axes . DateTimeTicksBottom ( ) ;
924937 DeadlockTrendChart . Plot . Axes . SetLimitsX ( rangeStart . ToOADate ( ) , rangeEnd . ToOADate ( ) ) ;
925- DeadlockTrendChart . Plot . Axes . SetLimitsY ( 0 , 1 ) ;
926938 ReapplyAxisColors ( DeadlockTrendChart ) ;
927939 DeadlockTrendChart . Plot . YLabel ( "Deadlocks" ) ;
940+ SetChartYLimitsWithLegendPadding ( DeadlockTrendChart , 0 , 1 ) ;
941+ ShowChartLegend ( DeadlockTrendChart ) ;
928942 DeadlockTrendChart . Refresh ( ) ;
929943 return ;
930944 }
@@ -1495,13 +1509,13 @@ private static void SetChartYLimitsWithLegendPadding(ScottPlot.WPF.WpfPlot chart
14951509 dataYMin = limits . Bottom ;
14961510 dataYMax = limits . Top ;
14971511 }
1498- if ( dataYMax <= dataYMin ) dataYMax = dataYMin + 100 ;
1512+ if ( dataYMax <= dataYMin ) dataYMax = dataYMin + 1 ;
14991513
15001514 double range = dataYMax - dataYMin ;
15011515 double topPadding = range * 0.05 ;
15021516
1503- /* Only add bottom padding if dataYMin is above zero - don't go negative */
1504- double yMin = dataYMin >= 0 ? 0 : dataYMin - ( range * 0.10 ) ;
1517+ /* Add small bottom margin when dataYMin is zero so flat lines at Y=0 are visible above the axis */
1518+ double yMin = dataYMin > 0 ? 0 : dataYMin == 0 ? - ( range * 0.05 ) : dataYMin - ( range * 0.10 ) ;
15051519 double yMax = dataYMax + topPadding ;
15061520
15071521 chart . Plot . Axes . SetLimitsY ( yMin , yMax ) ;
0 commit comments