diff --git a/go.mod b/go.mod index 52e5165..70a1d81 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/alecthomas/chroma v0.10.0 github.com/charmbracelet/bubbles v0.15.0 github.com/charmbracelet/bubbletea v0.23.2 - github.com/charmbracelet/lipgloss v0.6.0 - github.com/chriskim06/bubble-plot v0.0.2 + github.com/charmbracelet/lipgloss v0.7.1 + github.com/chriskim06/bubble-plot v0.0.5 github.com/muesli/reflow v0.3.0 github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.15.0 @@ -25,7 +25,7 @@ require ( github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect - github.com/chriskim06/drawille-go v0.0.1 // indirect + github.com/chriskim06/drawille-go v0.0.4 // indirect github.com/containerd/console v1.0.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dlclark/regexp2 v1.4.0 // indirect @@ -70,7 +70,7 @@ require ( github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/muesli/ansi v0.0.0-20230307104941-78d3738a59f2 // indirect github.com/muesli/cancelreader v0.2.2 // indirect - github.com/muesli/termenv v0.15.0 // indirect + github.com/muesli/termenv v0.15.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect diff --git a/go.sum b/go.sum index f4f82f5..2e81555 100644 --- a/go.sum +++ b/go.sum @@ -59,12 +59,13 @@ github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61B github.com/charmbracelet/bubbletea v0.23.2 h1:vuUJ9HJ7b/COy4I30e8xDVQ+VRDUEFykIjryPfgsdps= github.com/charmbracelet/bubbletea v0.23.2/go.mod h1:FaP3WUivcTM0xOKNmhciz60M6I+weYLF76mr1JyI7sM= github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= -github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87inij9N3wJY= github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk= -github.com/chriskim06/bubble-plot v0.0.2 h1:asKlXQx4fH1Mv6424iFQmSy9O41wHmy9jYhNpVwLzUk= -github.com/chriskim06/bubble-plot v0.0.2/go.mod h1:Hjhmli73PbzcTyRNdg3TzSgZSj15HYlQqLAYQN58s6M= -github.com/chriskim06/drawille-go v0.0.1 h1:tvjp14ni1J6iLpz9fj/iwyf23hKDhu6iLvUQNTaB8YU= -github.com/chriskim06/drawille-go v0.0.1/go.mod h1:crZ9L4tSvNEwUJjxF2z+1RTq5P4CLZdUZeoD1XG7i3Q= +github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E= +github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c= +github.com/chriskim06/bubble-plot v0.0.5 h1:cZZAftFYRYHYFlK5F2uSQAjDJ2qfAHYHt7Bw0RFHqtM= +github.com/chriskim06/bubble-plot v0.0.5/go.mod h1:g9QdUaAfMssuo5u7zLyywwxuESWSrP4B0Kxtp2AHCKA= +github.com/chriskim06/drawille-go v0.0.4 h1:7+XPaniRklDFTktBMIuorRtXaY7RvwAFhoI3to2Eclw= +github.com/chriskim06/drawille-go v0.0.4/go.mod h1:crZ9L4tSvNEwUJjxF2z+1RTq5P4CLZdUZeoD1XG7i3Q= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -269,8 +270,8 @@ github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKt github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc= github.com/muesli/termenv v0.14.0/go.mod h1:kG/pF1E7fh949Xhe156crRUrHNyK221IuGO7Ez60Uc8= -github.com/muesli/termenv v0.15.0 h1:ZYfCF4CZGhAA4meilZ5pd7tfUX4QLH4zB7OBie4RMS8= -github.com/muesli/termenv v0.15.0/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ= +github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs= +github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= diff --git a/internal/ui/graphs.go b/internal/ui/graphs.go index 167e5c7..383ae83 100644 --- a/internal/ui/graphs.go +++ b/internal/ui/graphs.go @@ -19,7 +19,6 @@ type Graphs struct { Height int Width int extra int - conf config.Colors name string cpuData map[string][][]float64 memData map[string][][]float64 @@ -29,18 +28,14 @@ type Graphs struct { } func NewGraphs(conf config.Colors) *Graphs { - cpuPlot := plot.New() - memPlot := plot.New() - cpuPlot.MaxDataPoints = 50 - memPlot.MaxDataPoints = 50 - cpuPlot.Styles.LineColors = []int{conf.CPULimit, conf.CPUUsage} - cpuPlot.Styles.AxisColor = conf.Axis - cpuPlot.Styles.LabelColor = conf.Labels - memPlot.Styles.LineColors = []int{conf.MemLimit, conf.MemUsage} - memPlot.Styles.AxisColor = conf.Axis - memPlot.Styles.LabelColor = conf.Labels + options := []plot.Option{ + plot.WithMaxDataPoints(50), + plot.WithAxisColor(conf.Axis), + plot.WithLabelColor(conf.Labels), + } + cpuPlot := plot.New(append(options, plot.WithLineColors([]int{conf.CPULimit, conf.CPUUsage}))...) + memPlot := plot.New(append(options, plot.WithLineColors([]int{conf.MemLimit, conf.MemUsage}))...) return &Graphs{ - conf: conf, cpuPlot: cpuPlot, memPlot: memPlot, }