Skip to content

CoordinateRange: improve NaN support#4770

Merged
swharden merged 3 commits intoScottPlot:mainfrom
bwedding:main
Feb 15, 2025
Merged

CoordinateRange: improve NaN support#4770
swharden merged 3 commits intoScottPlot:mainfrom
bwedding:main

Conversation

@bwedding
Copy link
Contributor

@bwedding bwedding commented Feb 5, 2025

Fix for issue here:
#4665

Simple fix. I also added 5 unit test cases to test for it.

    public static CoordinateRange Extrema(IEnumerable<double> values)
    {
        var nonNanValues = values.Where(i => !double.IsNaN(i)).ToList();
        return nonNanValues.Any()
            ? new CoordinateRange(nonNanValues.Min(), nonNanValues.Max())
            : NoLimits;
    }

EMS90 added a commit to dd-bim/TRA.Lib that referenced this pull request Feb 7, 2025
-Workarround for ScottPlot chrashes on NaNs ScottPlot/ScottPlot#4770
- Important signum issues for curvature and heading
Copy link
Member

@bclehmann bclehmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for adding tests

@swharden swharden changed the title Fixes issue 4665 CoordinateRange: improve NaN support Feb 14, 2025
@swharden swharden linked an issue Feb 15, 2025 that may be closed by this pull request
@swharden swharden enabled auto-merge (squash) February 15, 2025 13:55
@swharden swharden merged commit 71d8c06 into ScottPlot:main Feb 15, 2025
1 of 3 checks passed
@swharden

This comment was marked as off-topic.

@swharden

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CoordinateRange: error when all values are NaN

3 participants