Open nuxy opened 3 years ago
Hello!
Thank you for contributing to termui. I've merged this PR into a downstream fork at https://github.com/dcorbe/termui-dpc
This was done in response to the following issue: https://github.com/gizak/termui/issues/304#issuecomment-971756327
My intention is not to create a permanent fork for termui. I'm only trying to facilitate maintenance while the original author(s) are away. My hope is that my fork is eventually merged back into this repo along with your commits.
I would like to invite you to collaborate further. I would appreciate any help curating fixes and generally getting this project going in the right direction. Thanks again for your contribution!
This PR contains a couple changes to resolve UI inconsistencies I found when using this library. The overall goal is to have these items fixed upstream so I don't have to include a modified version of the
barchart.go
file in my project source.Proposed changes
Commit 1 The percent text value always starts from the bar center position.
While this looks great when working with one character
Data
values (as pictured in the termui example) it looks awkward when dealing with long values since items greater thanBarWidth / 2
end up bleeding into the next bar. The position should be calculated based on the character length andBarWidth
size available.Commit 2 The bar is not completely rendered when
Data
values< 2%
exist. I'm not sure this is intentional but the chart should maintain consistent sizing in regard to the bar width even if the value is1%
or less.Before
After