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
12 class Proportional {
13 protected:
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
36 public:
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
Proportional class. Do the most work in all 2D plot figures.
Definition proportional.hpp:12
Proportional::drawLegend
void drawLegend(wxDC &dc)
This function will draw the legend. Call this function after you have drawn the plot type.
Definition proportional.cpp:237
Proportional::setFontSize
void setFontSize(const unsigned int fontSize)
Set the size of the fonts.
Definition proportional.cpp:20
Proportional::setWxPlotType
void setWxPlotType(const WXPLOT_TYPE wxPlotType)
Set the plot type selection.
Definition proportional.cpp:63
Proportional::legend
std::vector< wxString > legend
Vector of labels for the legend.
Definition proportional.hpp:32
Proportional::ticks
unsigned int ticks
The number of ticks at the figure in all axis.
Definition proportional.hpp:26
Proportional::minY
double minY
Minimum value of data in Y-axis.
Definition proportional.hpp:22
Proportional::setTicks
void setTicks(const unsigned int ticks)
Set the number of ticks at the figure in all axis.
Definition proportional.cpp:24
Proportional::gridOn
void gridOn(const bool useGrid)
Enable grid on the figure.
Definition proportional.cpp:28
Proportional::getPlotStartHeight
wxCoord getPlotStartHeight() const
Get the recalculated start height Y-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:76
Proportional::setPlotEndHeight
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
Proportional::legendPosition
PLACEMENT legendPosition
Location of the legend.
Definition proportional.hpp:33
Proportional::title
wxString title
Title of the plot type.
Definition proportional.hpp:29
Proportional::wxPlotType
WXPLOT_TYPE wxPlotType
Plot type selection.
Definition proportional.hpp:34
Proportional::getPlotStartWidth
wxCoord getPlotStartWidth() const
Get the recalculated start width X-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:72
Proportional::setXlabel
void setXlabel(const wxString &xLabel)
Set the name of the X-label.
Definition proportional.cpp:36
Proportional::plotStartHeight
wxCoord plotStartHeight
Location of left upper corner in Y-axis.
Definition proportional.hpp:18
Proportional::useGrid
bool useGrid
Flag for using grid or not.
Definition proportional.hpp:27
Proportional::legendOn
void legendOn(const bool useLegend)
Activate the legend.
Definition proportional.cpp:44
Proportional::plotStartWidth
wxCoord plotStartWidth
Location of left upper corner in X-axis.
Definition proportional.hpp:17
Proportional::setData
void setData(const std::vector< std::vector< double > > &data2D)
Set 2D data.
Definition proportional.cpp:53
Proportional::setYlabel
void setYlabel(const wxString &yLabel)
Set the name of the Y-label.
Definition proportional.cpp:40
Proportional::setTitle
void setTitle(const wxString &title)
Set the title of the plot.
Definition proportional.cpp:32
Proportional::getPlotEndWidth
wxCoord getPlotEndWidth() const
Get the recalculated end width X-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:80
Proportional::plotEndHeight
wxCoord plotEndHeight
Location of right bottom corner in Y-axis.
Definition proportional.hpp:16
Proportional::setYlim
void setYlim(const double minY, const double maxY)
Set the plot zoom limit in Y-axis.
Definition proportional.cpp:67
Proportional::maxX
double maxX
Maximum value of data in X-axis.
Definition proportional.hpp:21
Proportional::plotEndWidth
wxCoord plotEndWidth
Location of right upper corner in X-axis.
Definition proportional.hpp:15
Proportional::drawGrid
void drawGrid(wxDC &dc)
This function will draw the grid. Call this function after you have drawn the plot type.
Definition proportional.cpp:210
Proportional::setPlotStartWidth
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
Proportional::useLegend
bool useLegend
Flag for using legend or not.
Definition proportional.hpp:28
Proportional::setPlotEndWidth
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
Proportional::fontSize
unsigned int fontSize
The size of the all fonts.
Definition proportional.hpp:25
Proportional::setLegend
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
Proportional::getPlotEndHeight
wxCoord getPlotEndHeight() const
Get the recalculated end height Y-axis value. This value is recalculated after the figure is drawn.
Definition proportional.cpp:84
Proportional::xLabel
wxString xLabel
Label under the plot type.
Definition proportional.hpp:30
Proportional::drawTicks
void drawTicks(wxDC &dc)
This function will draw the ticks. Call this function after you have drawn the plot type.
Definition proportional.cpp:161
Proportional::minX
double minX
Minimum value of data in X-axis.
Definition proportional.hpp:20
Proportional::maxY
double maxY
Maximum value of data in Y-axis.
Definition proportional.hpp:23
Proportional::yLabel
wxString yLabel
Label on the left side of the plot type.
Definition proportional.hpp:31
Proportional::drawFigure
void drawFigure(wxDC &dc)
This function will do the following:
Definition proportional.cpp:88
Proportional::setPlotStartHeight
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