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

Method setColumnsByName

plot/plotcore/ploteditor.go:461–482  ·  view source on GitHub ↗

setColumnsByName turns columns on or off if their name contains the given string.

(nameContains string, on bool)

Source from the content-addressed store, hash-verified

459// setColumnsByName turns columns on or off if their name contains
460// the given string.
461func (pl *PlotEditor) setColumnsByName(nameContains string, on bool) { //types:add
462 fr := pl.columnsFrame
463 for i, cli := range fr.Children {
464 if i < plotColumnsHeaderN {
465 continue
466 }
467 ci := i - plotColumnsHeaderN
468 cp := pl.Columns[ci]
469 if cp.Column == pl.Options.XAxis {
470 continue
471 }
472 if !strings.Contains(cp.Column, nameContains) {
473 continue
474 }
475 cp.On = on
476 cl := cli.(*core.Frame)
477 sw := cl.Child(0).(*core.Switch)
478 sw.SetChecked(cp.On)
479 }
480 pl.UpdatePlot()
481 pl.NeedsRender()
482}
483
484// makeColumns makes the Plans for columns
485func (pl *PlotEditor) makeColumns(p *tree.Plan) {

Callers

nothing calls this directly

Calls 5

UpdatePlotMethod · 0.95
ChildMethod · 0.80
SetCheckedMethod · 0.80
NeedsRenderMethod · 0.80
ContainsMethod · 0.45

Tested by

no test coverage detected