Fixed credits display in statistic charts.
This commit is contained in:
@@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "statistics/view/chart_rulers_view.h"
|
||||
|
||||
#include "data/data_channel_earn.h" // Data::kEarnMultiplier.
|
||||
#include "info/channel_statistics/earn/earn_format.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "statistics/chart_lines_filter_controller.h"
|
||||
@@ -42,9 +41,15 @@ void ChartRulersView::setChartData(
|
||||
|| chartData.currencyRate;
|
||||
if (chartData.currencyRate) {
|
||||
_currencyIcon = ChartCurrencyIcon(chartData, {});
|
||||
_leftCustomCaption = [=](float64 value) {
|
||||
return FormatF(value / float64(Data::kEarnMultiplier));
|
||||
};
|
||||
if (chartData.currency == Data::StatisticalCurrency::Ton) {
|
||||
_leftCustomCaption = [=](float64 value) {
|
||||
return FormatF(value / float64(kOneStarInNano));
|
||||
};
|
||||
} else {
|
||||
_leftCustomCaption = [=](float64 value) {
|
||||
return FormatF(value);
|
||||
};
|
||||
}
|
||||
_rightCustomCaption = [=, rate = chartData.currencyRate](float64 v) {
|
||||
return Info::ChannelEarn::ToUsd(v, rate, 0);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "statistics/widgets/point_details_widget.h"
|
||||
|
||||
#include "data/data_channel_earn.h" // Data::kEarnMultiplier.
|
||||
#include "info/channel_statistics/earn/earn_format.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "statistics/statistics_common.h"
|
||||
@@ -179,7 +178,7 @@ PointDetailsWidget::PointDetailsWidget(
|
||||
const auto maxValueTextWidth = [&] {
|
||||
if (hasUsdLine) {
|
||||
auto maxValueWidth = 0;
|
||||
const auto multiplier = float64(Data::kEarnMultiplier);
|
||||
const auto multiplier = float64(kOneStarInNano);
|
||||
for (const auto &value : _chartData.lines.front().y) {
|
||||
const auto valueText = Ui::Text::String(
|
||||
_textStyle,
|
||||
@@ -325,7 +324,7 @@ void PointDetailsWidget::setXIndex(int xIndex) {
|
||||
nullptr,
|
||||
{ float64(xIndex), float64(xIndex) }).parts
|
||||
: std::vector<PiePartData::Part>();
|
||||
const auto multiplier = float64(Data::kEarnMultiplier);
|
||||
const auto multiplier = float64(kOneStarInNano);
|
||||
const auto isCredits
|
||||
= _chartData.currency == Data::StatisticalCurrency::Credits;
|
||||
for (auto i = 0; i < _chartData.lines.size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user