@@ -62,6 +62,10 @@ type DetailPanel struct {
6262 onPodSelected NodeSelectedCallback
6363 onBack func ()
6464 onFooterContextChange func (focusedPanel string )
65+
66+ // Adaptive scaling for Net/Disk sparklines
67+ peakNetRate float64
68+ peakDiskRate float64
6569}
6670
6771// NewDetailPanel creates a new node detail panel
@@ -256,6 +260,8 @@ func (p *DetailPanel) DrawBody(data interface{}) {
256260 }
257261 if newNodeName != p .currentNodeName {
258262 p .resetSparklines ()
263+ p .peakNetRate = 0 // Reset adaptive scaling peaks
264+ p .peakDiskRate = 0
259265 p .currentNodeName = newNodeName
260266
261267 // Populate sparklines from history if available
@@ -394,8 +400,45 @@ func (p *DetailPanel) drawSparklines() {
394400
395401 // Update network/disk sparklines in prometheus mode
396402 if prometheusMode {
397- p .sparklineRow .UpdateNET (0.01 , " NET [gray]↓n/a ↑n/a[-] " )
398- p .sparklineRow .UpdateDisk (0.01 , " DISK [gray]R:n/a W:n/a[-] " )
403+ // Network sparkline with adaptive scaling
404+ netTitle := fmt .Sprintf (" Net ↓%s ↑%s " ,
405+ ui .FormatBytesRate (p .data .NetworkRxRate ),
406+ ui .FormatBytesRate (p .data .NetworkTxRate ))
407+ combinedNetRate := p .data .NetworkRxRate + p .data .NetworkTxRate
408+
409+ // Adaptive scaling: track peak, use minimum 512 KB/s baseline
410+ if combinedNetRate > p .peakNetRate {
411+ p .peakNetRate = combinedNetRate
412+ }
413+ effectiveNetMax := p .peakNetRate
414+ if effectiveNetMax < 512 * 1024 {
415+ effectiveNetMax = 512 * 1024
416+ }
417+ netNormalized := combinedNetRate / effectiveNetMax
418+ if netNormalized > 1 {
419+ netNormalized = 1
420+ }
421+ p .sparklineRow .UpdateNET (netNormalized , netTitle )
422+
423+ // Disk sparkline with adaptive scaling
424+ diskTitle := fmt .Sprintf (" Disk R:%s W:%s " ,
425+ ui .FormatBytesRate (p .data .DiskReadRate ),
426+ ui .FormatBytesRate (p .data .DiskWriteRate ))
427+ combinedDiskRate := p .data .DiskReadRate + p .data .DiskWriteRate
428+
429+ // Adaptive scaling: track peak, use minimum 512 KB/s baseline
430+ if combinedDiskRate > p .peakDiskRate {
431+ p .peakDiskRate = combinedDiskRate
432+ }
433+ effectiveDiskMax := p .peakDiskRate
434+ if effectiveDiskMax < 512 * 1024 {
435+ effectiveDiskMax = 512 * 1024
436+ }
437+ diskNormalized := combinedDiskRate / effectiveDiskMax
438+ if diskNormalized > 1 {
439+ diskNormalized = 1
440+ }
441+ p .sparklineRow .UpdateDisk (diskNormalized , diskTitle )
399442 }
400443}
401444
0 commit comments