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)
| 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. |
| 63 | func 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. |
no test coverage detected