[GH-ISSUE #265] Widget: heat map #142

Open
opened 2026-03-03 16:22:48 +03:00 by kerem · 3 comments
Owner

Originally created by @fgksgf on GitHub (Nov 16, 2020).
Original GitHub issue: https://github.com/mum4k/termdash/issues/265

Hello, I implemented a heat map widget with termdash in SkyWalking-CLI, like this:
heatmap

I want to contribute it back recently, but I need some time to polish code to make it more general. I think the format of input data should be [['xlabel', 'ylabel', value],...], how about you ?

If you have any advice about the widget, please let me know :)

Originally created by @fgksgf on GitHub (Nov 16, 2020). Original GitHub issue: https://github.com/mum4k/termdash/issues/265 Hello, I implemented a heat map widget with termdash in [SkyWalking-CLI](https://github.com/apache/skywalking-cli), like this: ![heatmap](https://user-images.githubusercontent.com/26627380/99217995-4bbbfc00-2814-11eb-8b0f-777ba503c216.png) I want to contribute it back recently, but I need some time to polish code to make it more general. I think the format of input data should be `[['xlabel', 'ylabel', value],...]`, how about you ? If you have any advice about the widget, please let me know :)
Author
Owner

@mum4k commented on GitHub (Nov 17, 2020):

Hi @fgksgf, that heat map widget looks great! If you are willing to contribute it, this would certainly be a good addition to termdash.

I will be more than happy to help you with design of the API and code cleanup. It is hard for me to answer questions or provide a suggestions without more context though. My suggestion would be to start by sending a PR with the API only. That is just the function definitions and their comments without any implementations. That would help me to understand the proposed structure and would allow us to discuss the widget's design. Here is an example of what I mean by sending just function's definition and comment without implementation:

// Values sets the values to be displayed by the BarChart.
// Each value ends up in its own bar. The values must not be negative and must
// be less or equal the maximum value. A bar displaying the maximum value is a
// full bar, taking all available vertical space.
// Provided options override values set when New() was called.
func (bc *BarChart) Values(values []int, max int, opts ...Option) error {
    return errors.New("not implemented")
}

We could do this for all the functions and options that widget will have and then follow up with a second PR that will contain the implementation. Does this work for you?

<!-- gh-comment-id:728671103 --> @mum4k commented on GitHub (Nov 17, 2020): Hi @fgksgf, that heat map widget looks great! If you are willing to contribute it, this would certainly be a good addition to `termdash`. I will be more than happy to help you with design of the API and code cleanup. It is hard for me to answer questions or provide a suggestions without more context though. My suggestion would be to start by sending a PR with the API only. That is just the function definitions and their comments without any implementations. That would help me to understand the proposed structure and would allow us to discuss the widget's design. Here is an example of what I mean by sending just function's definition and comment without implementation: ```go // Values sets the values to be displayed by the BarChart. // Each value ends up in its own bar. The values must not be negative and must // be less or equal the maximum value. A bar displaying the maximum value is a // full bar, taking all available vertical space. // Provided options override values set when New() was called. func (bc *BarChart) Values(values []int, max int, opts ...Option) error { return errors.New("not implemented") } ``` We could do this for all the functions and options that widget will have and then follow up with a second PR that will contain the implementation. Does this work for you?
Author
Owner

@fgksgf commented on GitHub (Nov 17, 2020):

No problem, I will do this.
Thanks for your reply.

<!-- gh-comment-id:728695230 --> @fgksgf commented on GitHub (Nov 17, 2020): No problem, I will do this. Thanks for your reply.
Author
Owner

@mum4k commented on GitHub (Nov 17, 2020):

Great, thank you for your help!

<!-- gh-comment-id:728697911 --> @mum4k commented on GitHub (Nov 17, 2020): Great, thank you for your help!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/termdash#142
No description provided.