-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
I discovered that an exception will be thrown if using PlotScatter with just a single point, when the line width is greater than 0. I'm using version 3.1.3 in .NET 4.7.1.
Here is the stacktrace:
System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawLines(Pen pen, PointF[] points)
at ScottPlot.PlottableScatter.Render(Settings settings)
at ScottPlot.Renderer.DataPlottables(Settings settings)
at ScottPlot.Plot.RenderBitmap()
at ScottPlot.Plot.SaveFig(String filePath, Boolean renderFirst)
This code will reproduce the exception:
var chart = new Plot();
chart.PlotScatter(new [] {1d}, new [] {1d}, lineWidth: 1);
chart.SaveFig("Chart.png");
Perhaps this condition added to PlottableScatter.cs#205 would fix the issue:
if (penLine.Width > 0 && points.Length > 1)
{
if (stepDisplay)
settings.gfxData.DrawLines(penLine, pointsStep);
else
settings.gfxData.DrawLines(penLine, points);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels