14 #ifndef MATHPLOT_H_INCLUDED 15 #define MATHPLOT_H_INCLUDED 17 #define MATHPLOT_MANY_YAXIS 61 #ifdef mathplot_EXPORTS 62 #define WXDLLIMPEXP_MATHPLOT WXEXPORT 63 #define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type 64 #else // not making DLL 65 #define WXDLLIMPEXP_MATHPLOT 66 #define WXDLLIMPEXP_DATA_MATHPLOT(type) type 69 #if defined(__GNUG__) && !defined(__APPLE__) && !defined(__INTEL_CLANG_COMPILER) 70 #pragma interface "mathplot.h" 80 #include <wx/scrolwin.h> 82 #include <wx/dynarray.h> 84 #include <wx/dcmemory.h> 85 #include <wx/string.h> 95 #ifdef ENABLE_MP_CONFIG 96 #include "MathPlotConfig.h" 97 #endif // ENABLE_MP_CONFIG 104 #ifdef ENABLE_MP_NAMESPACE 106 #endif // ENABLE_MP_NAMESPACE 108 #ifdef ENABLE_MP_DEBUG 113 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) 115 #define DEBUG_NEW new 118 #endif // ENABLE_MP_DEBUG 121 #define X_BORDER_SEPARATION 40 122 #define Y_BORDER_SEPARATION 60 125 #define mpX_LOCALTIME 0x10 127 #define mpX_UTCTIME 0x20 128 #define mpX_RAWTIME mpX_UTCTIME 132 #define ISNOTNULL(x) (fabs(x) > EPSILON) 135 #define EXTRA_MARGIN 8 137 #define ZOOM_AROUND_CENTER -1 143 class WXDLLIMPEXP_MATHPLOT
mpLayer;
145 class WXDLLIMPEXP_MATHPLOT
mpLine;
148 class WXDLLIMPEXP_MATHPLOT
mpFX;
149 class WXDLLIMPEXP_MATHPLOT
mpFY;
150 class WXDLLIMPEXP_MATHPLOT
mpFXY;
153 class WXDLLIMPEXP_MATHPLOT
mpChart;
155 class WXDLLIMPEXP_MATHPLOT
mpScale;
156 class WXDLLIMPEXP_MATHPLOT
mpScaleX;
157 class WXDLLIMPEXP_MATHPLOT
mpScaleY;
161 class WXDLLIMPEXP_MATHPLOT
mpWindow;
162 class WXDLLIMPEXP_MATHPLOT
mpText;
163 class WXDLLIMPEXP_MATHPLOT
mpTitle;
170 #ifdef ENABLE_MP_CONFIG 172 #endif // ENABLE_MP_CONFIG 211 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer 212 bool operator==(
const mpRange&)
const =
default;
214 bool operator==(
const mpRange& other)
const 216 return min == other.min && max == other.max;
231 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer 232 bool operator==(
const mpAxisData&)
const =
default;
234 bool operator==(
const mpAxisData& other)
const 236 return scale == other.scale && pos == other.pos;
353 #ifdef ENABLE_MP_CONFIG 355 #endif // ENABLE_MP_CONFIG 362 typedef enum __mp_Location_Type
370 mpMarginBottomCenter,
377 typedef enum __XAxis_Align_Type
379 mpALIGN_BORDER_BOTTOM = 10,
387 typedef enum __YAxis_Align_Type
389 mpALIGN_BORDER_LEFT = 20,
397 typedef enum __Plot_Align_Name_Type
406 typedef enum __mp_Style_Type
414 typedef enum __mp_Direction_Type
420 typedef enum __Symbol_Type
436 typedef enum __Info_Type
445 typedef enum __Text_Type
452 typedef enum __Function_Type
464 typedef enum __Scale_Type
472 typedef enum __Chart_Type
480 enum mpMouseButtonAction
490 typedef enum __mp_Layer_Type
507 typedef enum __mp_Layer_ZOrder
529 class WXDLLIMPEXP_MATHPLOT mpLayer:
public wxObject
532 mpLayer(mpLayerType layerType);
580 virtual bool IsLayerType(mpLayerType typeOfInterest,
int *subtype)
582 *subtype = m_subtype;
583 return (m_type == typeOfInterest);
698 m_fontcolour = colour;
729 if (brush == wxNullBrush)
730 m_brush = *wxTRANSPARENT_BRUSH;
760 m_drawOutsideMargins = drawModeOutside;
767 return m_drawOutsideMargins;
774 wxBitmap GetColourSquare(
int side = 16);
822 m_CanDelete = canDelete;
840 const mpLayerType m_type;
844 wxColour m_fontcolour;
849 bool m_drawOutsideMargins;
855 mpLayerZOrder m_ZIndex;
859 void UpdateContext(wxDC &dc)
const;
865 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
882 void CheckLog(
double *x,
double *y,
int yID);
888 wxDECLARE_DYNAMIC_CLASS(mpLayer);
900 class WXDLLIMPEXP_MATHPLOT mpInfoLayer:
public mpLayer
910 mpInfoLayer(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
913 virtual ~mpInfoLayer();
917 virtual void SetVisible(
bool show);
923 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
935 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
940 virtual bool Inside(
const wxPoint &point);
944 virtual void Move(wxPoint delta);
947 virtual void UpdateReference();
953 return m_dim.GetPosition();
960 return m_dim.GetSize();
974 m_location = location;
987 wxBitmap* m_info_bmp;
990 mpLocation m_location;
996 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1000 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
1002 wxDECLARE_DYNAMIC_CLASS(mpInfoLayer);
1009 class WXDLLIMPEXP_MATHPLOT mpInfoCoords:
public mpInfoLayer
1016 mpInfoCoords(mpLocation location);
1022 mpInfoCoords(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
1033 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
1035 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
1042 m_timeConv = time_conv;
1049 m_series_coord = show;
1056 return m_series_coord;
1064 virtual wxString GetInfoCoordsText(
mpWindow &w,
double xVal, std::vector<double> yValList);
1075 unsigned int m_labelType;
1076 unsigned int m_timeConv;
1079 bool m_series_coord;
1086 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1088 wxDECLARE_DYNAMIC_CLASS(mpInfoCoords);
1095 class WXDLLIMPEXP_MATHPLOT mpInfoLegend:
public mpInfoLayer
1106 mpInfoLegend(wxRect rect,
const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1116 m_needs_update =
true;
1119 mpLegendStyle GetItemMode()
const 1128 m_item_direction = mode;
1129 m_needs_update =
true;
1132 mpLegendDirection GetItemDirection()
const 1134 return m_item_direction;
1137 void SetNeedUpdate()
1139 m_needs_update =
true;
1143 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1146 mpLegendStyle m_item_mode;
1147 mpLegendDirection m_item_direction;
1153 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1159 unsigned int layerIdx;
1163 std::vector<LegendDetail> m_LegendDetailList;
1164 bool m_needs_update;
1175 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1177 wxDECLARE_DYNAMIC_CLASS(mpInfoLegend);
1189 class WXDLLIMPEXP_MATHPLOT mpScale:
public mpLayer
1196 mpScale(
const wxString &name,
int flags,
bool grids);
1238 m_labelFormat = format;
1245 return m_labelFormat;
1269 m_auto = automaticScalingIsEnabled;
1280 void SetMinScale(
double min)
1285 double GetMinScale()
const 1290 void SetMaxScale(
double max)
1295 double GetMaxScale()
const 1308 virtual void SetLogAxis(
bool log)
1314 static const wxCoord kTickSize = 4;
1315 static const wxCoord kAxisExtraSpace = 6;
1321 double m_min, m_max;
1322 wxString m_labelFormat;
1325 virtual int GetOrigin(
mpWindow &w) = 0;
1333 double GetStep(
double scale,
int minLabelSpacing);
1334 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
1336 wxString FormatLogValue(
double n);
1338 wxDECLARE_DYNAMIC_CLASS(mpScale);
1342 #define mpX_NORMAL 0x00 1345 #define mpX_TIME 0x01 1347 #define mpX_HOURS 0x02 1349 #define mpX_DATE 0x03 1351 #define mpX_DATETIME 0x04 1353 #define mpX_USER 0x05 1355 #define mpX_NONE 0x06 1362 class WXDLLIMPEXP_MATHPLOT mpScaleX:
public mpScale
1370 mpScaleX(
const wxString &name = _T(
"X"),
int flags = mpALIGN_CENTERX,
bool grids =
false,
unsigned int type = mpX_NORMAL) :
1371 mpScale(name, flags, grids)
1373 m_subtype = mpsScaleX;
1375 m_timeConv = mpX_RAWTIME;
1381 m_labelType = mpX_USER;
1396 m_timeConv = time_conv;
1400 unsigned int m_labelType;
1401 unsigned int m_timeConv;
1405 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1412 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
1414 virtual int GetOrigin(
mpWindow &w);
1415 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
1416 wxString FormatValue(
const wxString &fmt,
double n);
1418 wxDECLARE_DYNAMIC_CLASS(mpScaleX);
1427 class WXDLLIMPEXP_MATHPLOT mpScaleY:
public mpScale
1434 mpScaleY(
const wxString &name = _T(
"Y"),
int flags = mpALIGN_CENTERY,
bool grids =
false) :
1435 mpScale(name, flags, grids)
1437 m_subtype = mpsScaleY;
1438 m_axisWidth = Y_BORDER_SEPARATION;
1439 m_axisID = m_LastYAxisID++;
1484 return ((GetAlign() == mpALIGN_BORDER_LEFT) || (GetAlign() == mpALIGN_LEFT));
1489 return ((GetAlign() == mpALIGN_BORDER_RIGHT) || (GetAlign() == mpALIGN_RIGHT));
1492 bool IsInside(wxCoord xPixel)
1494 if ( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
1511 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1513 virtual int GetOrigin(
mpWindow &w);
1514 wxString GetLabelFormat(
mpWindow &w);
1515 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
1516 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
1518 wxDECLARE_DYNAMIC_CLASS(mpScaleY);
1532 class WXDLLIMPEXP_MATHPLOT
mpFunction:
public mpLayer
1537 mpFunction(mpLayerType layerType = mpLAYER_PLOT,
const wxString &name = wxEmptyString, mpScaleY *yAxisUsed = NULL);
1544 m_continuous = continuity;
1552 return m_continuous;
1587 m_symbolSize = size;
1588 m_symbolSize2 = size / 2;
1595 return m_symbolSize;
1601 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1617 if (yAxisUsed == NULL)
1619 if (m_yAxis != NULL)
1621 m_yAxis->UpdateUseCount(
false);
1628 if (m_yAxisID != yAxisUsed->
GetAxisID())
1631 m_yAxis->UpdateUseCount(
false);
1634 m_yAxis = yAxisUsed;
1644 unsigned int m_step;
1646 mpScaleY *m_yAxis = NULL;
1654 return (m_yAxisID != -1);
1662 class WXDLLIMPEXP_MATHPLOT mpLine:
public mpFunction 1665 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1693 return m_IsHorizontal;
1698 bool m_IsHorizontal;
1700 wxDECLARE_DYNAMIC_CLASS(mpLine);
1705 class WXDLLIMPEXP_MATHPLOT mpHorizontalLine:
public mpLine
1708 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN, mpScaleY *yAxisUsed = NULL);
1720 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1722 wxDECLARE_DYNAMIC_CLASS(mpHorizontalLine);
1727 class WXDLLIMPEXP_MATHPLOT mpVerticalLine:
public mpLine
1730 mpVerticalLine(
double xvalue,
const wxPen &pen = *wxGREEN_PEN);
1742 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1744 wxDECLARE_DYNAMIC_CLASS(mpVerticalLine);
1753 class WXDLLIMPEXP_MATHPLOT mpFX:
public mpFunction 1759 mpFX(
const wxString &name = wxEmptyString,
int flags = mpALIGN_RIGHT, mpScaleY *yAxisUsed = NULL);
1766 virtual double GetY(
double x) = 0;
1772 double DoGetY(
double x);
1778 void DefineDoGetY(
void);
1783 double (mpFX::*pDoGetY)(
double x);
1789 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1794 double NormalDoGetY(
double x);
1795 double LogDoGetY(
double x);
1797 wxDECLARE_DYNAMIC_CLASS(mpFX);
1806 class WXDLLIMPEXP_MATHPLOT mpFY:
public mpFunction 1812 mpFY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP, mpScaleY *yAxisUsed = NULL);
1819 virtual double GetX(
double y) = 0;
1825 double DoGetX(
double y);
1831 void DefineDoGetX(
void);
1836 double (mpFY::*pDoGetX)(
double y);
1842 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1847 double NormalDoGetX(
double y);
1848 double LogDoGetX(
double y);
1850 wxDECLARE_DYNAMIC_CLASS(mpFY);
1862 class WXDLLIMPEXP_MATHPLOT mpFXY:
public mpFunction 1868 mpFXY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false, mpScaleY *yAxisUsed = NULL);
1873 virtual void Rewind() = 0;
1897 virtual bool GetNextXY(
double *x,
double *y) = 0;
1902 bool DoGetNextXY(
double *x,
double *y);
1907 void SetViewMode(
bool asBar);
1928 wxCoord maxDrawX, minDrawX, maxDrawY, minDrawY;
1931 double m_deltaX, m_deltaY;
1937 bool m_ViewAsBar =
false;
1940 bool m_CanDelete =
true;
1946 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1952 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1954 wxDECLARE_DYNAMIC_CLASS(mpFXY);
1980 class WXDLLIMPEXP_MATHPLOT mpFXYVector:
public mpFXY
1986 mpFXYVector(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false, mpScaleY *yAxisUsed = NULL);
1999 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
2022 bool AddData(
const double x,
const double y,
bool updatePlot);
2031 m_reserveXY = reserve;
2032 m_xs.reserve(m_reserveXY);
2033 m_ys.reserve(m_reserveXY);
2046 std::vector<double> m_xs, m_ys;
2058 double m_minX, m_maxX, m_minY, m_maxY, m_lastX, m_lastY;
2073 virtual bool GetNextXY(
double *x,
double *y);
2077 void DrawAddedPoint(
double x,
double y);
2086 return m_minX - (m_deltaX / 2);
2108 return m_maxX + (m_deltaX / 2);
2126 void First_Point(
double x,
double y);
2130 void Check_Limit(
double val,
double *min,
double *max,
double *last,
double *delta);
2132 wxDECLARE_DYNAMIC_CLASS(mpFXYVector);
2143 class WXDLLIMPEXP_MATHPLOT mpProfile:
public mpFunction 2149 mpProfile(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP);
2156 virtual double GetY(
double x) = 0;
2164 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2166 wxDECLARE_DYNAMIC_CLASS(mpProfile);
2174 class WXDLLIMPEXP_MATHPLOT mpChart:
public mpFunction 2178 mpChart(
const wxString &name = wxEmptyString);
2188 void SetChartValues(
const std::vector<double> &data);
2192 void SetChartLabels(
const std::vector<std::string> &labelArray);
2198 void AddData(
const double &data,
const std::string &label);
2203 virtual void Clear();
2207 return (values.size() > 0);
2211 std::vector<double> values;
2212 std::vector<std::string> labels;
2215 double m_total_value;
2217 wxDECLARE_DYNAMIC_CLASS(mpChart);
2224 #define mpBAR_NONE 0 2225 #define mpBAR_AXIS_H 1 2226 #define mpBAR_AXIS_V 2 2227 #define mpBAR_INSIDE 3 2232 class WXDLLIMPEXP_MATHPLOT mpBarChart:
public mpChart
2236 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
2244 void SetBarColour(
const wxColour &colour);
2246 void SetColumnWidth(
const double colWidth)
2252 void SetBarLabelPosition(
int position);
2257 virtual double GetMinX();
2262 virtual double GetMaxX();
2267 virtual double GetMinY();
2272 virtual double GetMaxY();
2277 wxColour m_barColour;
2279 double m_labelAngle;
2285 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2287 wxDECLARE_DYNAMIC_CLASS(mpBarChart);
2294 class WXDLLIMPEXP_MATHPLOT mpPieChart:
public mpChart
2298 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
2310 void SetPieColours(
const std::vector<wxColour> &colourArray);
2347 std::vector<wxColour> colours;
2353 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2355 const wxColour& GetColour(
unsigned int id);
2357 wxDECLARE_DYNAMIC_CLASS(mpBarChart);
2370 #define mpMOUSEMODE_DRAG 0 2372 #define mpMOUSEMODE_ZOOMBOX 1 2377 typedef std::deque<mpLayer*> mpLayerList;
2395 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer 2396 bool operator==(
const mpYAxisInfo&)
const =
default;
2400 return (Axis == other.
Axis) && Data == other.
Data &&
2412 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer;
2420 typedef std::function<void(void *Sender, wxMouseEvent &event, bool &cancel)> mpOnUserMouseAction;
2431 m_rightClick =
false;
2432 m_IsWasDrawn =
false;
2438 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2440 m_domain = wxRect(left, top, width, height);
2441 m_plot_size = wxRect(left, top, width + left, height + top);
2443 void UpdateBox(
const wxRect &size)
2446 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2447 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2449 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2450 void ClearPlot(wxClientDC &dc);
2451 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2452 void SaveDrawState(
void)
2454 m_IsWasDrawn = m_IsDrawn;
2459 void SetRightClick(
void)
2461 m_rightClick =
true;
2467 wxPoint m_mousePosition;
2471 void DrawCross(wxClientDC &dc)
const;
2495 class WXDLLIMPEXP_MATHPLOT mpWindow:
public wxWindow
2503 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2523 bool AddLayer(mpLayer *layer,
bool refreshDisplay =
true);
2534 bool DelLayer(mpLayer *layer,
bool alsoDeleteObject,
bool refreshDisplay =
true);
2540 void DelAllLayers(
bool alsoDeleteObject,
bool refreshDisplay =
true);
2547 void DelAllPlot(
bool alsoDeleteObject, mpFunctionType func = mpfAllType,
bool refreshDisplay =
true);
2554 mpLayer* GetLayer(
int position);
2562 mpLayer* GetLayersType(
int position, mpLayerType type);
2569 mpLayer* GetLayerPlot(
int position, mpFunctionType func = mpfAllType);
2573 mpLayer* GetLayerAxis(
int position, mpScaleType scale = mpsAllType);
2579 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
2584 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear);
2590 mpLayer* GetLayerByName(
const wxString &name);
2596 mpLayer* GetLayerByClassName(
const wxString &name);
2601 void RefreshLegend(
void);
2607 bool IsYAxisUsed(
int yID);
2612 mpScaleX* GetLayerXAxis();
2617 mpScaleY* GetLayerYAxis(
int yID);
2624 if (ISNOTNULL(scaleX))
2627 UpdateDesiredBoundingBox();
2647 assert(m_YAxisList.count(yID) != 0);
2648 if (ISNOTNULL(scaleY))
2650 m_YAxisList[yID].Data.scale = scaleY;
2651 UpdateDesiredBoundingBox();
2663 assert(m_YAxisList.count(yID) != 0);
2664 return m_YAxisList[yID].Data.scale;
2667 [[deprecated(
"Incomplete, use UpdateBBox instead")]]
2683 assert(m_YAxisList.count(yID) != 0);
2684 return m_YAxisList[yID].Bound;
2693 UpdateDesiredBoundingBox();
2713 for (
auto& axisInfo : m_YAxisList)
2715 axisInfo.second.Data.pos = posYList[i];
2718 UpdateDesiredBoundingBox();
2729 assert(m_YAxisList.count(yID) != 0);
2730 return m_YAxisList[yID].Data.pos;
2738 return (
int)m_YAxisList.size();
2741 std::map<int, mpYAxisInfo> GetYAxisList(
void)
const 2755 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
2756 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
2758 m_plotBoundaries.endPx = m_scrX;
2759 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
2760 m_plotBoundaries.endPy = m_scrY;
2761 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
2763 m_PlotArea = wxRect(m_margin.left - EXTRA_MARGIN, m_margin.top - EXTRA_MARGIN,
2764 m_plotWidth + 2*EXTRA_MARGIN, m_plotHeight + 2*EXTRA_MARGIN);
2766 m_magnet.UpdateBox(m_PlotArea);
2796 void SetPos(
const double posX,
const std::vector<double>& posYList)
2805 inline double p2x(
const wxCoord pixelCoordX)
const 2807 return m_posX + (pixelCoordX / m_scaleX);
2813 inline double p2y(
const wxCoord pixelCoordY,
int yID)
2815 assert(m_YAxisList.count(yID) != 0);
2816 if (m_YAxisList.count(yID) == 0)
2818 return m_YAxisList[yID].Data.pos - (pixelCoordY / m_YAxisList[yID].Data.scale);
2824 inline wxCoord
x2p(
const double x)
const 2826 return (wxCoord)((x - m_posX) * m_scaleX);
2832 inline wxCoord
y2p(
const double y,
int yID)
2834 assert(m_YAxisList.count(yID) != 0);
2835 if (m_YAxisList.count(yID) == 0)
2837 return (wxCoord)((m_YAxisList[yID].Data.pos - y) * m_YAxisList[yID].Data.scale);
2844 m_enableDoubleBuffer = enabled;
2851 m_enableMouseNavigation = enabled;
2859 void LockAspect(
bool enable =
true);
2867 return m_lockaspect;
2876 return m_repainting;
2891 void Fit(
const mpRange &rangeX,
const std::vector<mpRange> &rangeY, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
2908 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
2914 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
2924 void ZoomInY(std::optional<int> yIndex = std::nullopt);
2928 void ZoomOutY(std::optional<int> yIndex = std::nullopt);
2931 void ZoomRect(wxPoint p0, wxPoint p1);
2941 unsigned int CountLayers();
2947 return (
unsigned int)m_layers.size();
2953 unsigned int CountLayersType(mpLayerType type);
2954 unsigned int CountLayersFXYPlot();
2967 m_desiredx.min = m_posX + (m_margin.left / m_scaleX);
2968 m_desiredx.max = m_posX + ((m_margin.left + m_plotWidth) / m_scaleX);
2970 for (
auto& axisInfo : m_YAxisList)
2972 axisInfo.second.Desired.max = axisInfo.second.Data.pos - (m_margin.top / axisInfo.second.Data.scale);
2973 axisInfo.second.Desired.min = axisInfo.second.Data.pos - ((m_margin.top + m_plotHeight) / axisInfo.second.Data.scale);
2976 CheckAndReportDesiredBoundsChanges();
2988 return m_desiredx.min;
2997 return m_desiredx.max;
3007 assert(m_YAxisList.count(yID) != 0);
3008 return m_YAxisList[yID].Desired.min;
3018 assert(m_YAxisList.count(yID) != 0);
3019 return m_YAxisList[yID].Desired.max;
3025 if (m_YAxisList.count(yID) == 0)
3028 *boundY = m_YAxisList[yID].Bound;
3034 void SetMPScrollbars(
bool status);
3040 return m_enableScrollBars;
3048 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
3053 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
3058 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
3064 bool LoadFile(
const wxString &filename);
3068 static double m_zoomIncrementalFactor;
3076 void SetMargins(
int top,
int right,
int bottom,
int left);
3081 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3087 SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3093 return m_margin.top;
3099 SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
3105 return m_margin.right;
3111 return m_marginOuter.right;
3117 SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
3123 return m_margin.bottom;
3129 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
3135 return m_margin.left;
3141 return m_marginOuter.left;
3153 return m_plotHeight;
3161 bond = m_plotBoundariesMargin;
3163 bond = m_plotBoundaries;
3164 bond.startPx -= EXTRA_MARGIN;
3165 bond.endPx += EXTRA_MARGIN;
3166 bond.startPy -= EXTRA_MARGIN;
3167 bond.endPy += EXTRA_MARGIN;
3174 int GetLeftYAxesWidth(std::optional<int> yID = std::nullopt);
3179 int GetRightYAxesWidth(std::optional<int> yID = std::nullopt);
3184 m_drawBox = drawbox;
3196 std::optional<int> IsInsideYAxis(
const wxPoint &point);
3201 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
3206 void SetLayerVisible(
const wxString &name,
bool viewable);
3211 bool IsLayerVisible(
const wxString &name);
3216 bool IsLayerVisible(
const unsigned int position);
3221 void SetLayerVisible(
const unsigned int position,
bool viewable);
3227 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
3236 const wxColour& GetbgColour()
const 3241 void SetbgColour(
const wxColour &colour)
3243 m_bgColour = colour;
3252 m_OnDeleteLayer = event;
3258 m_OnDeleteLayer = NULL;
3267 m_OnUserMouseAction = userMouseEventHandler;
3273 m_OnUserMouseAction = NULL;
3284 return m_XAxis->IsLogAxis();
3294 assert(m_YAxisList.count(yID) != 0);
3295 mpScaleY* yAxis = GetLayerYAxis(yID);
3297 return yAxis->IsLogAxis();
3302 void SetLogXaxis(
bool log)
3305 m_XAxis->SetLogAxis(log);
3313 mpScaleY* yAxis = GetLayerYAxis(yID);
3315 yAxis->SetLogAxis(log);
3328 void SetMagnetize(
bool mag)
3339 m_mouseLeftDownAction = action;
3348 return m_mouseLeftDownAction;
3351 #ifdef ENABLE_MP_CONFIG 3352 void RefreshConfigWindow();
3358 #endif // ENABLE_MP_CONFIG 3361 virtual void OnPaint(wxPaintEvent &event);
3362 virtual void OnSize(wxSizeEvent &event);
3363 virtual void OnShowPopupMenu(wxMouseEvent &event);
3364 virtual void OnCenter(wxCommandEvent &event);
3365 virtual void OnFit(wxCommandEvent &event);
3366 virtual void OnToggleGrids(wxCommandEvent &event);
3367 virtual void OnToggleCoords(wxCommandEvent &event);
3368 virtual void OnScreenShot(wxCommandEvent &event);
3369 virtual void OnFullScreen(wxCommandEvent &event);
3370 #ifdef ENABLE_MP_CONFIG 3371 virtual void OnConfiguration(wxCommandEvent &event);
3372 #endif // ENABLE_MP_CONFIG 3373 virtual void OnLoadFile(wxCommandEvent &event);
3374 virtual void OnZoomIn(wxCommandEvent &event);
3375 virtual void OnZoomOut(wxCommandEvent &event);
3376 virtual void OnLockAspect(wxCommandEvent &event);
3377 virtual void OnMouseHelp(wxCommandEvent &event);
3378 virtual void OnMouseLeftDown(wxMouseEvent &event);
3379 virtual void OnMouseRightDown(wxMouseEvent &event);
3380 virtual void OnMouseMove(wxMouseEvent &event);
3381 virtual void OnMouseLeftRelease(wxMouseEvent &event);
3382 virtual void OnMouseWheel(wxMouseEvent &event);
3383 virtual void OnMouseLeave(wxMouseEvent &event);
3384 bool CheckUserMouseAction(wxMouseEvent &event);
3385 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
3386 virtual void OnScrollPageUp(wxScrollWinEvent &event);
3387 virtual void OnScrollPageDown(wxScrollWinEvent &event);
3388 virtual void OnScrollLineUp(wxScrollWinEvent &event);
3389 virtual void OnScrollLineDown(wxScrollWinEvent &event);
3390 virtual void OnScrollTop(wxScrollWinEvent &event);
3391 virtual void OnScrollBottom(wxScrollWinEvent &event);
3393 void DoScrollCalc(
const int position,
const int orientation);
3399 void DoZoomXCalc(
bool zoomIn, wxCoord staticXpixel = ZOOM_AROUND_CENTER);
3407 void DoZoomYCalc(
bool zoomIn, wxCoord staticYpixel = ZOOM_AROUND_CENTER, std::optional<int> = std::nullopt);
3413 void SetScaleXAndCenter(
double scaleX);
3420 void SetScaleYAndCenter(
double scaleY,
int yID);
3422 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
3426 virtual bool UpdateBBox();
3428 void InitParameters();
3430 wxTopLevelWindow* m_parent;
3433 mpLayerList m_layers;
3439 wxColour m_bgColour;
3440 wxColour m_fgColour;
3441 wxColour m_axColour;
3457 wxCoord m_plotWidth;
3458 wxCoord m_plotHeight;
3461 mpRect m_plotBoundariesMargin;
3465 int m_last_lx, m_last_ly;
3466 wxBitmap* m_buff_bmp;
3467 bool m_enableDoubleBuffer;
3468 bool m_enableMouseNavigation;
3469 mpMouseButtonAction m_mouseLeftDownAction;
3470 bool m_mouseMovedAfterRightClick;
3471 wxPoint m_mouseRClick;
3472 wxPoint m_mouseLClick;
3473 double m_mouseScaleX;
3474 std::vector<double> m_mouseScaleYList;
3476 bool m_enableScrollBars;
3477 int m_scrollX, m_scrollY;
3478 mpInfoLayer* m_movingInfoLayer;
3479 mpInfoCoords* m_InfoCoords;
3480 mpInfoLegend* m_InfoLegend;
3481 bool m_InInfoLegend;
3483 wxBitmap* m_zoom_bmp;
3485 wxRect m_zoom_oldDim;
3490 wxBitmap* m_Screenshot_bmp;
3492 #ifdef ENABLE_MP_CONFIG 3494 #endif // ENABLE_MP_CONFIG 3496 mpOnDeleteLayer m_OnDeleteLayer = NULL;
3497 mpOnUserMouseAction m_OnUserMouseAction = NULL;
3505 void FillI18NString();
3507 void CheckAndReportDesiredBoundsChanges();
3508 bool m_initialDesiredBoundsRecorded =
false;
3511 wxDECLARE_DYNAMIC_CLASS(mpWindow);
3512 wxDECLARE_EVENT_TABLE();
3529 class WXDLLIMPEXP_MATHPLOT mpText:
public mpLayer
3534 mpText(
const wxString &name = wxEmptyString) : mpLayer(mpLAYER_TEXT)
3536 m_subtype = mptText;
3540 m_location = mpMarginNone;
3541 m_ZIndex = mpZIndex_TEXT;
3547 mpText(
const wxString &name,
int offsetx,
int offsety);
3552 mpText(
const wxString &name, mpLocation marginLocation);
3565 m_location = location;
3593 mpLocation m_location;
3597 virtual void DoPlot(wxDC &dc, mpWindow &w);
3599 wxDECLARE_DYNAMIC_CLASS(mpText);
3605 class WXDLLIMPEXP_MATHPLOT mpTitle:
public mpText
3615 mpText(name, mpMarginTopCenter)
3617 m_subtype = mptTitle;
3618 SetPen(*wxWHITE_PEN);
3619 SetBrush(*wxWHITE_BRUSH);
3624 wxDECLARE_DYNAMIC_CLASS(mpTitle);
3635 class WXDLLIMPEXP_MATHPLOT mpPrintout:
public wxPrintout
3645 mpPrintout(mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
3646 virtual ~mpPrintout()
3651 void SetDrawState(
bool drawState)
3656 bool OnPrintPage(
int page);
3657 bool HasPage(
int page);
3663 stretch_factor = factor;
3668 mpWindow* plotWindow;
3673 wxDECLARE_DYNAMIC_CLASS(mpPrintout);
3686 class WXDLLIMPEXP_MATHPLOT mpMovableObject:
public mpFunction 3692 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
3694 assert(m_type == mpLAYER_PLOT);
3695 m_subtype = mpfMovable;
3696 m_bbox_min_x = m_bbox_max_x = 0;
3697 m_bbox_min_y = m_bbox_max_y = 0;
3700 virtual ~mpMovableObject() {}
3708 phi = m_reference_phi;
3717 m_reference_phi = phi;
3718 m_flags = mpALIGN_NE;
3724 return m_trans_shape_xs.size() != 0;
3731 return m_bbox_min_x;
3738 return m_bbox_max_x;
3745 return m_bbox_min_y;
3752 return m_bbox_max_y;
3759 double m_reference_x, m_reference_y, m_reference_phi;
3761 virtual void DoPlot(wxDC &dc, mpWindow &w);
3765 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
3769 std::vector<double> m_shape_xs, m_shape_ys;
3774 std::vector<double> m_trans_shape_xs, m_trans_shape_ys;
3779 double m_bbox_min_x, m_bbox_max_x, m_bbox_min_y, m_bbox_max_y;
3784 void ShapeUpdated();
3786 wxDECLARE_DYNAMIC_CLASS(mpMovableObject);
3803 class WXDLLIMPEXP_MATHPLOT mpCovarianceEllipse:
public mpMovableObject
3809 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
3810 const wxString &layerName = _T(
"")) : mpMovableObject(),
3811 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
3813 m_continuous =
true;
3818 virtual ~mpCovarianceEllipse()
3823 double GetQuantiles()
const 3836 void SetSegments(
int segments)
3838 m_segments = segments;
3841 int GetSegments()
const 3868 double m_cov_00, m_cov_11, m_cov_01;
3877 void RecalculateShape();
3879 wxDECLARE_DYNAMIC_CLASS(mpCovarianceEllipse);
3889 class WXDLLIMPEXP_MATHPLOT mpPolygon:
public mpMovableObject
3894 mpPolygon(
const wxString &layerName = _T(
"")) : mpMovableObject()
3896 m_continuous =
true;
3900 virtual ~mpPolygon()
3910 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
3914 wxDECLARE_DYNAMIC_CLASS(mpPolygon);
3924 class WXDLLIMPEXP_MATHPLOT mpBitmapLayer:
public mpLayer
3931 m_min_x = m_max_x = 0;
3932 m_min_y = m_max_y = 0;
3934 m_bitmapChanged =
false;
3935 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
3938 virtual ~mpBitmapLayer()
3945 void GetBitmapCopy(wxImage &outBmp)
const;
3954 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
3989 wxBitmap m_scaledBitmap;
3990 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
3992 bool m_bitmapChanged;
3996 double m_min_x, m_max_x, m_min_y, m_max_y;
3998 virtual void DoPlot(wxDC &dc, mpWindow &w);
4000 wxDECLARE_DYNAMIC_CLASS(mpBitmapLayer);
4006 typedef enum __mp_Colour
4023 class WXDLLIMPEXP_MATHPLOT wxIndexColour:
public wxColour
4026 wxIndexColour(
unsigned int id)
4031 this->Set(0, 0, 255);
4034 this->Set(255, 0, 0);
4037 this->Set(0, 128, 0);
4040 this->Set(128, 0, 128);
4043 this->Set(255, 255, 0);
4046 this->Set(255, 0, 255);
4049 this->Set(0, 255, 0);
4052 this->Set(0, 255, 255);
4055 this->Set(128, 128, 0);
4058 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
4059 (ChannelType)((rand() * 255) / RAND_MAX));
4067 #ifdef ENABLE_MP_NAMESPACE 4070 #endif // ENABLE_MP_NAMESPACE 4072 #endif // MATHPLOT_H_INCLUDED const wxString & GetLabelFormat() const
Get axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1243
bool IsHorizontal(void) const
Get if is horizontal line.
Definition: mathplot.h:1691
void SetValue(const double value)
Set x or y.
Definition: mathplot.h:1684
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:2842
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:727
wxCoord y2p(const double y, int yID)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2832
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:2775
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3979
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:3256
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1735
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:3763
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:2622
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:605
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:174
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1584
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:3798
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:2331
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:2315
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:3894
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:1229
void SetLogYaxis(int yID, bool log)
Set the log property (true or false) for a Y layer (Y axis) given by is ID.
Definition: mathplot.h:3311
void UpdateDesiredBoundingBox()
Draws the mpWindow on a page for printing.
Definition: mathplot.h:2965
int GetAxisID(void)
Return the ID of the Axis.
Definition: mathplot.h:1451
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1668
void SetItemMode(mpLegendStyle mode)
Set item mode (the element on the left of text representing the plot line may be line, square, or line with symbol).
Definition: mathplot.h:1113
int GetUseCount(void) const
Return then number of function who use this axis.
Definition: mathplot.h:1472
Abstract class providing a line.
Definition: mathplot.h:1266
Abstract class providing an vertical line.
Definition: mathplot.h:1331
double GetScaleY(int yID)
Get current view's Y scale.
Definition: mathplot.h:2661
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:1215
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2384
int GetNOfYAxis(void) const
Get the number of Y axis.
Definition: mathplot.h:2736
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:3713
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:704
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:2865
std::optional< int > m_mouseYAxisID
Indicate which ID of Y-axis the mouse was on during zoom/pan.
Definition: mathplot.h:3475
~mpBarChart()
Destructor.
Definition: mathplot.h:2239
double p2x(const wxCoord pixelCoordX) const
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2805
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:1393
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:3502
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:712
void UpdateUseCount(bool increase)
Update the number of function who use this axis.
Definition: mathplot.h:1460
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:3556
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:589
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:951
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:1068
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:758
unsigned int GetLabelMode() const
Get X axis label view mode.
Definition: mathplot.h:1386
~mpPieChart()
Destructor.
Definition: mathplot.h:2301
std::map< int, mpYAxisInfo > m_YAxisList
List of Y axes layer of this mpWindow.
Definition: mathplot.h:3435
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:3145
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3743
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:3097
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1542
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition: mathplot.h:3139
void SetMouseLeftDownAction(mpMouseButtonAction action)
Set the type of action for the left mouse button.
Definition: mathplot.h:3337
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1410
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1466
virtual bool DoBeforePlot()
Here we verify that we have an Y axis associated to the plot We can not plot if we don't have an Y ax...
Definition: mathplot.h:1652
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:3704
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1070
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2147
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:3563
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:2205
void SetScaleY(const double scaleY, int yID)
Set current view's Y scale and refresh display.
Definition: mathplot.h:2645
bool GetBoundingBox(mpRange *boundX, mpRange *boundY, int yID)
Return the bounding box coordinates for the Y axis of ID yID.
Definition: mathplot.h:3023
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1378
double p2y(const wxCoord pixelCoordY, int yID)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2813
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:2849
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:1259
int GetMarginRight() const
Get the right margin.
Definition: mathplot.h:3103
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1578
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:541
bool GetCanDelete(void) const
Get CanDelete for plot.
Definition: mathplot.h:827
Definition: MathPlotConfig.h:44
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:2339
void SetCanDelete(bool canDelete)
Set CanDelete for plot.
Definition: mathplot.h:820
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3958
bool GetMagnetize() const
Magnetize the position of the mouse in the plot ie draw a vertical and horizontal line...
Definition: mathplot.h:3323
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:1025
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:1222
mpScaleY * Axis
Pointer to the Y axes layer.
Definition: mathplot.h:2390
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:3231
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:737
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:2118
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:3534
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:3265
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:2690
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:834
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:3151
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:1054
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3965
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:751
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:3857
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:3509
Represents all the informations needed for an Y axis This struct holds:
Definition: mathplot.h:2388
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:958
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:3570
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1990
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:3560
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1886
virtual bool IsLogAxis()
Logarithmic axis.
Definition: mathplot.h:1303
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1585
double GetDesiredYmax(int yID)
Return the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactl...
Definition: mathplot.h:3016
int m_yAxisID
The ID of the Y axis used by the function. Equal -1 if no axis.
Definition: mathplot.h:1645
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1550
Layer for bar chart.
Definition: mathplot.h:1836
abstract Layer for chart (bar and pie).
Definition: mathplot.h:1778
void SetPosY(const std::vector< double > &posYList)
Set current view's Y position and refresh display.
Definition: mathplot.h:2710
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:720
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:965
double GetDesiredXmin() const
Get the 'desired' user-coordinate bounding box for the currently displayed view (set by Fit...
Definition: mathplot.h:2986
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:3115
double GetPosY(int yID)
Get current view's Y position.
Definition: mathplot.h:2727
virtual int GetSize()
Return the number of points in the series We assume that size of m_xs equals size of m_ys...
Definition: mathplot.h:2010
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3972
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:1275
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:2081
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1713
void SetReserve(int reserve)
Set memory reserved for m_xs and m_ys Note : this does not modify the size of m_xs and m_ys...
Definition: mathplot.h:2029
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:2038
void SetYAxis(mpScaleY *yAxisUsed)
Set the Y axis associated to the function If the function is already associated to another axis...
Definition: mathplot.h:1615
mpMouseButtonAction GetMouseLeftDownAction()
Returns the type of action for the left mouse button.
Definition: mathplot.h:3346
void UpdateMargins()
Update margins if e.g.
Definition: mathplot.h:3079
int GetMarginTop() const
Get the top margin.
Definition: mathplot.h:3091
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:875
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:553
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:3584
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:927
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:562
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:984
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:3038
mpRange Get_BoundX(void) const
Get bounding box for X axis.
Definition: mathplot.h:2673
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false)
Full constructor.
Definition: mathplot.h:1434
wxCoord x2p(const double x) const
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2824
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1557
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1109
bool IsLogXaxis()
Is this an X axis to be displayed with log scale? It is really an axis property but as we need to con...
Definition: mathplot.h:3281
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:2751
int GetBarWidth(void) const
return the width of the bar
Definition: mathplot.h:1912
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:3250
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:1047
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:2103
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:3182
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1166
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1357
mpTitle(const wxString &name)
Definition: mathplot.h:3614
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:1039
Plot layer implementing a simple title.
Definition: mathplot.h:3479
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2212
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:3722
double GetDesiredYmin(int yID)
Return the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exa...
Definition: mathplot.h:3005
bool ViewAsBar(void) const
return true if XY series is plotted with bar
Definition: mathplot.h:1920
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:785
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:3157
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:2701
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:813
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1236
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:1267
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1878
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:3271
static int m_LastYAxisID
Reference the last ID provided to the last instance of mpScaleY.
Definition: mathplot.h:1502
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
Full constructor.
Definition: mathplot.h:1370
~mpChart()
Destructor.
Definition: mathplot.h:2181
Abstract class providing an horizontal line.
Definition: mathplot.h:1309
mpRange Bound
Range min and max of Y interval.
Definition: mathplot.h:2392
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:2063
void SetPos(const double posX, const std::vector< double > &posYList)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:2796
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:1975
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:680
Class for drawing mouse magnetization.
Definition: mathplot.h:2314
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:3677
double GetDesiredXmax() const
Return the right-border layer coordinate that the user wants the mpWindow to show (it may be not exac...
Definition: mathplot.h:2995
Represents the scale and position for an axis This struct holds the scale defined by m_scale and the ...
Definition: mathplot.h:226
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:696
mpRange Get_BoundY(int yID)
Get bounding box for Y axis of ID yID.
Definition: mathplot.h:2681
mpCovarianceEllipse(double cov_00=1, double cov_11=1, double cov_01=0, double quantiles=2, int segments=32, const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:3809
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:688
int GetMarginLeft() const
Get the left margin.
Definition: mathplot.h:3133
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:3848
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:972
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:778
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:1208
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:570
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:799
int GetMarginBottom() const
Get the bottom margin.
Definition: mathplot.h:3121
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1593
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:3691
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:2786
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:613
Plot layer implementing a text string.
Definition: mathplot.h:3403
virtual bool IsLayerType(mpLayerType typeOfInterest, int *subtype)
Set the layer's subtype in caller variable, and return true if the layer is of type "typeOfInterest"...
Definition: mathplot.h:580
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3750
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:3188
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:765
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition: mathplot.h:3109
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:597
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:3085
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:2636
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1126
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see above)...
Definition: mathplot.h:3830
int GetYAxisID() const
Get the ID of the Y axis used by the function.
Definition: mathplot.h:1606
bool IsLogYaxis(int yID)
Get the log property (true or false) Y layer (Y axis) with a specific Y ID or false if not found...
Definition: mathplot.h:3292
Represents a numeric range with minimum and maximum values.
Definition: mathplot.h:205
mpRange Desired
Desired range min and max of Y interval.
Definition: mathplot.h:2393
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:2323
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1564
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3729
Plot layer, abstract base class.
Definition: mathplot.h:508
double GetValue() const
Set x or y.
Definition: mathplot.h:1676
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:3577
void SetFactor(int factor)
Definition: mathplot.h:3661
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:664
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:744
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:672
virtual bool DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:871
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:3127
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1747
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:979
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:792
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1201
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3736
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:2874
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:2945
mpAxisData Data
Y scale and position structure.
Definition: mathplot.h:2391
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:1251
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1571
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:3929
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2511
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:806
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:2096