Table of Contents

Class CoordinateDataSource

Namespace
ScottPlot.DataSources
Assembly
ScottPlot.dll

Helper class used when a source (such as IScatterSource) does not implement IDataSource

public class CoordinateDataSource : IDataSource
Inheritance
CoordinateDataSource
Implements
Inherited Members
Extension Methods

Constructors

CoordinateDataSource(IReadOnlyList<Coordinates>)

Helper class used when a source (such as IScatterSource) does not implement IDataSource

public CoordinateDataSource(IReadOnlyList<Coordinates> readOnlyList)

Parameters

readOnlyList IReadOnlyList<Coordinates>

Properties

Length

The length of the collection

public int Length { get; }

Property Value

int

MaxRenderIndex

public int MaxRenderIndex { get; set; }

Property Value

int

MinRenderIndex

public int MinRenderIndex { get; set; }

Property Value

int

PreferCoordinates

When set true, DataSourceUtilities should prefer paths that utilize GetCoordinates

public bool PreferCoordinates { get; }

Property Value

bool

XOffset

public double XOffset { get; set; }

Property Value

double

XScale

public double XScale { get; set; }

Property Value

double

YOffset

public double YOffset { get; set; }

Property Value

double

YScale

public double YScale { get; set; }

Property Value

double

Methods

GetCoordinate(int)

Gets the X-Y coordinate from the data source at the specified index

public Coordinates GetCoordinate(int index)

Parameters

index int

Returns

Coordinates

GetCoordinateScaled(int)

Gets the X-Y coordinate from the data source at the specified index with any offsets and scaling applied

public Coordinates GetCoordinateScaled(int index)

Parameters

index int

Returns

Coordinates

GetX(int)

Gets the X value from the data source at the specified index

public double GetX(int index)

Parameters

index int

Returns

double

GetXClosestIndex(Coordinates)

Gets the closest index to a specified coordinate for the array of X's

public int GetXClosestIndex(Coordinates mouseLocation)

Parameters

mouseLocation Coordinates

typically the X coordinate should be used, unless the plot is rotated (then use Y)

Returns

int

Remarks

Fastest execution should be using a BinarySearch, such as GetClosestIndex(double[], double, IndexRange)

GetXScaled(int)

Gets the X value from the data source at the specified index with any offsets and scaling applied

public double GetXScaled(int index)

Parameters

index int

Returns

double

GetY(int)

Gets the Y value from the data source at the specified index

public double GetY(int index)

Parameters

index int

Returns

double

GetYScaled(int)

Gets the Y value from the data source at the specified index with any offsets and scaling applied

public double GetYScaled(int index)

Parameters

index int

Returns

double

IsSorted()

When the collection is sorted, this will enable much quicker execution by allowing usage of BinarySearch methods ( GetNearest should call GetXClosestIndex when this is true )

public bool IsSorted()

Returns

bool