| 88 | } |
| 89 | |
| 90 | func (pl *PlotEditor) Init() { |
| 91 | pl.Frame.Init() |
| 92 | |
| 93 | pl.Options.defaults() |
| 94 | pl.Styler(func(s *styles.Style) { |
| 95 | s.Grow.Set(1, 1) |
| 96 | if pl.SizeClass() == core.SizeCompact { |
| 97 | s.Direction = styles.Column |
| 98 | } |
| 99 | }) |
| 100 | |
| 101 | pl.OnShow(func(e events.Event) { |
| 102 | pl.UpdatePlot() |
| 103 | }) |
| 104 | |
| 105 | pl.Updater(func() { |
| 106 | pl.Options.fromMeta(pl.table.Table) |
| 107 | }) |
| 108 | tree.AddChildAt(pl, "columns", func(w *core.Frame) { |
| 109 | pl.columnsFrame = w |
| 110 | w.Styler(func(s *styles.Style) { |
| 111 | s.Direction = styles.Column |
| 112 | s.Background = colors.Scheme.SurfaceContainerLow |
| 113 | if w.SizeClass() == core.SizeCompact { |
| 114 | s.Grow.Set(1, 0) |
| 115 | } else { |
| 116 | s.Grow.Set(0, 1) |
| 117 | s.Overflow.Y = styles.OverflowAuto |
| 118 | } |
| 119 | }) |
| 120 | w.Maker(pl.makeColumns) |
| 121 | }) |
| 122 | tree.AddChildAt(pl, "plot", func(w *Plot) { |
| 123 | pl.plotWidget = w |
| 124 | w.Plot = pl.plot |
| 125 | w.Styler(func(s *styles.Style) { |
| 126 | s.Grow.Set(1, 1) |
| 127 | }) |
| 128 | }) |
| 129 | } |
| 130 | |
| 131 | // setIndexView sets the table to view and does Update |
| 132 | // to update the Column list, which will also trigger a Layout |