Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto set the Y axis label width #19

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Auto set the Y axis label width #19

merged 1 commit into from
Dec 15, 2023

Conversation

ademille
Copy link
Contributor

The Y axis label width was hard coded to 4 with 2 decimal places. This caused any number larger than 1000 to be truncated.

The Y axis label width is now based on the maximum value in the data set, allowing enough characters for the whole number along with 2 decimal places.

@@ -43,6 +42,7 @@ type brailleCell struct {
type Plot struct {
*tview.Box
data [][]float64
maxVal float64
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The max data value was calculated in several places. And I would have had to calculated it again for this change. So, I figured it was better to do it once when the data was set.

@ademille ademille force-pushed the main branch 2 times, most recently from d06fc2f to af27ccd Compare December 15, 2023 06:35
@@ -1,6 +1,6 @@
# Contributing To Tvxwidgets

We'd love your contribtion on the project!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spell check was failing, so I fixed this as well.

@ademille
Copy link
Contributor Author

Max value is over 18000.
Before the change:
image

After the change:
image

The Y axis label width was hard coded to 4 with 2 decimal places. This
caused any number larger than 1000 to be truncated.

The Y axis label width is now based on the maximum value in the data
set, allowing enough characters for the whole number along with 2
decimal places.

Signed-off-by: Aaron DeMille <[email protected]>
@navidys
Copy link
Owner

navidys commented Dec 15, 2023

@ademille thanks

@navidys navidys merged commit dd99cf4 into navidys:main Dec 15, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants