xValue returns an x value at given row in table
(row int)
| 191 | |
| 192 | // xValue returns an x value at given row in table |
| 193 | func (txy *tableXY) xValue(row int) float32 { |
| 194 | if txy.table == nil || txy.table.Table == nil || row >= txy.table.Len() { |
| 195 | return 0 |
| 196 | } |
| 197 | trow := txy.table.Indexes[row] // true table row |
| 198 | xc := txy.table.Table.Columns[txy.xColumn] |
| 199 | x := float32(0.0) |
| 200 | switch { |
| 201 | case xc.IsString(): |
| 202 | x = float32(row) |
| 203 | case xc.NumDims() > 1: |
| 204 | _, sz := xc.RowCellSize() |
| 205 | if txy.xIndex < sz && txy.xIndex >= 0 { |
| 206 | x = float32(xc.FloatRowCell(trow, txy.xIndex)) |
| 207 | } |
| 208 | default: |
| 209 | x = float32(xc.Float1D(trow)) |
| 210 | } |
| 211 | return x |
| 212 | } |
| 213 | |
| 214 | // XY returns an x, y pair at given row in table |
| 215 | func (txy *tableXY) XY(row int) (x, y float32) { |
no test coverage detected