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

Method UpdateMaxWidths

tensor/tensorcore/table.go:189–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187}
188
189func (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
217func (tb *Table) MakeHeader(p *tree.Plan) {
218 tree.AddAt(p, "header", func(w *core.Frame) {

Callers 1

InitMethod · 0.95

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls

no outgoing calls

Tested by

no test coverage detected