Skip to content

Signal Update LastIndex wrong value #2578

@Angeld10

Description

@Angeld10

Bug Report

Issue: Updating a signal of the same size causes the exception: 'lastIndex cannot exceed the dimensions of the existing Ys array'. I believe the Update method with 1 parameter is passing newData.Length as the lastIndex parameter to the Update method with 4 parameters. The latter method is comparing lastIndex to oldData.Length - 1 which will never match if both arrays are the same size.

Reproducing: Generate signal of any size. AddSignal to a plot, Update using same signal.

double[] y = ScottPlot.DataGen.Sin(100, 2, 0, 1, 0);
var scatterPlot = plotWindow.Edit.Plot.AddSignal(y);
scatterPlot.Update(y);

updateException

System Details

  • ScottPlot.WPF Version: 4.1.62
  • Operating System: Windows 11
  • Application Type: WPF
  • .NET Version: NET Framework 4.8

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