GlistEngine
Loading...
Searching...
No Matches
gGUIColumnChart.h
Go to the documentation of this file.
1/*
2 * gGUIColumnChart.h
3 *
4 * Created on: 11 Ağu 2022
5 * Author: Batuhan
6 *-------------------------------------------------------------------------------------------------------------------------------------------------------------------
7 * HOW TO USE
8 * First, create an object of this class on the canvas.
9 * Then call the class's setChartProp method using this object.
10 * Enter the expected values ​​respectively as parameters of this method. Parameter description below.
11 * -chartx and charty variables set position of x and y axis.
12 * -chartw and charth variables set width and height of x and y axis.
13 * -columnsw is width of the columns (both normal column and multi columns)
14 * -columnsmargin is distance of between columns.(is the distance between multi columns and other multi columns for multicolumns)
15 * -chartnumberrange is the value range on on the y-axis.The value you enter will be printed as equal divisions from 0 to the number you enter.
16 * After that you can add single columns by using addColumn function. Parameter description below.
17 * -columnh is the height of the column which you add.
18 * -color is the color of the column. (Example usage on the canvas : , gColor(100, 100, 100) )
19 * If you want to create multicolumn group, you can use addMultiColumn function. Parameter description below.
20 * -(ATTENTION) columnnum is how many column that you want to add to group (max limit 4 column for now).
21 * This parameter provides that x location of last columns which you specified in multicolum group is calculated automatically.
22 * So, even If you are going to enter a value of 0 to your column, please enter to the columnum parameter by counting the column which you value 0.
23 * If you want to add fewer than 4 column, after you write columnum, you have to write 0 again other columnh which you don't want to add.
24 * ***thus, the width of the column which you don't want to add is not calculated for margin.***
25 * -columnh ,columnh2, columnh3, columnh4 are the heights of the columns in the group.
26 * -The next 4 color parameters specify the colors of the columns, respectively.
27 * Even if you are going to create less than 4 columns, enter a gColor value for these 4 parameters.
28 * -title parameter is what typing under multi columns group.
29 * -multicolumnspadding is a parameter where you specify how much space you want between multi columns group.
30 * Finally, you can set visibility of additions. (Ex : visibility of grid lines, numbers on y-axis or text under x-axis).
31 * -Parameters are girlineison, numberison, textison. (Event you don't use this method, values ​​will be accepted TRUE).
32 *
33 *
34 */
35
36#ifndef UI_GGUICOLUMNCHART_H_
37#define UI_GGUICOLUMNCHART_H_
38
39#include "gGUIControl.h"
40
42public:
45
46 void draw();
47 void mouseMoved(int x, int y);
48 void setChartProp(int chartx, int charty, int chartw, int charth, int columnsw, int columnsmargin, int chartnumberrange); //number range : 0 - chartnumberrange
49 void setChartProp(int chartX, int chartY, int chartW, int chartH, int columnsW, int columnsMargin, int minNumRangeX, int maxNumRangeX, int minNumRangeY, int maxNumRangeY); //overloaded
50 void addColumn(int columnh, gColor color);
51 void addMultiColumn(int columnum = 1, int columnh = 0, int columnh2 = 0, int columnh3 = 0, int columnh4 = 0, gColor color = {100, 100, 100}, gColor color2 = {100, 100, 100}, gColor color3 = {100, 100, 100}, gColor color4 = {100, 100, 100}, std::string title = "", int multicolumnspadding = 0);
52 void setVisibility(bool gridlineison = 1, bool numbersison = 1, bool textison = 1);
53 void clear();
54private:
55 int chartw, charth;
56 int chartx, charty;
57 int columnh;
58 int columnx, columny;
59 int multicolumnx, multicolumny;
60 int indexcolumn;
61 int indexmulticolumn;
62 int initialmcspadding;
63 int columnsw;
64 int chartaspect;
65 int chartliney;
66 int numberrange;
67 int numberrangey;
68 int numberrangeaspect;
69 int colorindex;
70 int columnnumber;
71 int columnsmargin;
72 int minnumrangex, maxnumrangex;
73 int minnumrangey, maxnumrangey;
74 int multicolumnspadding;
75 bool gridlineison, numbersison, textison;
76 std::string numbersinchart;
77 std::vector<int> columnhe;
78 std::vector<int> columnxe;
79 std::vector<std::vector<int>> multicolumnh;
80 std::vector<int> multicolumnxe;
81 std::vector<std::vector<int>> singlecolumscolor;
82 std::vector<std::vector<int>> multicolumscolor;
83 std::vector<std::string> textvector;
84 std::vector<int> multicolumnspaddingvector;
85
86 void drawColumns();
87 void drawMultiColumns();
88 void drawLinesAndNumbers();
89};
90
91#endif /* UI_GGUICOLUMNCHART_H_ */
std::string title
Definition gBaseGUIObject.h:145
Definition gColor.h:17
Definition gGUIColumnChart.h:41
void setChartProp(int chartx, int charty, int chartw, int charth, int columnsw, int columnsmargin, int chartnumberrange)
void mouseMoved(int x, int y)
void addMultiColumn(int columnum=1, int columnh=0, int columnh2=0, int columnh3=0, int columnh4=0, gColor color={100, 100, 100}, gColor color2={100, 100, 100}, gColor color3={100, 100, 100}, gColor color4={100, 100, 100}, std::string title="", int multicolumnspadding=0)
void addColumn(int columnh, gColor color)
virtual ~gGUIColumnChart()
void setChartProp(int chartX, int chartY, int chartW, int chartH, int columnsW, int columnsMargin, int minNumRangeX, int maxNumRangeX, int minNumRangeY, int maxNumRangeY)
void setVisibility(bool gridlineison=1, bool numbersison=1, bool textison=1)
Definition gGUIControl.h:29