wxPlot 1.8
Real time plot library for wxWidgets
Loading...
Searching...
No Matches
proportional.hpp
1#pragma once
2
3#include <string>
4#include <vector>
5#include <wx/wx.h>
6#include "../../../plottools/plottools.hpp"
7
13protected:
14 // General plot information
15 wxCoord plotEndWidth = 0;
16 wxCoord plotEndHeight = 0;
17 wxCoord plotStartWidth = 0;
18 wxCoord plotStartHeight = 0;
19
20 double minX = 0;
21 double maxX = 0;
22 double minY = 0;
23 double maxY = 0;
24
25 unsigned int fontSize = 0;
26 unsigned int ticks = 0;
27 bool useGrid = false;
28 bool useLegend = false;
29 wxString title;
30 wxString xLabel;
31 wxString yLabel;
32 std::vector<wxString> legend;
33 PLACEMENT legendPosition = PLACEMENT_NORTH_WEST;
34 WXPLOT_TYPE wxPlotType = WXPLOT_TYPE_LINE;
35
36public:
37
42 void setWxPlotType(const WXPLOT_TYPE wxPlotType);
43
48 void setFontSize(const unsigned int fontSize);
49
54 void setTitle(const wxString& title);
55
60 void setXlabel(const wxString& xLabel);
61
66 void setYlabel(const wxString& yLabel);
67
72 void setTicks(const unsigned int ticks);
73
78 void gridOn(const bool useGrid);
79
98 void setPlotStartWidth(const wxCoord plotStartWidth);
99
118 void setPlotStartHeight(const wxCoord plotStartHeight);
119
138 void setPlotEndWidth(const wxCoord plotEndWidth);
139
158 void setPlotEndHeight(const wxCoord plotEndHeight);
159
164 void setData(const std::vector<std::vector<double>>& data2D);
165
170 void setData(const std::vector<double>& data1D);
171
176 void legendOn(const bool useLegend);
177
183 void setLegend(const std::vector<wxString>& legend, const PLACEMENT legendPosition = PLACEMENT_NORTH_EAST);
184
190 void setYlim(const double minY, const double maxY);
191
197 wxCoord getPlotStartWidth() const;
198
204 wxCoord getPlotEndWidth() const;
205
211 wxCoord getPlotStartHeight() const;
212
218 wxCoord getPlotEndHeight() const;
219
230 void drawFigure(wxDC& dc);
231
237 void drawGrid(wxDC& dc);
238
244 void drawTicks(wxDC& dc);
245
251 void drawLegend(wxDC& dc);
252
253};
Proportional class. Do the most work in all 2D plot figures.
Definition proportional.hpp:12
void drawLegend(wxDC &dc)
This function will draw the legend. Call this function after you have drawn the plot type.
Definition proportional.cpp:237
void setFontSize(const unsigned int fontSize)
Set the size of the fonts.
Definition proportional.cpp:20
void setWxPlotType(const WXPLOT_TYPE wxPlotType)
Set the plot type selection.
Definition proportional.cpp:63
std::vector< wxString > legend
Vector of labels for the legend.
Definition proportional.hpp:32
unsigned int ticks
The number of ticks at the figure in all axis.
Definition proportional.hpp:26
double minY
Minimum value of data in Y-axis.
Definition proportional.hpp:22
void setTicks(const unsigned int ticks)
Set the number of ticks at the figure in all axis.
Definition proportional.cpp:24
void gridOn(const bool useGrid)
Enable grid on the figure.
Definition proportional.cpp:28
wxCoord getPlotStartHeight() const
Get the recalculated start height Y-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:76
void setPlotEndHeight(const wxCoord plotEndHeight)
Set the right bottom corner in Y-axis. Inside this rectangle, the plot is drawn. NOTE: This value is ...
Definition proportional.cpp:16
PLACEMENT legendPosition
Location of the legend.
Definition proportional.hpp:33
wxString title
Title of the plot type.
Definition proportional.hpp:29
WXPLOT_TYPE wxPlotType
Plot type selection.
Definition proportional.hpp:34
wxCoord getPlotStartWidth() const
Get the recalculated start width X-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:72
void setXlabel(const wxString &xLabel)
Set the name of the X-label.
Definition proportional.cpp:36
wxCoord plotStartHeight
Location of left upper corner in Y-axis.
Definition proportional.hpp:18
bool useGrid
Flag for using grid or not.
Definition proportional.hpp:27
void legendOn(const bool useLegend)
Activate the legend.
Definition proportional.cpp:44
wxCoord plotStartWidth
Location of left upper corner in X-axis.
Definition proportional.hpp:17
void setData(const std::vector< std::vector< double > > &data2D)
Set 2D data.
Definition proportional.cpp:53
void setYlabel(const wxString &yLabel)
Set the name of the Y-label.
Definition proportional.cpp:40
void setTitle(const wxString &title)
Set the title of the plot.
Definition proportional.cpp:32
wxCoord getPlotEndWidth() const
Get the recalculated end width X-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:80
wxCoord plotEndHeight
Location of right bottom corner in Y-axis.
Definition proportional.hpp:16
void setYlim(const double minY, const double maxY)
Set the plot zoom limit in Y-axis.
Definition proportional.cpp:67
double maxX
Maximum value of data in X-axis.
Definition proportional.hpp:21
wxCoord plotEndWidth
Location of right upper corner in X-axis.
Definition proportional.hpp:15
void drawGrid(wxDC &dc)
This function will draw the grid. Call this function after you have drawn the plot type.
Definition proportional.cpp:210
void setPlotStartWidth(const wxCoord plotStartWidth)
Set the left upper corner in X-axis. Inside this rectangle, the plot is drawn. NOTE: This value is re...
Definition proportional.cpp:4
bool useLegend
Flag for using legend or not.
Definition proportional.hpp:28
void setPlotEndWidth(const wxCoord plotEndWidth)
Set the right upper corner in X-axis. Inside this rectangle, the plot is drawn. NOTE: This value is r...
Definition proportional.cpp:12
unsigned int fontSize
The size of the all fonts.
Definition proportional.hpp:25
void setLegend(const std::vector< wxString > &legend, const PLACEMENT legendPosition=PLACEMENT_NORTH_EAST)
Set the labels and placement for the legend.
Definition proportional.cpp:48
wxCoord getPlotEndHeight() const
Get the recalculated end height Y-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:84
wxString xLabel
Label under the plot type.
Definition proportional.hpp:30
void drawTicks(wxDC &dc)
This function will draw the ticks. Call this function after you have drawn the plot type.
Definition proportional.cpp:161
double minX
Minimum value of data in X-axis.
Definition proportional.hpp:20
double maxY
Maximum value of data in Y-axis.
Definition proportional.hpp:23
wxString yLabel
Label on the left side of the plot type.
Definition proportional.hpp:31
void drawFigure(wxDC &dc)
This function will do the following:
Definition proportional.cpp:88
void setPlotStartHeight(const wxCoord plotStartHeight)
Set the left upper corner in Y-axis. Inside this rectangle, the plot is drawn. NOTE: This value is re...
Definition proportional.cpp:8