Skip to content

Commit

Permalink
AddStdAggs uses varargs
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Jun 13, 2024
1 parent cb496d3 commit 2179b30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions egui/plots.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (gui *GUI) NewPlotTab(key etime.ScopeKey, tabLabel string) *plotview.PlotVi

// AddTableView adds a table view of given log,
// typically particularly useful for Debug logs.
func (gui *GUI) AddTableView(lg *elog.Logs, mode etime.Modes, time etime.Times) {
func (gui *GUI) AddTableView(lg *elog.Logs, mode etime.Modes, time etime.Times) *tensorview.TableView {
if gui.TableViews == nil {
gui.TableViews = make(map[etime.ScopeKey]*tensorview.TableView)
}
Expand All @@ -150,13 +150,15 @@ func (gui *GUI) AddTableView(lg *elog.Logs, mode etime.Modes, time etime.Times)
lt, ok := lg.Tables[key]
if !ok {
log.Printf("ERROR: in egui.AddTableView, log: %s not found\n", key)
return
return nil
}

tt := gui.Tabs.NewTab(mode.String() + " " + time.String() + " ")
tv := tensorview.NewTableView(tt)
gui.TableViews[key] = tv
tv.SetReadOnly(true)
tv.SetTable(lt.Table)
return tv
}

// TableView returns TableView for mode, time scope
Expand Down
4 changes: 2 additions & 2 deletions elog/stditems.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (lg *Logs) AddCounterItems(ctrs ...etime.Times) {

// AddStdAggs adds standard aggregation items for times up to the penultimate
// time step provided, for given stat item that was created for the final timescale.
func (lg *Logs) AddStdAggs(itm *Item, mode etime.Modes, times []etime.Times) {
func (lg *Logs) AddStdAggs(itm *Item, mode etime.Modes, times ...etime.Times) {
ntimes := len(times)
for i := ntimes - 2; i >= 0; i-- {
tm := times[i]
Expand Down Expand Up @@ -81,7 +81,7 @@ func (lg *Logs) AddStatAggItem(statName string, times ...etime.Times) *Item {
etime.Scope(etime.AllModes, times[ntimes-1]): func(ctx *Context) {
ctx.SetFloat64(ctx.Stats.Float(statName))
}}})
lg.AddStdAggs(itm, etime.AllModes, times)
lg.AddStdAggs(itm, etime.AllModes, times...)
return itm
}

Expand Down
2 changes: 1 addition & 1 deletion netview/netview.go
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ func (nv *NetView) ConfigToolbar(tb *core.Toolbar) {
cmap := nv.ColorMapVal.AsWidget()
cmap.AsWidget().SetTooltip("Color map for translating values into colors -- click to select alternative.").
Style(func(s *styles.Style) {
s.Min.X.Em(20)
s.Min.X.Em(10)
s.Min.Y.Em(1.2)
s.Grow.Set(0, 1)
})
Expand Down

0 comments on commit 2179b30

Please sign in to comment.