Skip to content

CoordinateRange: error when all values are NaN #4665

@uperp

Description

@uperp

Issue: (Describe the bug here)
When all Y data is double.NaN, Error getting min value

public readonly struct CoordinateRange(double value1, double value2)
{
   ......
 public static CoordinateRange Extrema(IEnumerable<double> values)
 {
         if (!values.Any())
             return CoordinateRange.NoLimits;

         var nonNanValues = values.Where(i => !double.IsNaN(i));    //When all Y data is double.NaN
         double min = nonNanValues.Min();       //<<<<<<----------------error
         double max = nonNanValues.Max();
         return new(min, max);
  }

ScottPlot Version: (What NuGet package are you using?)
5.0.48

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions