Documentation ¶
Overview ¶
XYDATA
A data structure for a set of (x,y) data pairs with basic functionality access and manipulate data, as well sort, filter and apply functions to data. Data accessing is done by indexing to data array via Map or "active data index". For example when sorting, the actual data is not sorted but the Map is re-ordered in a way that the data appears sorted.
Index ¶
- type XY
- func (xy *XY) AddXY(x, y float64)
- func (xy *XY) Apply(f func(x, y float64) (float64, float64))
- func (xy *XY) FilterX(f func(x float64) bool)
- func (xy *XY) FilterY(f func(y float64) bool)
- func (xy *XY) FindIndex(x, y float64) int
- func (xy *XY) GetX(i int) (x float64)
- func (xy *XY) GetXY(i int) (x, y float64)
- func (xy *XY) GetY(i int) (y float64)
- func (xy *XY) InsertXY(x, y float64, i int)
- func (xy *XY) Len() int
- func (xy *XY) RemoveXY(i int)
- func (xy *XY) ReplaceXY(x, y float64, i int)
- func (xy *XY) ResetMap()
- func (xy *XY) SortI(ascending bool)
- func (xy *XY) SortX(ascending bool)
- func (xy *XY) SortY(ascending bool)
- func (xy *XY) ViewX() *[]float64
- func (xy *XY) ViewXY() (x *[]float64, y *[]float64)
- func (xy *XY) ViewY() *[]float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XY ¶
type XY struct { Map []int // Maps the active data index to real data index -- used to access desired data in desired order outside XY Error string // Error string -- cleared when any new XY function call is made // contains filtered or unexported fields }
xy data
func (*XY) FindIndex ¶ added in v0.21.0
Finds the index of given X and/or Y value(s). Index is gone through in ascending order and the first match is returned. Use math.NaN() to disable matching. Function returns -1 is not match is found.
func (*XY) RemoveXY ¶
Removes XY pair from given index. Note that this actually removes the data, not just the index to it.
func (*XY) ResetMap ¶ added in v0.21.0
func (xy *XY) ResetMap()
Resets Map to reflect real data index