From 9c6fd8d1f42f8a8501b9e3c2cdf5002f5ec317a1 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Thu, 2 Nov 2023 11:58:43 +0800 Subject: [PATCH] Fix metrics chart when there is a NaN value (#645) --- .../Components/Controls/PlotlyChart.razor.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Aspire.Dashboard/Components/Controls/PlotlyChart.razor.cs b/src/Aspire.Dashboard/Components/Controls/PlotlyChart.razor.cs index 33d5a12e2d1..e2b40538ceb 100644 --- a/src/Aspire.Dashboard/Components/Controls/PlotlyChart.razor.cs +++ b/src/Aspire.Dashboard/Components/Controls/PlotlyChart.razor.cs @@ -373,6 +373,13 @@ private static bool TryCalculatePoint(List dimensions, DateTime pointValue += dimensionValue; } + // JS interop doesn't support serializing NaN values. + if (double.IsNaN(pointValue)) + { + pointValue = default; + return false; + } + return hasValue; }