mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-09-05 19:43:24 +02:00
Slightly improved display of numbers approaching zero in stats charts.
This commit is contained in:
parent
a532067a93
commit
b0125e8165
2 changed files with 6 additions and 3 deletions
|
@ -22,7 +22,7 @@ constexpr auto kStep = 5.;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString Format(ChartValue absoluteValue) {
|
[[nodiscard]] QString Format(ChartValue absoluteValue) {
|
||||||
constexpr auto kTooMuch = ChartValue(10'000);
|
static constexpr auto kTooMuch = ChartValue(10'000);
|
||||||
return (absoluteValue >= kTooMuch)
|
return (absoluteValue >= kTooMuch)
|
||||||
? Lang::FormatCountToShort(absoluteValue).string
|
? Lang::FormatCountToShort(absoluteValue).string
|
||||||
: QString::number(absoluteValue);
|
: QString::number(absoluteValue);
|
||||||
|
|
|
@ -20,8 +20,11 @@ namespace Statistic {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
[[nodiscard]] QString FormatF(float64 absoluteValue) {
|
[[nodiscard]] QString FormatF(float64 absoluteValue) {
|
||||||
constexpr auto kTooMuch = int(10'000);
|
static constexpr auto kTooMuch = int(10'000);
|
||||||
return (absoluteValue >= kTooMuch)
|
static constexpr auto kTooSmall = 1e-9;
|
||||||
|
return (std::abs(absoluteValue) <= kTooSmall)
|
||||||
|
? u"0"_q
|
||||||
|
: (absoluteValue >= kTooMuch)
|
||||||
? Lang::FormatCountToShort(absoluteValue).string
|
? Lang::FormatCountToShort(absoluteValue).string
|
||||||
: QString::number(absoluteValue);
|
: QString::number(absoluteValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue