Skip to content

ScottPlot5 Feature Request - Signal X/YOffset like ScottPlot4 #2378

@minjjKang

Description

@minjjKang

Feature Suggestion

Feature description: Make X/Y Offset feature like ScottPlot4

Code example:

\ScottPlot5\Plottables\Signal.cs
for use XOffset, current ISignalSource's XOffset have only getter

public class Signal : IPlottable
{
...
    public readonly DataSources.SignalSource Data;
    // from ISignalSource to SignalSource
...
    public Signal(DataSources.SignalSource data)
    // same
    {
        Data = data;
    }
    ...

\ScottPlot5\DataSources\SignalSource.cs
for

public class SignalSource : ISignalSource
{
    ...
    public double YOffset { get; set; }
    // make YOffset variable like XOffset(existing)
    ...
    public CoordinateRange GetYRange(CoordinateRange xRange)
    {
        int i1 = GetIndex(xRange.Min, true);
        int i2 = GetIndex(xRange.Max, true);

        CoordinateRange yRange = new(Ys[i1] + YOffset, Ys[i1] + YOffset);

        for (int i = i1; i <= i2; i++)
        {
            yRange.Expand(Ys[i] + YOffset);
        }

        return yRange;
    }
    // YOffset for render
    ...

Thanks!!

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