makeColumns makes the Plans for columns
(p *tree.Plan)
| 483 | |
| 484 | // makeColumns makes the Plans for columns |
| 485 | func (pl *PlotEditor) makeColumns(p *tree.Plan) { |
| 486 | pl.columnsListUpdate() |
| 487 | tree.Add(p, func(w *core.Frame) { |
| 488 | tree.AddChild(w, func(w *core.Button) { |
| 489 | w.SetText("Clear").SetIcon(icons.ClearAll).SetType(core.ButtonAction) |
| 490 | w.SetTooltip("Turn all columns off") |
| 491 | w.OnClick(func(e events.Event) { |
| 492 | pl.setAllColumns(false) |
| 493 | }) |
| 494 | }) |
| 495 | tree.AddChild(w, func(w *core.Button) { |
| 496 | w.SetText("Search").SetIcon(icons.Search).SetType(core.ButtonAction) |
| 497 | w.SetTooltip("Select columns by column name") |
| 498 | w.OnClick(func(e events.Event) { |
| 499 | core.CallFunc(pl, pl.setColumnsByName) |
| 500 | }) |
| 501 | }) |
| 502 | }) |
| 503 | tree.Add(p, func(w *core.Separator) {}) |
| 504 | for _, cp := range pl.Columns { |
| 505 | tree.AddAt(p, cp.Column, func(w *core.Frame) { |
| 506 | w.Styler(func(s *styles.Style) { |
| 507 | s.CenterAll() |
| 508 | }) |
| 509 | tree.AddChild(w, func(w *core.Switch) { |
| 510 | w.SetType(core.SwitchCheckbox).SetTooltip("Turn this column on or off") |
| 511 | w.OnChange(func(e events.Event) { |
| 512 | cp.On = w.IsChecked() |
| 513 | pl.UpdatePlot() |
| 514 | }) |
| 515 | w.Updater(func() { |
| 516 | xaxis := cp.Column == pl.Options.XAxis || cp.Column == pl.Options.Legend |
| 517 | w.SetState(xaxis, states.Disabled, states.Indeterminate) |
| 518 | if xaxis { |
| 519 | cp.On = false |
| 520 | } else { |
| 521 | w.SetChecked(cp.On) |
| 522 | } |
| 523 | }) |
| 524 | }) |
| 525 | tree.AddChild(w, func(w *core.Button) { |
| 526 | w.SetText(cp.Column).SetType(core.ButtonAction).SetTooltip("Edit column options including setting it as the x-axis or legend") |
| 527 | w.OnClick(func(e events.Event) { |
| 528 | update := func() { |
| 529 | if core.TheApp.Platform().IsMobile() { |
| 530 | pl.Update() |
| 531 | return |
| 532 | } |
| 533 | // we must be async on multi-window platforms since |
| 534 | // it is coming from a separate window |
| 535 | pl.AsyncLock() |
| 536 | pl.Update() |
| 537 | pl.AsyncUnlock() |
| 538 | } |
| 539 | d := core.NewBody().AddTitle("Column options") |
| 540 | core.NewForm(d).SetStruct(cp). |
| 541 | OnChange(func(e events.Event) { |
| 542 | update() |
nothing calls this directly
no test coverage detected