-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Issue: DataLogger cannot render itself if it has no points and axis ticks are set to DateTime. This crashes WPF application on startup with this exception:
System.ArgumentException: TimeSpan does not accept floating point Not-a-Number values.
at System.TimeSpan.FromDays(Double value)
at ScottPlot.TickGenerators.DateTimeAutomatic.Regenerate(CoordinateRange range, Edge edge, PixelLength size)
at ScottPlot.LayoutEngines.Automatic.<>c__DisplayClass0_0.<GetLayout>b__0(IXAxis xAxis)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at ScottPlot.LayoutEngines.Automatic.GetLayout(PixelRect figureRect, IEnumerable`1 panels)
at ScottPlot.RenderPack.CalculateLayout()
at ScottPlot.Rendering.RenderActions.CalculateLayout.Render(RenderPack rp)
at ScottPlot.Rendering.RenderManager.Render(SKCanvas canvas, PixelRect rect)
at ScottPlot.Plot.Render(SKCanvas canvas, PixelRect rect)
at ScottPlot.WPF.WpfPlot.<OnApplyTemplate>b__5_0(Object sender, SKPaintSurfaceEventArgs e)
at SkiaSharp.Views.WPF.SKElement.OnPaintSurface(SKPaintSurfaceEventArgs e)
at SkiaSharp.Views.WPF.SKElement.OnRender(DrawingContext drawingContext)
at System.Windows.UIElement.Arrange(Rect finalRect)
(...)
ScottPlot Version: SP5-WPF, 5.0.17
Code Sample: Just create an empty WPF app from template. Rename main Grid to "ZeGrid", and here's the code-behind for the MainWindow.xaml:
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var wpfPlot = new WpfPlot();
wpfPlot.Plot.Add.DataLogger();
wpfPlot.Plot.Axes.DateTimeTicks(Edge.Bottom); // This line causes the exception.
ZeGrid.Children.Add(wpfPlot);
}
}If at least one point is added before rendering, then everything is fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels