mirror of
https://github.com/mum4k/termdash.git
synced 2026-04-27 03:15:55 +03:00
[PR #188] [MERGED] Y-axis label formatter for LineChart #243
Labels
No labels
bug
cleanup
enhancement
enhancement
enhancement
good first issue
help wanted
help wanted
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/termdash#243
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mum4k/termdash/pull/188
Author: @slok
Created: 4/25/2019
Status: ✅ Merged
Merged: 5/9/2019
Merged by: @mum4k
Base:
devel← Head:y-axis-label-formatter📝 Commits (10+)
560aef6Add linechart y-axis value formatter option API7157a07Add formatter support to linechart internal Value type135edd4Add formatted values creation if the scale has a value formatter asigned7571889Use the y-axis value formatter option on y-axis internal propertiesa8931e2Check also for non printable characters on alingfor package text helper methodc1bf776Use variadic args for Value factory options36f116dMake axes labels length finder compatible with unicode runesb0f8079Add linechart custom formatter testcases for long strings, non-printable characters and unicode value formatter resultse152366Fix comment150b7e2Allow empty Y-axis labels on linechart using a value formatter that returns empty strings📊 Changes
17 files changed (+758 additions, -35 deletions)
View changed files
📝
CHANGELOG.md(+7 -0)📝
internal/alignfor/alignfor.go(+9 -1)📝
internal/alignfor/alignfor_test.go(+6 -0)📝
internal/wrap/wrap.go(+2 -2)📝
widgets/linechart/internal/axes/axes.go(+6 -2)📝
widgets/linechart/internal/axes/axes_test.go(+32 -6)📝
widgets/linechart/internal/axes/label.go(+1 -1)📝
widgets/linechart/internal/axes/label_test.go(+2 -2)📝
widgets/linechart/internal/axes/scale.go(+22 -7)📝
widgets/linechart/internal/axes/scale_test.go(+3 -3)📝
widgets/linechart/internal/axes/value.go(+50 -6)📝
widgets/linechart/internal/axes/value_test.go(+17 -1)📝
widgets/linechart/linechart.go(+5 -4)📝
widgets/linechart/linechart_test.go(+194 -0)📝
widgets/linechart/options.go(+16 -0)➕
widgets/linechart/value_formatter.go(+146 -0)➕
widgets/linechart/value_formatter_test.go(+240 -0)📄 Description
This PR fixes #187
Adds the ability to set custom labels on the Y-axis using a value formatter that accepts a numeric value (float64) and returns the corresponding label to this value (string).
The PR is in WIP state. I'll update the PR accordingly.
Steps:
ValueFormatter.Valueif is present.This approach seems to work fine, I put an image of the project that I'm developing (a Grafana for terminal that I'll make it public soon) using this feature.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.