MCPcopy Create free account
hub / github.com/cogentcore/core / newTableXYName

Function newTableXYName

plot/plotcore/tablexy.go:63–71  ·  view source on GitHub ↗

newTableXYName returns a new XY plot view onto the given IndexView of table.Table (makes a copy), from given column name and tensor indexes within each cell. Column indexes are enforced to be valid, with an error message if they are not.

(dt *table.IndexView, xi, xtsrIndex int, ycol string, ytsrIndex int, yrng minmax.Range32)

Source from the content-addressed store, hash-verified

61// from given column name and tensor indexes within each cell.
62// Column indexes are enforced to be valid, with an error message if they are not.
63func newTableXYName(dt *table.IndexView, xi, xtsrIndex int, ycol string, ytsrIndex int, yrng minmax.Range32) (*tableXY, error) {
64 yi, err := dt.Table.ColumnIndexTry(ycol)
65 if err != nil {
66 log.Println(err)
67 return nil, err
68 }
69 txy := &tableXY{table: dt.Clone(), xColumn: xi, yColumn: yi, xIndex: xtsrIndex, yIndex: ytsrIndex, yRange: yrng}
70 return txy, txy.validate()
71}
72
73// validate returns error message if column indexes are invalid, else nil
74// it also sets column indexes to 0 so nothing crashes.

Callers 2

genPlotXYMethod · 0.85
genPlotBarMethod · 0.85

Calls 4

validateMethod · 0.95
ColumnIndexTryMethod · 0.80
PrintlnMethod · 0.80
CloneMethod · 0.65

Tested by

no test coverage detected