Skip to content

SignalXY sometimes not rendered on high density data #1803

@bernhardbreuss

Description

@bernhardbreuss

Issue:
SignalXY does sometimes not render on high density data when only partial data should be rendered due to X axis limits.
grafik
When changing the X axis limits just slightly (e.g. by panning) the signal renders fine:
grafik

The interpolation of the PointBefore results in a infinite Y value which eventually results in a overflow exception (which is handled by ScottPlot):

System.OverflowException: Overflow error.
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawLines(Pen pen, PointF[] points)
   at ScottPlot.Plottable.SignalPlotXYGeneric`2.Render(PlotDimensions dims, Bitmap bmp, Boolean lowQuality)
   at ScottPlot.Plot.RenderPlottables(Bitmap bmp, Boolean lowQuality, Double scaleFactor)

Reproducing:

double[] ys = new double[10000];
double[] xs = ys.Select(x => double.PositiveInfinity).ToArray();
double r = 0.0;
for (int i = 0; i < ys.Length; i++)
{
    r += 0.005;
    xs[i] = r;
    ys[i] = Math.Sin(r);
}
var signalXY = WpfPlot.Plot.AddSignalXY(xs, ys);
WpfPlot.Plot.AxisAutoY();
WpfPlot.Plot.XAxis.Dims.SetAxis(min: r - 10.0, r);
WpfPlot.Plot.Validate(deep: true);
WpfPlot.Refresh();

System Details

  • ScottPlot Version: 4.1.41
  • Operating System: Windows 10
  • Application Type: WPF
  • .NET Version: .NET 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions