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

Method Value

plot/plotcore/tablexy.go:150–169  ·  view source on GitHub ↗

Value returns the y value at given row in table

(row int)

Source from the content-addressed store, hash-verified

148
149// Value returns the y value at given row in table
150func (txy *tableXY) Value(row int) float32 {
151 if txy.table == nil || txy.table.Table == nil || row >= txy.table.Len() {
152 return 0
153 }
154 trow := txy.table.Indexes[row] // true table row
155 yc := txy.table.Table.Columns[txy.yColumn]
156 y := float32(0.0)
157 switch {
158 case yc.IsString():
159 y = float32(row)
160 case yc.NumDims() > 1:
161 _, sz := yc.RowCellSize()
162 if txy.yIndex < sz && txy.yIndex >= 0 {
163 y = float32(yc.FloatRowCell(trow, txy.yIndex))
164 }
165 default:
166 y = float32(yc.Float1D(trow))
167 }
168 return y
169}
170
171// tRowXValue returns an x value at given actual row in table
172func (txy *tableXY) tRowXValue(row int) float32 {

Callers 2

XYMethod · 0.95
genPlotBarMethod · 0.95

Calls 6

LenMethod · 0.65
IsStringMethod · 0.65
NumDimsMethod · 0.65
RowCellSizeMethod · 0.65
FloatRowCellMethod · 0.65
Float1DMethod · 0.65

Tested by

no test coverage detected