1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-16 10:19:47 +02:00
vcmi/client/mainmenu/CStatisticScreen.h

50 lines
1.4 KiB
C++
Raw Normal View History

2024-08-11 22:44:16 +02:00
/*
* CStatisticScreen.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../windows/CWindowObject.h"
2024-08-11 23:50:16 +02:00
#include "../../lib/gameState/GameStatistics.h"
2024-08-11 22:44:16 +02:00
class FilledTexturePlayerColored;
2024-08-12 02:56:33 +02:00
class CToggleButton;
2024-08-12 20:14:36 +02:00
class GraphicalPrimitiveCanvas;
class LineChart;
2024-08-13 00:17:12 +02:00
class CGStatusBar;
2024-08-11 22:44:16 +02:00
class CStatisticScreen : public CWindowObject
{
std::shared_ptr<FilledTexturePlayerColored> filledBackground;
2024-08-12 01:07:58 +02:00
std::vector<std::shared_ptr<CIntObject>> layout;
2024-08-12 02:56:33 +02:00
std::shared_ptr<CToggleButton> buttonCsvSave;
2024-08-12 01:19:00 +02:00
StatisticDataSet statistic;
2024-08-12 20:14:36 +02:00
std::shared_ptr<LineChart> chart;
2024-08-12 21:47:59 +02:00
std::map<ColorRGBA, std::vector<float>> extractData(StatisticDataSet stat, std::function<float(StatisticDataSetEntry val)> selector);
2024-08-11 22:44:16 +02:00
public:
2024-08-12 01:19:00 +02:00
CStatisticScreen(StatisticDataSet stat);
2024-08-11 22:54:19 +02:00
};
2024-08-12 20:14:36 +02:00
class LineChart : public CIntObject
{
std::shared_ptr<GraphicalPrimitiveCanvas> canvas;
std::vector<std::shared_ptr<CIntObject>> layout;
2024-08-13 00:17:12 +02:00
std::shared_ptr<CGStatusBar> statusBar;
Rect chartArea;
float maxVal;
int maxDay;
void updateStatusBar(const Point & cursorPosition);
2024-08-12 20:14:36 +02:00
public:
2024-08-12 21:47:59 +02:00
LineChart(Rect position, std::string title, std::map<ColorRGBA, std::vector<float>> data);
2024-08-13 00:17:12 +02:00
void mouseMoved(const Point & cursorPosition, const Point & lastUpdateDistance) override;
void clickPressed(const Point & cursorPosition) override;
2024-08-12 20:14:36 +02:00
};