2023-08-27 21:44:50 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2023-08-27 22:17:30 +00:00
|
|
|
#include "statistics/segment_tree.h"
|
2023-08-27 21:44:50 +00:00
|
|
|
#include "statistics/statistics_common.h"
|
|
|
|
#include "statistics/view/abstract_chart_view.h"
|
2023-09-08 09:15:35 +00:00
|
|
|
#include "ui/effects/animation_value.h"
|
2023-08-27 21:44:50 +00:00
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
struct StatisticalChart;
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace Statistic {
|
|
|
|
|
|
|
|
struct Limits;
|
|
|
|
|
|
|
|
class StackChartView final : public AbstractChartView {
|
|
|
|
public:
|
|
|
|
StackChartView();
|
|
|
|
~StackChartView() override final;
|
|
|
|
|
2023-09-19 10:02:50 +00:00
|
|
|
void paint(QPainter &p, const PaintContext &c) override;
|
2023-08-27 21:44:50 +00:00
|
|
|
|
|
|
|
void paintSelectedXIndex(
|
|
|
|
QPainter &p,
|
2023-09-19 10:02:50 +00:00
|
|
|
const PaintContext &c,
|
2023-09-05 14:03:08 +00:00
|
|
|
int selectedXIndex,
|
|
|
|
float64 progress) override;
|
2023-08-27 21:44:50 +00:00
|
|
|
|
2023-09-05 17:04:37 +00:00
|
|
|
int findXIndexByPosition(
|
|
|
|
const Data::StatisticalChart &chartData,
|
|
|
|
const Limits &xPercentageLimits,
|
|
|
|
const QRect &rect,
|
|
|
|
float64 x) override;
|
|
|
|
|
2023-08-27 21:44:50 +00:00
|
|
|
[[nodiscard]] HeightLimits heightLimits(
|
|
|
|
Data::StatisticalChart &chartData,
|
|
|
|
Limits xIndices) override;
|
|
|
|
|
2023-08-27 22:17:30 +00:00
|
|
|
private:
|
2023-09-19 10:02:50 +00:00
|
|
|
void paintChartAndSelected(QPainter &p, const PaintContext &c);
|
2023-09-08 09:15:35 +00:00
|
|
|
|
2023-08-27 22:17:30 +00:00
|
|
|
struct {
|
|
|
|
Limits full;
|
|
|
|
std::vector<int> ySum;
|
|
|
|
SegmentTree ySumSegmentTree;
|
|
|
|
} _cachedHeightLimits;
|
|
|
|
|
2023-09-08 09:15:35 +00:00
|
|
|
Limits _lastPaintedXIndices;
|
|
|
|
int _lastSelectedXIndex = -1;
|
|
|
|
float64 _lastSelectedXProgress = 0;
|
|
|
|
|
2023-08-27 21:44:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Statistic
|