()
| 187 | } |
| 188 | |
| 189 | func (tb *Table) UpdateMaxWidths() { |
| 190 | if len(tb.headerWidths) != tb.NCols { |
| 191 | tb.headerWidths = make([]int, tb.NCols) |
| 192 | tb.colMaxWidths = make([]int, tb.NCols) |
| 193 | } |
| 194 | |
| 195 | if tb.SliceSize == 0 { |
| 196 | return |
| 197 | } |
| 198 | for fli := 0; fli < tb.NCols; fli++ { |
| 199 | tb.colMaxWidths[fli] = 0 |
| 200 | col := tb.Table.Table.Columns[fli] |
| 201 | stsr, isstr := col.(*tensor.String) |
| 202 | |
| 203 | if !isstr { |
| 204 | continue |
| 205 | } |
| 206 | mxw := 0 |
| 207 | for _, ixi := range tb.Table.Indexes { |
| 208 | if ixi >= 0 { |
| 209 | sval := stsr.Values[ixi] |
| 210 | mxw = max(mxw, len(sval)) |
| 211 | } |
| 212 | } |
| 213 | tb.colMaxWidths[fli] = mxw |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | func (tb *Table) MakeHeader(p *tree.Plan) { |
| 218 | tree.AddAt(p, "header", func(w *core.Frame) { |
no outgoing calls
no test coverage detected