Skip to content

PlotSignal maxRenderIndex drawing issue in last unit #744

@at2software

Description

@at2software

There seems to be a drawing issue that happens with a PlotSignal using maxRenderIndex. On our end it can be reproduced when the there is less than one unit of space available on the right side. Example: 50 samples, maxRenderIndex set to 35. Now, if there is space on the X axis up to 36 or more, everything is fine; however if the last fitting value on the X axis is 35 itself, suddenly one additional sample is drawn on the graph. Showing a video probably explains it better:

maxrenderindex

The following code was used for above screen cap:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
	double[] data = new double[100];

	Random rand = new Random(0);
	for (int i = 1; i <= 50; i++)
		data[i] = data[i - 1] + rand.NextDouble() - .5;

	plot.plt.PlotSignal(data, maxRenderIndex: 35);
	plot.Render();
}

The issue can also be observed in the "growing data" example of the current demo, both WinForms and WPF. Here, on the first few samples, there is one additional sample drawn as well, which is a 0 value:

demo

I think in the growing data demo, the issue only occurs in the first few samples as at some point, the horizontal margin is larger than one X unit.

Tested in versions 4.0.48 and 4.1.5-beta.

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