Skip to content

Signal: GetPointNearestX() #2019

@swharden

Description

@swharden

Current behavior described by @dhgigisoave in #1987 sounds like a "floor" effect

/// <summary>
/// Return the index for the data point corresponding to the given X coordinate
/// </summary>
private int GetIndexForX(double x)
{
int index = (int)((x - OffsetX) / SampleRate);
index = Math.Max(index, MinRenderIndex);
index = Math.Min(index, MaxRenderIndex);
return index;
}

I think the solution here is to add one half of the sample period to the given x before finding its index...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions