From 8ef190baaded9132558bf778150157a92b0f2aa4 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Wed, 15 Jan 2025 10:40:57 +0100 Subject: [PATCH] Fixes incorrect float formatting in metricsquery. --- ProjectPlugins/MetricsPlugin/MetricsQuery.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ProjectPlugins/MetricsPlugin/MetricsQuery.cs b/ProjectPlugins/MetricsPlugin/MetricsQuery.cs index cf9ff28..9b110b7 100644 --- a/ProjectPlugins/MetricsPlugin/MetricsQuery.cs +++ b/ProjectPlugins/MetricsPlugin/MetricsQuery.cs @@ -123,7 +123,7 @@ namespace MetricsPlugin { if (values != null && values.Length > 0) { - return values.Select(v => MapValue(v)).ToArray(); + return values.Select(MapValue).ToArray(); } return Array.Empty(); } @@ -156,7 +156,14 @@ namespace MetricsPlugin private double ToValue(object v) { - return Convert.ToDouble(v, CultureInfo.InvariantCulture); + try + { + return Convert.ToDouble(v, CultureInfo.InvariantCulture); + } + catch + { + return double.NaN; + } } private DateTime ToTimestamp(object v) @@ -215,7 +222,7 @@ namespace MetricsPlugin { var value = set.Values.SingleOrDefault(v => v.Timestamp == ts); if (value == null) e.Add(" "); - else e.Add(value.Value.ToString()); + else e.Add(value.Value.ToString(CultureInfo.InvariantCulture)); } }); }