[PR #185] [MERGED] Allow empty values on line chart #241

Closed
opened 2026-03-03 16:23:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mum4k/termdash/pull/185
Author: @slok
Created: 4/14/2019
Status: Merged
Merged: 4/18/2019
Merged by: @mum4k

Base: develHead: linechart-no-values


📝 Commits (6)

  • 42c2731 Allow 'no values' on linechart represented by NaN float64 that will be displayed as empty cells
  • 6cf2caf Update changelog
  • 9b25e35 Make MinMax return NaN when all values are NaN
  • b54694e LineChart defaults to 0 mix and max when these are NaN
  • 2ae5ca1 Simplify MinMax result float checks on test
  • 53abc10 Remove not required constants from linechart minMax wrapper

📊 Changes

5 files changed (+180 additions, -13 deletions)

View changed files

📝 CHANGELOG.md (+7 -6)
📝 internal/numbers/numbers.go (+13 -1)
📝 internal/numbers/numbers_test.go (+17 -2)
📝 widgets/linechart/linechart.go (+30 -4)
📝 widgets/linechart/linechart_test.go (+113 -0)

📄 Description

This PR Fixes #184.

It will allow having values on the line chart that will not be displayed if they are missing. To do so it will use the math.NaN float64 value.

If this is combined with adaptive Y-axis option, the graphs that have empty gaps and high values with small variance will be more accurate regarding the Y axis (because they will not start at 0).

In this example, we can see that we don't have metrics around 10:03-10:05 making the graph render values as 0 and making Y axis start at 0:

Instead of representing the missing metrics as 0, with this change and using math.NaN, the Y axis has a better range around the min and max values making the graph more accurate.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mum4k/termdash/pull/185 **Author:** [@slok](https://github.com/slok) **Created:** 4/14/2019 **Status:** ✅ Merged **Merged:** 4/18/2019 **Merged by:** [@mum4k](https://github.com/mum4k) **Base:** `devel` ← **Head:** `linechart-no-values` --- ### 📝 Commits (6) - [`42c2731`](https://github.com/mum4k/termdash/commit/42c273128648d78c3afa342672ef1a3872053eb5) Allow 'no values' on linechart represented by NaN float64 that will be displayed as empty cells - [`6cf2caf`](https://github.com/mum4k/termdash/commit/6cf2caf0b63d4e7156a9d610e91ba79723f3ce1a) Update changelog - [`9b25e35`](https://github.com/mum4k/termdash/commit/9b25e351727e9ec5ffc289abca4db997ee2b9a6a) Make MinMax return NaN when all values are NaN - [`b54694e`](https://github.com/mum4k/termdash/commit/b54694ed123688f67574a7e46cdfed1de4968fd1) LineChart defaults to 0 mix and max when these are NaN - [`2ae5ca1`](https://github.com/mum4k/termdash/commit/2ae5ca1dcb5f9476dc42597edb2d4df920b84dc3) Simplify MinMax result float checks on test - [`53abc10`](https://github.com/mum4k/termdash/commit/53abc10da3f225fdce8927a8ed5c8dbf771b7e38) Remove not required constants from linechart minMax wrapper ### 📊 Changes **5 files changed** (+180 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+7 -6) 📝 `internal/numbers/numbers.go` (+13 -1) 📝 `internal/numbers/numbers_test.go` (+17 -2) 📝 `widgets/linechart/linechart.go` (+30 -4) 📝 `widgets/linechart/linechart_test.go` (+113 -0) </details> ### 📄 Description This PR Fixes #184. It will allow having _values_ on the line chart that will not be displayed if they are missing. To do so it will use the `math.NaN` float64 value. If this is combined with adaptive Y-axis option, the graphs that have empty gaps and high values with small variance will be more accurate regarding the Y axis (because they will not start at 0). In this example, we can see that we don't have metrics around 10:03-10:05 making the graph render values as 0 and making Y axis start at 0: ![](https://i.imgur.com/Gs4qaoz.png) Instead of representing the missing metrics as 0, with this change and using `math.NaN`, the Y axis has a better range around the min and max values making the graph more accurate. ![](https://i.imgur.com/K1kgapF.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 16:23:29 +03:00
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#241
No description provided.