mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Fixed bug of display for y-axis captions with instant delivered data.
This commit is contained in:
parent
64bb818fe9
commit
b1ed8cd1b1
2 changed files with 17 additions and 12 deletions
|
@ -816,7 +816,9 @@ ChartWidget::ChartWidget(not_null<Ui::RpWidget*> parent)
|
|||
}
|
||||
}) {
|
||||
sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &s) {
|
||||
) | rpl::filter([](const QSize &s) {
|
||||
return !s.isNull();
|
||||
}) | rpl::start_with_next([=](const QSize &s) {
|
||||
const auto filtersHeight = _filterButtons
|
||||
? _filterButtons->height()
|
||||
: 0;
|
||||
|
@ -840,6 +842,11 @@ ChartWidget::ChartWidget(not_null<Ui::RpWidget*> parent)
|
|||
- st::statisticsChartFooterHeight
|
||||
- filtersHeight
|
||||
- st::statisticsChartFooterSkip);
|
||||
|
||||
{
|
||||
updateChartFullWidth(s.width());
|
||||
updateBottomDates();
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
setupChartArea();
|
||||
|
@ -857,6 +864,11 @@ void ChartWidget::resizeHeight() {
|
|||
+ (_filterButtons ? _filterButtons->height() : 0));
|
||||
}
|
||||
|
||||
void ChartWidget::updateChartFullWidth(int w) {
|
||||
const auto finalXLimits = _animationController.finalXLimits();
|
||||
_bottomLine.chartFullWidth = w / (finalXLimits.max - finalXLimits.min);
|
||||
}
|
||||
|
||||
QRect ChartWidget::chartAreaRect() const {
|
||||
return _chartArea->rect()
|
||||
- QMargins(
|
||||
|
@ -971,7 +983,7 @@ void ChartWidget::setupChartArea() {
|
|||
}
|
||||
|
||||
void ChartWidget::updateBottomDates() {
|
||||
if (!_chartData) {
|
||||
if (!_chartData || !_bottomLine.chartFullWidth) {
|
||||
return;
|
||||
}
|
||||
const auto d = _bottomLine.chartFullWidth * _chartData.oneDayPercentage;
|
||||
|
@ -1079,11 +1091,7 @@ void ChartWidget::setupFooter() {
|
|||
xPercentageLimits,
|
||||
_animatedChartLines,
|
||||
now);
|
||||
{
|
||||
const auto finalXLimits = _animationController.finalXLimits();
|
||||
_bottomLine.chartFullWidth = _chartArea->width()
|
||||
/ (finalXLimits.max - finalXLimits.min);
|
||||
}
|
||||
updateChartFullWidth(_chartArea->width());
|
||||
updateBottomDates();
|
||||
if ((now - _lastHeightLimitsChanged) < kHeightLimitsUpdateTimeout) {
|
||||
return;
|
||||
|
@ -1221,11 +1229,7 @@ void ChartWidget::setChartData(Data::StatisticalChart chartData) {
|
|||
{ _chartData.xPercentage.front(), _chartData.xPercentage.back() },
|
||||
_animatedChartLines,
|
||||
0);
|
||||
{
|
||||
const auto finalXLimits = _animationController.finalXLimits();
|
||||
_bottomLine.chartFullWidth = _chartArea->width()
|
||||
/ (finalXLimits.max - finalXLimits.min);
|
||||
}
|
||||
updateChartFullWidth(_chartArea->width());
|
||||
updateBottomDates();
|
||||
_animationController.finish();
|
||||
addHorizontalLine(_animationController.finalHeightLimits(), false);
|
||||
|
|
|
@ -121,6 +121,7 @@ private:
|
|||
void updateBottomDates();
|
||||
|
||||
void resizeHeight();
|
||||
void updateChartFullWidth(int w);
|
||||
|
||||
const base::unique_qptr<RpMouseWidget> _chartArea;
|
||||
const std::unique_ptr<Footer> _footer;
|
||||
|
|
Loading…
Add table
Reference in a new issue