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
MaxRenderIndex
public int MaxRenderIndex { get; set; }
Property Value
MinRenderIndex
public int MinRenderIndex { get; set; }
Property Value
PreferCoordinates
When set true, DataSourceUtilities should prefer paths that utilize GetCoordinates
public bool PreferCoordinates { get; }
Property Value
XOffset
public double XOffset { get; set; }
Property Value
XScale
public double XScale { get; set; }
Property Value
YOffset
public double YOffset { get; set; }
Property Value
YScale
public double YScale { get; set; }
Property Value
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
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
GetX(int)
Gets the X value from the data source at the specified index
public double GetX(int index)
Parameters
index
int
Returns
GetXClosestIndex(Coordinates)
Gets the closest index to a specified coordinate for the array of X's
public int GetXClosestIndex(Coordinates mouseLocation)
Parameters
mouseLocation
Coordinatestypically the X coordinate should be used, unless the plot is rotated (then use Y)
Returns
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
GetY(int)
Gets the Y value from the data source at the specified index
public double GetY(int index)
Parameters
index
int
Returns
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
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()