switch to fork of asciigraph

This commit is contained in:
Jesse Duffield 2019-06-05 20:51:09 +10:00
parent 60a4c14707
commit 1b834401ed
7 changed files with 21 additions and 13 deletions

17
Gopkg.lock generated
View file

@ -17,13 +17,6 @@
pruneopts = "NUT"
revision = "5a71ef0e047df0427e87a79f27009029921f1f9b"
[[projects]]
digest = "1:8abef4b9ca2f94e008688685bf8fb7bb27e5c82b353a82ef9276a27b4a6d2020"
name = "github.com/carlosms/asciigraph"
packages = ["."]
pruneopts = "NUT"
revision = "22e3e1b9e3cd5ab4f79619cd65987f426d2d3dc4"
[[projects]]
branch = "master"
digest = "1:cd7ba2b29e93e2a8384e813dfc80ebb0f85d9214762e6ca89bb55a58092eab87"
@ -120,6 +113,14 @@
pruneopts = "NUT"
revision = "fc0cef2ff331aebb24cd4e9ded7e20650f3d7006"
[[projects]]
branch = "master"
digest = "1:7b2ab5c6de135d57d3a594b53068e2712da4d376b2f78097dec7b46d18deaa78"
name = "github.com/jesseduffield/asciigraph"
packages = ["."]
pruneopts = "NUT"
revision = "6d88e39309eef29cc5c2ab279ec600465827cbac"
[[projects]]
branch = "master"
digest = "1:f9d37b286259d069b0e12b1c9c2662dc51d0fe6c9257780412c43a7b05f8bc51"
@ -336,7 +337,6 @@
analyzer-version = 1
input-imports = [
"github.com/acarl005/stripansi",
"github.com/carlosms/asciigraph",
"github.com/cloudfoundry/jibber_jabber",
"github.com/docker/docker/api/types",
"github.com/docker/docker/api/types/filters",
@ -344,6 +344,7 @@
"github.com/fatih/color",
"github.com/go-errors/errors",
"github.com/heroku/rollrus",
"github.com/jesseduffield/asciigraph",
"github.com/jesseduffield/gocui",
"github.com/jesseduffield/pty",
"github.com/mcuadros/go-lookup",

View file

@ -42,5 +42,5 @@
name = "github.com/spkg/bom"
[[constraint]]
name = "github.com/carlosms/asciigraph"
revision = "22e3e1b9e3cd5ab4f79619cd65987f426d2d3dc4"
branch = "master"
name = "github.com/jesseduffield/asciigraph"

View file

@ -9,8 +9,8 @@ import (
"strings"
"time"
"github.com/carlosms/asciigraph"
"github.com/fatih/color"
"github.com/jesseduffield/asciigraph"
"github.com/jesseduffield/lazydocker/pkg/config"
"github.com/jesseduffield/lazydocker/pkg/utils"
"github.com/mcuadros/go-lookup"

View file

@ -40,14 +40,21 @@ func Plot(series []float64, options ...Option) string {
config.Offset = 3
}
var min2 float64
var max2 float64
var ratio float64
padding := 0.0 // if we set height to 10 but min and max are both 0, we need 10 units of padding
if interval != 0 {
ratio = float64(config.Height) / interval
} else {
ratio = 1
if config.Height > 0 {
padding = float64(config.Height)
}
}
min2 := round(minimum * ratio)
max2 := round(maximum * ratio)
min2 = round(minimum * ratio)
max2 = round((maximum + padding) * ratio)
intmin2 := int(min2)
intmax2 := int(max2)