Repository navigation
feat(pulse): add one-line sparklines - #41
Merged
Merged
Conversation
Sparkline draws one block per value and SparklineBraille two values per cell, both as plain text. (*Model).Sparkline draws a series of the chart in its style, with the range View uses: the auto range, the right axis range or the log scale. Closes #13
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 one-line sparklines for tables and lists, for example a CPU trend in each row of a node list. The smallest full chart takes several rows plus axis labels; a sparkline takes one row.
Sparkline(values, min, max)draws one block (▁▂▃▄▅▆▇█) per value;SparklineBraille(values, min, max)draws two values per cell as braille bars, one to four dots high. Both return plain text.min..min+1. A NaN or infinite bound gives spaces.(*Model).Sparkline(name)draws a series of the chart in its style, over the points the view shows (it followsSetOffset), with the rangeViewuses: the fitted auto range, the right axis range for a right-axis series, the log scale withSetLogScale. Inverted series are negated as inView.Viewinto one helper,plotSeries, whichViewand the method share, so the range rule exists once. With auto range, the method updatesMinandMaxasViewdoes.docs/sparklines.mdand screenshotassets/sparkline.png.Found along the way: freeze's embedded font has no braille glyphs, so braille screenshots need an installed font that has them.
docs/development.mdnow says how to render them.Left for later: the method has no braille variant; the guide shows how to call
SparklineBraillewithSeriesDataand the chart's range.Issues
Closes #13
Type of Change
Checklist
gofmt,go vet).go test -race ./...) and everything builds (go build ./...andgo -C examples build ./...).