PlottableScatter.GetLimits() throws System.InvalidOperationException: Sequence contains no elements
See original GitHub issueDescribe the bug Provide a clear and concise description of what the bug is
Unhandled exception. System.InvalidOperationException: Sequence contains no elements at System.Linq.ThrowHelper.ThrowNoElementsException() at System.Linq.Enumerable.Min(IEnumerable`1 source) at ScottPlot.PlottableScatter.GetLimits() at ScottPlot.Settings.AxisAuto(Double horizontalMargin, Double verticalMargin, Boolean xExpandOnly, Boolean yExpandOnly, Boolean autoX, Boolean autoY) at ScottPlot.Plot.RenderBitmap() at ScottPlot.Plot.GetBitmap(Boolean renderFirst, Boolean lowQuality) at ScottPlot.WpfPlot.Render(Boolean skipIfCurrentlyRendering, Boolean lowQuality, Boolean recalculateLayout)
To Reproduce Describe what we can do to reproduce the behavior
// include code to help us reproduce this bug
Screenshots If applicable, add screenshots to help explain your problem
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (10 by maintainers)
Top GitHub Comments
Thanks.
I think this happens when AutoSize / fit is specified, and the user zooms out or moves the render field outside of any visible data points, making Render try to render a
null
enumerable (no data points in view). Usually happens when I try to maximize or scroll/move and a .refresh call is being called at an unfortunate time.I’m using beta v 5.0.6
Edit:
It was due to trusting the Destructor be called when being done with a plot (cleared data beforehand though, thinking it would call the destructor, it didn’t). Implemented the Disposable interface and now all works fine.