GlistEngine
Loading...
Searching...
No Matches
gGUIRadarChart.h
Go to the documentation of this file.
1/*
2 * gGUIRadarChart.h
3 *
4 * Created on: Jul 27, 2022
5 * Author: emirhantasdeviren
6 */
7
8#ifndef UI_GGUIRADARCHART_H_
9#define UI_GGUIRADARCHART_H_
10
11#include "gGUIControl.h"
12
13/*
14 * A radar chart is a graphical method for displaying multivariate data.
15 */
17public:
19 virtual ~gGUIRadarChart();
20
21 void draw() override;
22 void update() override;
23
24 /*
25 * Sets specified quantitative variable of the specified dataset.
26 *
27 * @param i Dataset index.
28 * @param j Axis index.
29 * @param value Quantitative data.
30 */
31 void setValue(std::size_t i, std::size_t j, float value);
32
33 /*
34 * Sets color of given dataset.
35 *
36 * @param i Dataset index.
37 * @param color An RGB color.
38 */
39 void setColor(std::size_t i, const gColor &color);
40
41 /*
42 * Sets label of specified axis.
43 *
44 * @param i Axis index.
45 * @param label A text label.
46 */
47 void setLabel(std::size_t i, const std::string &label);
48
49 /*
50 * Sets grid visibility.
51 *
52 * @param enable Grid visibility state.
53 */
54 void setGrid(bool enable);
55
56 /*
57 * Sets grid size, number of polygons inside chart.
58 *
59 * @param new_size Grid size.
60 */
61 void setGridSize(std::size_t new_size);
62
63 /*
64 * Sets number of datasets.
65 *
66 * @param new_size Number of dataset.
67 */
68 void setNumDataset(std::size_t new_size);
69
70 /*
71 * Sets number of quantitative variables, number of axes.
72 *
73 * @param new_size Number of variables.
74 */
75 void setNumAxes(std::size_t new_size);
76
77 /*
78 * Sets minimum value of datasets. Defaults to 0.
79 *
80 * @param min A minimum value.
81 */
82 void setMin(float min);
83
84 /*
85 * Sets maximum value of datasets. Defaults to 1.
86 *
87 * @param max A maximum value.
88 */
89 void setMax(float max);
90
91private:
92 struct gDataset {
93 std::vector<float> values;
94 gColor color;
95 };
96
97 void drawBase();
98 void drawChart();
99
100 void calcVertices();
101
102 std::vector<gDataset> datasets;
103 std::vector<gVertex> vertices;
104 std::vector<std::vector<gVertex>> grids;
105 bool is_grid_enabled;
106 std::vector<std::string> labels;
107 gVertex center;
108 float min;
109 float max;
110};
111
112#endif /* UI_GGUIRADARCHART_H_ */
Definition gColor.h:17
Definition gGUIControl.h:29
Definition gGUIRadarChart.h:16
void setMin(float min)
void setGrid(bool enable)
void setLabel(std::size_t i, const std::string &label)
void setColor(std::size_t i, const gColor &color)
void setNumDataset(std::size_t new_size)
void setNumAxes(std::size_t new_size)
void setMax(float max)
void update() override
virtual ~gGUIRadarChart()
void setGridSize(std::size_t new_size)
void draw() override
void setValue(std::size_t i, std::size_t j, float value)
Definition gVbo.h:14