plot window refactor

This commit is contained in:
2026-06-01 18:45:00 -05:00
parent 667cb4117f
commit 54a88e1f31
7 changed files with 899 additions and 77 deletions
@@ -76,7 +76,11 @@ public static class SensorFormatter
public static double? GetPlotValue(ISensor sensor, TemperatureUnit temperatureUnit)
{
float? value = sensor.Value;
return GetPlotValue(sensor, sensor.Value, temperatureUnit);
}
public static double? GetPlotValue(ISensor sensor, float? value, TemperatureUnit temperatureUnit)
{
if (!value.HasValue)
return null;
@@ -86,6 +90,36 @@ public static class SensorFormatter
return value.Value;
}
public static string GetPlotUnit(SensorType sensorType, TemperatureUnit temperatureUnit)
{
return sensorType switch
{
SensorType.Voltage => "V",
SensorType.Current => "A",
SensorType.Clock => "MHz",
SensorType.Load => "%",
SensorType.Temperature when temperatureUnit == TemperatureUnit.Fahrenheit => "\u00B0F",
SensorType.Temperature => "\u00B0C",
SensorType.Fan => "RPM",
SensorType.Flow => "L/h",
SensorType.Control => "%",
SensorType.Level => "%",
SensorType.Power => "W",
SensorType.Data => "GB",
SensorType.SmallData => "MB",
SensorType.Factor => "1",
SensorType.Frequency => "Hz",
SensorType.Throughput => "B/s",
SensorType.TimeSpan => "s",
SensorType.Timing => "ns",
SensorType.Energy => "mWh",
SensorType.Noise => "dBA",
SensorType.Conductivity => "\u00B5S/cm",
SensorType.Humidity => "%",
_ => ""
};
}
public static string GetToolTip(ISensor sensor, TemperatureUnit temperatureUnit)
{
StringBuilder builder = new();