2023-09-29 13:32:07 +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
|
|
|
|
|
|
|
|
#include "statistics/segment_tree.h"
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
struct StatisticalChart {
|
|
|
|
StatisticalChart() = default;
|
|
|
|
|
|
|
|
[[nodiscard]] bool empty() const {
|
|
|
|
return lines.empty();
|
|
|
|
}
|
|
|
|
[[nodiscard]] explicit operator bool() const {
|
|
|
|
return !empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void measure();
|
|
|
|
|
|
|
|
[[nodiscard]] QString getDayString(int i) const;
|
|
|
|
|
2023-10-02 13:43:11 +00:00
|
|
|
[[nodiscard]] int findStartIndex(float64 v) const;
|
|
|
|
[[nodiscard]] int findEndIndex(int left, float64 v) const;
|
|
|
|
[[nodiscard]] int findIndex(int left, int right, float64 v) const;
|
2023-09-29 13:32:07 +00:00
|
|
|
|
|
|
|
struct Line final {
|
|
|
|
std::vector<int> y;
|
|
|
|
|
|
|
|
Statistic::SegmentTree segmentTree;
|
|
|
|
int id = 0;
|
|
|
|
QString idString;
|
|
|
|
QString name;
|
|
|
|
int maxValue = 0;
|
|
|
|
int minValue = std::numeric_limits<int>::max();
|
|
|
|
QString colorKey;
|
|
|
|
QColor color;
|
|
|
|
QColor colorDark;
|
2023-10-04 02:06:58 +00:00
|
|
|
bool isHiddenOnStart = false;
|
2023-09-29 13:32:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<float64> x;
|
|
|
|
std::vector<float64> xPercentage;
|
|
|
|
std::vector<QString> daysLookup;
|
|
|
|
|
|
|
|
std::vector<Line> lines;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
float64 min = 0.;
|
|
|
|
float64 max = 0.;
|
|
|
|
} defaultZoomXIndex;
|
|
|
|
|
|
|
|
int maxValue = 0;
|
|
|
|
int minValue = std::numeric_limits<int>::max();
|
|
|
|
|
|
|
|
float64 oneDayPercentage = 0.;
|
|
|
|
|
|
|
|
float64 timeStep = 0.;
|
|
|
|
|
2023-10-04 00:35:38 +00:00
|
|
|
bool isFooterHidden = false;
|
2023-10-05 15:45:48 +00:00
|
|
|
bool hasPercentages = false;
|
2023-10-11 04:03:49 +00:00
|
|
|
bool weekFormat = false;
|
2023-10-04 00:35:38 +00:00
|
|
|
|
2023-09-29 13:32:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StatisticalGraph final {
|
|
|
|
StatisticalChart chart;
|
|
|
|
QString zoomToken;
|
|
|
|
QString error;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Data
|