Repository navigation
feat(pulse): add a donut chart package - #42
Merged
Merged
Conversation
The new package donut draws the split of a whole at one moment: a ring, or a rectangular frame, divided into sections clockwise from 12 o'clock, with the total and a label in the middle and a one-line legend. Glyph sets: Braille (the default), Octants and HalfBlocks. A non-zero section always gets a visible arc. The line chart Model does not change. Closes #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the package
github.com/ingvarch/pulse/donutfor dashboards that need the split of a whole at one moment, for example Kubernetes pods by phase, with the total in the middle. The line chartModeldoes not change, and the package imports only Lip Gloss.donut.New(h, opts...)draws a ringhrows high and2hcolumns wide;WithFrame(w, h, thickness, radius)draws a rectangular frame instead, with square or rounded corners.SetSectionssets the sections,Viewdraws,Legendprints● Name Valueentries on one line.Braille(the default; works in nearly every terminal),Octants(Unicode 16 octants plus 26 older block characters, the smoothest edges, needs a terminal or font that has them),HalfBlocks.WithGlyphsandSetGlyphschoose one. There is noTERMdetection.Viewreturns exactlyhlines of equal width.docs/donut.md, screenshotassets/donut.png(Braille ring, HalfBlocks frame), demoexamples/donut(pods by phase that change over time;gcycles glyph sets).Open question from the issue, decided: the default glyph set is
Braille, with no terminal detection.Left for later: octants are covered by tests but not shown in a screenshot, because the screenshot font has no octant glyphs. The zero-value
Model(withoutNew) is not supported. A sum of values that overflows float64 shows+Inf.Issues
Closes #14
Type of Change
Checklist
gofmt,go vet).go test -race ./...) and everything builds (go build ./...andgo -C examples build ./...).