mirror of
https://github.com/mum4k/termdash.git
synced 2026-04-27 03:15:55 +03:00
[GH-ISSUE #191] Linechart: Add support for a legend #109
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#109
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?
Originally created by @keithknott26 on GitHub (Apr 27, 2019).
Original GitHub issue: https://github.com/mum4k/termdash/issues/191
Consider adding support for a legend in the linechart, this is particularly useful when more than one series is used.
@mum4k commented on GitHub (Apr 28, 2019):
Agreed @keithknott26, this would indeed be a useful feature. Originally I was considering labels inside the linechart itself like here:
However I no longer think this is the best solution exactly due to what you described, lines might meet the legend. The infrastructure would handle that well. Depending on the order of drawing, one of the two would be hidden by the other in the location of the overlap. However this would decrease the readability of the linechart itself, hidden line means loss of details.
I think your first option might be best - if labels are desired, we could just reserve one line under the line chart and print them there.
@mum4k commented on GitHub (Apr 28, 2019):
Het @keithknott26,
as @slok demonstrated in #188, using the Text widget alongside the LineChart gives a lot of flexibility on legend placement and also allows to scroll the legend if there are many entries. This also plays well into the Termdash philosophy of reusable components.
At this point I am wondering whether instead of implementing the legend in the LineChart we shouldn't identify the gaps and improve the Text widget if any.
What do you think? What are the scenarios that cannot be conveniently achieved with the Text widget?
@keithknott26 commented on GitHub (Apr 29, 2019):
@mum4k,
I tried this myself locally and it looks great! I also like that @slok created a widget with multiple elements inside so there is only one border. The fact that you can scroll is a bonus.
Do you think it will be possible to use the table widget instead of the text widget? I'm just wondering how easy aligning the text would be inside the widget, for now I'm using spaces and tabs , but depending on how you wrote the table widget one might be able to use that instead assuming each row could have its own text formatting applied (color, spacing).
I haven't found many scenarios which can't be achieved with the Text widget but here are a couple low priority suggestions.
-An "auto-scroll" feature
-Support for blinking text
-Issue found where if you use a \t character it prevents the line from being displayed
@mum4k commented on GitHub (Apr 29, 2019):
I this that what @slok has are actually multiple inner containers inside an outer container. The outer container has a border and two inner containers without borders. Each of the inner containers has a widget.
Indeed similarly we could place a table widget next to the LineChart. The table widget will support individual alignment and formatting for each row and for each cell. Please take a look at the API that is already drafted in the table branch and let me know if you see anything missing or if we should change something. Do note that this is still very much in development.
Feel free to open separate issues for the suggestions, we can discuss them individually and agree on next steps.
I am going to close this issue based on our discussion and your assertion that we can do with the Text widget for now and with Table later. However if you do find something missing, please don't hesitate to reopen this.
@slok commented on GitHub (Apr 29, 2019):
That's right! is a container with 2 containers Inside (one for the graph and another one for the legend), and the border set only to the outer container, so could be very easy to change the legend made with a text widget to use a table widget or any other widget instead.