#285·termui

BarChart widget style inconsistencies

Author: nuxyCreated Dec 8, 2020Updated Aug 23, 2023

There are a couple BarChart UI inconsistencies I found when using this library.

Issue 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 than BarWidth / 2 end up bleeding into the next bar. The position should be calculated based on the character length and BarWidth size available.

Issue 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 is 1% or less.

Before

Before

After

After

I have created a PR that contains changes to resolve the issues above. 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.