MathPlot
mathplot.h
Go to the documentation of this file.
1 // Name: mathplot.cpp
3 // Purpose: Framework for plotting in wxWindows
4 // Original Author: David Schalig
5 // Maintainer: Davide Rondini
6 // Contributors: Jose Luis Blanco, Val Greene, Lionel Reynaud, Dave Nadler, MortenMacFly,
7 // Oskar Waldemarsson (for multi Y axis and corrections)
8 // Created: 21/07/2003
9 // Last edit: 30/03/2026
10 // Copyright: (c) David Schalig, Davide Rondini
11 // Licence: wxWindows licence
13 
14 #ifndef MATHPLOT_H_INCLUDED
15 #define MATHPLOT_H_INCLUDED
16 
67 //this definition uses windows dll to export function.
68 //WXDLLIMPEXP_MATHPLOT definition definition changed to WXDLLIMPEXP_MATHPLOT
69 //mathplot_EXPORTS will be defined by cmake
70 #ifdef mathplot_EXPORTS
71  #define WXDLLIMPEXP_MATHPLOT WXEXPORT
73  #define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type
75 #else // not making DLL
76  #define WXDLLIMPEXP_MATHPLOT
78  #define WXDLLIMPEXP_DATA_MATHPLOT(type) type
80 #endif
81 
82 #if defined(__GNUG__) && !defined(__APPLE__) && !defined(__INTEL_CLANG_COMPILER)
83  #pragma interface "mathplot.h"
84 #endif
85 
86 #include <cassert> // For assert debug message. Disable if NDEBUG is defined
87 #include <vector>
88 #include <map>
89 #include <unordered_map>
90 
98 // Multiple define to compile with C++14 because
99 // Optional is only for C++ >= 17
100 // Structured binding is a C++17 feature
101 #if (defined(__cplusplus) && (__cplusplus > 201402L)) // C++17 or newer
102  // Use optional
103  #include <optional>
105  typedef std::optional<unsigned int> mpOptional_uint;
107  typedef std::optional<int> mpOptional_int;
109  #define MP_OPTNULL_INT std::nullopt
110  #define MP_OPTTEST(opt) (opt)
112  #define MP_OPTGET(opt) (*opt)
114  // Use structured binding
116  #define MP_LOOP_ITER auto& [m_yID, m_yData]
117 #else
118  // To replace optional int...
120  typedef unsigned int mpOptional_uint;
122  typedef int mpOptional_int;
124  #define MP_OPTNULL_INT -1
125  #define MP_OPTTEST(opt) ((opt) != -1)
127  #define MP_OPTGET(opt) (opt)
129  // To replace structured binding...
131  #define MP_LOOP_ITER auto& elem
132  #define m_yID elem.first
134  #define m_yData elem.second
136 #endif
137 
140 // #include <wx/wx.h>
141 #include <wx/defs.h>
142 #include <wx/menu.h>
143 #include <wx/scrolwin.h>
144 #include <wx/event.h>
145 #include <wx/dynarray.h>
146 #include <wx/pen.h>
147 #include <wx/dcmemory.h>
148 #include <wx/string.h>
149 #include <wx/print.h>
150 #include <wx/image.h>
151 #include <wx/intl.h>
152 
153 #include <cmath>
154 #include <deque>
155 #include <algorithm>
156 
157 
158 #if defined(MP_USER_INCLUDE)
159  #define xstr(x) #x
161  #define str(x) xstr(x)
163  #define header MP_USER_INCLUDE.h
164  #include str(header)
165  #undef header
166 #endif
167 
168 #ifdef ENABLE_MP_CONFIG
169  #include "MathPlotConfig.h"
170 #endif // ENABLE_MP_CONFIG
171 
176 // No, this is supposed to be a build parameter: #define ENABLE_MP_NAMESPACE
177 #ifdef ENABLE_MP_NAMESPACE
178  namespace MathPlot {
179 #endif // ENABLE_MP_NAMESPACE
180 
181 #ifdef ENABLE_MP_DEBUG
182  // For memory leak debug
183  #ifdef _WINDOWS
184  #ifdef _DEBUG
185  #include <crtdbg.h>
186  #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__)
187  #else
188  #define DEBUG_NEW new
189  #endif // _DEBUG
190  #endif // _WINDOWS
191 #endif // ENABLE_MP_DEBUG
192 
194 #define X_BORDER_SEPARATION 40
195 #define Y_BORDER_SEPARATION 60
197 
199 #define mpX_LOCALTIME 0x10
200 #define mpX_UTCTIME 0x20
202 #define mpX_RAWTIME mpX_UTCTIME
204 
206 #define EPSILON 1e-8
207 #define ISNOTNULL(x) (fabs(x) > EPSILON)
209 
211 #define EXTRA_MARGIN 8
212 
214 #define ZOOM_AROUND_CENTER -1
215 
216 //-----------------------------------------------------------------------------
217 // classes
218 //-----------------------------------------------------------------------------
219 
246 
247 #ifdef ENABLE_MP_CONFIG
249 #endif // ENABLE_MP_CONFIG
250 
252 typedef union
253 {
254  struct
255  {
256  wxCoord startPx;
257  wxCoord endPx;
258  wxCoord startPy;
259  wxCoord endPy;
260  };
261  struct
262  {
263  wxCoord left;
264  wxCoord top;
265  wxCoord right;
266  wxCoord bottom;
267  };
268  struct
269  {
270  wxCoord x1;
271  wxCoord y1;
272  wxCoord x2;
273  wxCoord y2;
274  };
275  wxCoord tab[4];
276 } mpRect;
277 
283 template<typename T>
284 struct mpRange
285 {
286  T min = 0;
287  T max = 0;
288 
291  {
292  min = 0;
293  max = 0;
294  }
295 
297  mpRange(T value1, T value2)
298  {
299  if (value1 < value2)
300  {
301  min = value1;
302  max = value2;
303  }
304  else
305  {
306  min = value2;
307  max = value1;
308  }
309  }
310 
312  void Set(T _value)
313  {
314  min = _value;
315  max = _value;
316  }
317 
319  void Set(T _min, T _max)
320  {
321  min = _min;
322  max = _max;
323  }
324 
326  void SetMin(T _min)
327  {
328  min = _min;
329  if (max < min)
330  max = min;
331  }
332 
334  void SetMax(T _max)
335  {
336  max = _max;
337  if (min > max)
338  min = max;
339  }
340 
342  void Assign(T value1, T value2)
343  {
344  if (value1 < value2)
345  {
346  min = value1;
347  max = value2;
348  }
349  else
350  {
351  min = value2;
352  max = value1;
353  }
354  }
355 
357  bool IsSet()
358  {
359  return ((min != 0) || (max != 0));
360  }
361 
366  void Update(T value)
367  {
368  if (value < min)
369  min = value;
370  else
371  if (value > max)
372  max = value;
373  }
374 
378  void Update(T _min, T _max)
379  {
380  if (_min < min)
381  min = _min;
382  if (_max > max)
383  max = _max;
384  }
385 
388  void Update(mpRange range)
389  {
390  if (range.min < min)
391  min = range.min;
392  if (range.max > max)
393  max = range.max;
394  }
395 
397  void Check(void)
398  {
399  if (min == max)
400  {
401  if (max > 0)
402  min = 0;
403  else
404  max = 0;
405  }
406  }
407 
409  T Length(void) const
410  {
411  return max - min;
412  }
413 
415  T GetCenter(void) const
416  {
417  return (min + max) / 2;
418  }
419 
421  T GetMaxAbs(void) const
422  {
423  return std::max(fabs(min), fabs(max));
424  }
425 
427  void ToLog(void)
428  {
429  min = (min > 0) ? log10(min) : 0;
430  max = (max > 0) ? log10(max) : 0;
431  }
432 
434  bool PointIsInside(T point) const
435  {
436  return ((point >= min) && (point <= max));
437  }
438 
439  #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer
440  bool operator==(const mpRange&) const = default;
441  #else
442  bool operator==(const mpRange &other) const
444  {
445  return (min == other.min) && (max == other.max);
446  }
448  bool operator!=(const mpRange& other) const
449  {
450  return !(*this == other);
451  }
452  #endif
453 };
454 
460 struct [[deprecated("Deprecated! No longer used as X and Y are now separated")]] mpFloatRect
461 {
462  mpRange<double> x;
463  std::vector<mpRange<double>> y;
464 
471  mpFloatRect(mpWindow& w);
472 
474  mpFloatRect() = delete;
475 
482  bool PointIsInside(double px, double py, size_t yAxisID = 0) const {
483  if (yAxisID < y.size())
484  {
485  if( (px < x.min || px > x.max) ||
486  (py < y[yAxisID].min || py > y[yAxisID].max))
487  {
488  return false;
489  }
490  }
491  else
492  {
493  return false;
494  }
495 
496  return true;
497  }
498 
505  void UpdateBoundingBoxToInclude(double px, double py, size_t yAxisID = 0) {
506  assert(yAxisID < y.size());
507  if (yAxisID < y.size())
508  {
509  if (px < x.min ) x.min = px;
510  else if (px > x.max ) x.max = px;
511  if (py < y[yAxisID].min ) y[yAxisID].min = py;
512  else if (py > y[yAxisID].max ) y[yAxisID].max = py;
513  }
514  }
515 
522  void InitializeBoundingBox(double px, double py, size_t yAxisID = 0) {
523  assert(yAxisID < y.size());
524  if (yAxisID < y.size())
525  {
526  x.min = x.max = px;
527  y[yAxisID].min = y[yAxisID].max = py;
528  }
529  }
531  bool IsNotSet(mpWindow& w) const { const mpFloatRect def(w); return *this==def; }
533 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions>
534  bool operator==(const mpFloatRect&) const = default;
535 #else
536  // We compare with an epsilon precision
537  // NOTE: should be unnecessary as we are looking for any changes; normally this will be an exact match or a real change...
538  bool operator==(const mpFloatRect& rect) const
539  {
540  auto Same = [](double a, double b) {
541  return std::fabs(a - b) < EPSILON;
542  };
543 
544  // Compare scalar members
545  if (!Same(x.min, rect.x.min) || !Same(x.max, rect.x.max))
546  {
547  return false;
548  }
549 
550  // Compare vector sizes
551  if (y.size() != rect.y.size())
552  {
553  return false;
554  }
555 
556  // Compare each Y boundary
557  for (size_t i = 0; i < y.size(); ++i)
558  {
559  if (!Same(y[i].min, rect.y[i].min) ||
560  !Same(y[i].max, rect.y[i].max) )
561  {
562  return false;
563  }
564  }
565 
566  return true;
567  }
568 #endif
569 };
570 
577 {
580 
587 
593  bool PointIsInside(double px, double py) const {
594  return x.PointIsInside(px) && y.PointIsInside(py);
595  }
596 
602  void UpdateBoundingBoxToInclude(double px, double py)
603  {
604  x.Update(px);
605  y.Update(py);
606  }
607 
612  void InitializeBoundingBox(double px, double py)
613  {
614  x.Set(px, px);
615  y.Set(py, py);
616  }
617 };
618 
622 enum
623 {
624  mpID_FIT = 2000,
632 #ifdef ENABLE_MP_CONFIG
633  mpID_CONFIG,
634 #endif // ENABLE_MP_CONFIG
638 };
639 
641 typedef enum __mp_Location_Type
642 {
653 } mpLocation;
654 
656 typedef enum __XAxis_Align_Type
657 {
663 } mpXAxis_Align;
664 
666 typedef enum __YAxis_Align_Type
667 {
673 } mpYAxis_Align;
674 
677 {
682 } mpPlot_Align;
683 
685 typedef enum __mp_Style_Type
686 {
690 } mpLegendStyle;
691 
694 {
698 
700 typedef enum __Symbol_Type
701 {
709 } mpSymbol;
710 
711 //-----------------------------------------------------------------------------
712 // mpLayer sub_type values
713 //-----------------------------------------------------------------------------
714 
716 typedef enum __Info_Type
717 {
722 } mpInfoType;
723 
725 typedef enum __Text_Type
726 {
730 } mpTextType;
731 
733 typedef enum __Function_Type
734 {
744 
746 typedef enum __Scale_Type
747 {
752 } mpScaleType;
753 
755 typedef enum __Chart_Type
756 {
761 } mpChartType;
762 
765 {
768 };
769 
772 {
792 };
793 
794 //-----------------------------------------------------------------------------
795 // mpLayer
796 //-----------------------------------------------------------------------------
797 
799 typedef enum __mp_Layer_Type
800 {
809 } mpLayerType;
810 
816 typedef enum __mp_Layer_ZOrder
817 {
826 } mpLayerZOrder;
827 
834 typedef enum __mp_Delete_Action
835 {
840 
851 class WXDLLIMPEXP_MATHPLOT mpLayer: public wxObject
852 {
853  public:
858  mpLayer(mpLayerType layerType);
859 
860  virtual ~mpLayer()
861  {
862  ;
863  }
864 
868  {
869  m_win = &w;
870  }
871 
879  virtual bool HasBBox()
880  {
881  return true;
882  }
883 
887  mpLayerType GetLayerType() const
888  {
889  return m_type;
890  }
891 
895  int GetLayerSubType() const
896  {
897  return m_subtype;
898  }
899 
905  virtual bool IsLayerType(mpLayerType typeOfInterest, int *subtype)
906  {
907  *subtype = m_subtype;
908  return (m_type == typeOfInterest);
909  }
910 
914  virtual double GetMinX()
915  {
916  return -1.0;
917  }
918 
922  virtual double GetMaxX()
923  {
924  return 1.0;
925  }
926 
930  virtual double GetMinY()
931  {
932  return -1.0;
933  }
934 
938  virtual double GetMaxY()
939  {
940  return 1.0;
941  }
942 
984  void Plot(wxDC &dc, mpWindow &w);
985 
989  void SetName(const wxString &name)
990  {
991  m_name = name;
992  }
993 
997  const wxString& GetName() const
998  {
999  return m_name;
1000  }
1001 
1005  void SetFont(const wxFont &font)
1006  {
1007  m_font = font;
1008  }
1009 
1013  const wxFont& GetFont() const
1014  {
1015  return m_font;
1016  }
1017 
1021  void SetFontColour(const wxColour &colour)
1022  {
1023  m_fontcolour = colour;
1024  }
1025 
1029  const wxColour& GetFontColour() const
1030  {
1031  return m_fontcolour;
1032  }
1033 
1037  void SetPen(const wxPen &pen)
1038  {
1039  m_pen = pen;
1040  }
1041 
1045  const wxPen& GetPen() const
1046  {
1047  return m_pen;
1048  }
1049 
1052  void SetBrush(const wxBrush &brush)
1053  {
1054  if (brush == wxNullBrush)
1055  m_brush = *wxTRANSPARENT_BRUSH;
1056  else
1057  m_brush = brush;
1058  }
1059 
1062  const wxBrush& GetBrush() const
1063  {
1064  return m_brush;
1065  }
1066 
1069  void SetShowName(bool show)
1070  {
1071  m_showName = show;
1072  }
1073 
1076  inline bool GetShowName() const
1077  {
1078  return m_showName;
1079  }
1080 
1083  void SetDrawOutsideMargins(bool drawModeOutside)
1084  {
1085  m_drawOutsideMargins = drawModeOutside;
1086  }
1087 
1091  {
1092  return m_drawOutsideMargins;
1093  }
1094 
1099  wxBitmap GetColourSquare(int side = 16);
1100 
1103  inline bool IsVisible() const
1104  {
1105  return m_visible;
1106  }
1107 
1110  virtual void SetVisible(bool show)
1111  {
1112  m_visible = show;
1113  }
1114 
1117  inline bool IsTractable() const
1118  {
1119  return m_tractable;
1120  }
1121 
1124  virtual void SetTractable(bool track)
1125  {
1126  m_tractable = track;
1127  }
1128 
1131  void SetAlign(int align)
1132  {
1133  m_flags = align;
1134  }
1135 
1138  int GetAlign() const
1139  {
1140  return m_flags;
1141  }
1142 
1145  void SetCanDelete(bool canDelete)
1146  {
1147  m_CanDelete = canDelete;
1148  }
1149 
1152  bool GetCanDelete(void) const
1153  {
1154  return m_CanDelete;
1155  }
1156 
1159  mpLayerZOrder GetZIndex(void) const
1160  {
1161  return m_ZIndex;
1162  }
1163 
1164  protected:
1165  const mpLayerType m_type;
1168  wxFont m_font;
1169  wxColour m_fontcolour;
1170  wxPen m_pen;
1171  wxBrush m_brush;
1172  wxString m_name;
1173  bool m_showName;
1175  bool m_visible;
1177  int m_flags;
1180  mpLayerZOrder m_ZIndex;
1181 
1184  void UpdateContext(wxDC &dc) const;
1185 
1190  virtual void DoPlot(wxDC &dc, mpWindow &w) = 0;
1191 
1196  virtual bool DoBeforePlot()
1197  {
1198  return true;
1199  }
1200 
1207  void CheckLog(double *x, double *y, int yAxisID);
1208 
1209  private:
1210  bool m_busy;
1211  mpLayer() = delete; // default ctor not implemented/permitted
1212 
1213  wxDECLARE_DYNAMIC_CLASS(mpLayer);
1214 };
1215 
1216 //-----------------------------------------------------------------------------
1217 // mpInfoLayer
1218 //-----------------------------------------------------------------------------
1219 
1226 {
1227  public:
1229  mpInfoLayer();
1230 
1235  mpInfoLayer(wxRect rect, const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
1236 
1238  virtual ~mpInfoLayer();
1239 
1242  virtual void SetVisible(bool show);
1243 
1248  virtual void UpdateInfo(mpWindow &w, wxEvent &event);
1249 
1252  virtual bool HasBBox()
1253  {
1254  return false;
1255  }
1256 
1260  virtual void ErasePlot(wxDC &dc, mpWindow &w);
1261 
1265  virtual bool Inside(const wxPoint &point);
1266 
1269  virtual void Move(wxPoint delta);
1270 
1272  virtual void UpdateReference();
1273 
1276  wxPoint GetPosition() const
1277  {
1278  return m_dim.GetPosition();
1279  }
1280 
1283  wxSize GetSize() const
1284  {
1285  return m_dim.GetSize();
1286  }
1287 
1290  const wxRect& GetRectangle() const
1291  {
1292  return m_dim;
1293  }
1294 
1297  void SetLocation(mpLocation location)
1298  {
1299  m_location = location;
1300  }
1301 
1304  mpLocation GetLocation() const
1305  {
1306  return m_location;
1307  }
1308 
1309  protected:
1310  wxRect m_dim;
1311  wxRect m_oldDim;
1312  wxBitmap* m_info_bmp;
1313  wxPoint m_reference;
1314  int m_winX;
1315  int m_winY;
1316  mpLocation m_location;
1317 
1322  virtual void DoPlot(wxDC &dc, mpWindow &w);
1323 
1326  void SetInfoRectangle(mpWindow &w, int width = 0, int height = 0);
1327 
1328  wxDECLARE_DYNAMIC_CLASS(mpInfoLayer);
1329 };
1330 
1336 {
1337  public:
1339  mpInfoCoords();
1340 
1342  mpInfoCoords(mpLocation location);
1343 
1348  mpInfoCoords(wxRect rect, const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
1349 
1352  {
1353  ;
1354  }
1355 
1359  virtual void UpdateInfo(mpWindow &w, wxEvent &event);
1360 
1361  virtual void ErasePlot(wxDC &dc, mpWindow &w);
1362 
1366  void SetLabelMode(mpLabelType mode, unsigned int time_conv = mpX_RAWTIME)
1367  {
1368  m_labelType = mode;
1369  m_timeConv = time_conv;
1370  }
1371 
1374  void SetSeriesCoord(bool show)
1375  {
1376  m_series_coord = show;
1377  }
1378 
1381  bool IsSeriesCoord() const
1382  {
1383  return m_series_coord;
1384  }
1385 
1391  virtual wxString GetInfoCoordsText(mpWindow &w, double xVal, std::unordered_map<int, double> yValList);
1392 
1395  void SetPenSeries(const wxPen &pen)
1396  {
1397  m_penSeries = pen;
1398  }
1399 
1400  protected:
1401  wxString m_content;
1403  unsigned int m_timeConv;
1404  wxCoord m_mouseX;
1405  wxCoord m_mouseY;
1407  wxPen m_penSeries;
1408 
1413  virtual void DoPlot(wxDC &dc, mpWindow &w);
1414 
1415  wxDECLARE_DYNAMIC_CLASS(mpInfoCoords);
1416 };
1417 
1423 {
1424  public:
1426  mpInfoLegend();
1427 
1433  mpInfoLegend(wxRect rect, const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1434 
1437 
1440  void SetItemMode(mpLegendStyle mode)
1441  {
1442  m_item_mode = mode;
1443  m_needs_update = true;
1444  }
1445 
1447  mpLegendStyle GetItemMode() const
1448  {
1449  return m_item_mode;
1450  }
1451 
1454  void SetItemDirection(mpLegendDirection mode)
1455  {
1456  m_item_direction = mode;
1457  m_needs_update = true;
1458  }
1459 
1461  mpLegendDirection GetItemDirection() const
1462  {
1463  return m_item_direction;
1464  }
1465 
1468  {
1469  m_needs_update = true;
1470  }
1471 
1473  int GetPointed(mpWindow &w, wxPoint eventPoint);
1474 
1475  protected:
1476  mpLegendStyle m_item_mode;
1477  mpLegendDirection m_item_direction;
1478 
1483  virtual void DoPlot(wxDC &dc, mpWindow &w);
1484 
1485  private:
1487  struct LegendDetail
1488  {
1489  unsigned int layerIdx;
1490  wxCoord legendEnd;
1491  };
1493  std::vector<LegendDetail> m_LegendDetailList;
1494  bool m_needs_update;
1495 
1505  void UpdateBitmap(wxDC &dc, mpWindow &w);
1506 
1507  wxDECLARE_DYNAMIC_CLASS(mpInfoLegend);
1508 };
1509 
1510 //-----------------------------------------------------------------------------
1511 // mpLayer implementations - functions
1512 //-----------------------------------------------------------------------------
1513 
1514 
1522 {
1523  public:
1529  mpFunction(mpLayerType layerType = mpLAYER_PLOT, const wxString &name = wxEmptyString, unsigned int yAxisID = 0);
1530 
1534  void SetContinuity(bool continuity)
1535  {
1536  m_continuous = continuity;
1537  }
1538 
1542  bool GetContinuity() const
1543  {
1544  return m_continuous;
1545  }
1546 
1549  void SetStep(unsigned int step)
1550  {
1551  m_step = step;
1552  }
1553 
1556  unsigned int GetStep() const
1557  {
1558  return m_step;
1559  }
1560 
1563  void SetSymbol(mpSymbol symbol)
1564  {
1565  m_symbol = symbol;
1566  }
1567 
1570  mpSymbol GetSymbol() const
1571  {
1572  return m_symbol;
1573  }
1574 
1577  void SetSymbolSize(int size)
1578  {
1579  m_symbolSize = size;
1580  m_symbolSize2 = size / 2;
1581  }
1582 
1585  int GetSymbolSize() const
1586  {
1587  return m_symbolSize;
1588  }
1589 
1593  virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1594 
1598  int GetYAxisID() const
1599  {
1600  return m_yAxisID;
1601  }
1602 
1606  void SetYAxisID(unsigned int yAxisID)
1607  {
1608  m_yAxisID = yAxisID;
1609  }
1610 
1614  void SetLegendIsAlwaysVisible(bool alwaysVisible)
1615  {
1616  m_LegendIsAlwaysVisible = alwaysVisible;
1617  }
1618 
1623  {
1624  return m_LegendIsAlwaysVisible;
1625  }
1626 
1627  protected:
1629  mpSymbol m_symbol;
1632  unsigned int m_step;
1635 
1636  wxDECLARE_DYNAMIC_CLASS(mpFunction);
1637 };
1638 
1642 {
1643  public:
1650  mpLine(double value, const wxPen &pen = *wxGREEN_PEN);
1651 
1652  // We don't want to include line (horizontal or vertical) in BBox computation
1653  virtual bool HasBBox() override
1654  {
1655  return false;
1656  }
1657 
1661  double GetValue() const
1662  {
1663  return m_value;
1664  }
1665 
1669  void SetValue(const double value)
1670  {
1671  m_value = value;
1672  }
1673 
1677  bool IsHorizontal(void) const
1678  {
1679  return m_IsHorizontal;
1680  }
1681 
1682  protected:
1683  double m_value;
1685 
1686  wxDECLARE_DYNAMIC_CLASS(mpLine);
1687 };
1688 
1692 {
1693  public:
1700  mpHorizontalLine(double yvalue, const wxPen &pen = *wxGREEN_PEN, unsigned int yAxisID = 0);
1701 
1705  void SetYValue(const double yvalue)
1706  {
1707  SetValue(yvalue);
1708  }
1709 
1710  protected:
1711 
1712  virtual void DoPlot(wxDC &dc, mpWindow &w);
1713 
1714  wxDECLARE_DYNAMIC_CLASS(mpHorizontalLine);
1715 };
1716 
1720 {
1721  public:
1727  mpVerticalLine(double xvalue, const wxPen &pen = *wxGREEN_PEN);
1728 
1732  void SetXValue(const double xvalue)
1733  {
1734  SetValue(xvalue);
1735  }
1736 
1737  protected:
1738 
1739  virtual void DoPlot(wxDC &dc, mpWindow &w);
1740 
1745  virtual bool DoBeforePlot()
1746  {
1747  return true;
1748  }
1749 
1750  wxDECLARE_DYNAMIC_CLASS(mpVerticalLine);
1751 };
1752 
1760 {
1761  public:
1766  mpFX(const wxString &name = wxEmptyString, int flags = mpALIGN_RIGHT, unsigned int yAxisID = 0);
1767 
1773  virtual double GetY(double x) = 0;
1774 
1781  double DoGetY(double x);
1782 
1787  void DefineDoGetY(void);
1788 
1789  protected:
1790 
1791  double (mpFX::*pDoGetY)(double x);
1792 
1797  virtual void DoPlot(wxDC &dc, mpWindow &w);
1798 
1803  double NormalDoGetY(double x);
1804 
1809  double LogDoGetY(double x);
1810 
1811  wxDECLARE_DYNAMIC_CLASS(mpFX);
1812 };
1813 
1821 {
1822  public:
1827  mpFY(const wxString &name = wxEmptyString, int flags = mpALIGN_TOP, unsigned int yAxisID = 0);
1828 
1834  virtual double GetX(double y) = 0;
1835 
1842  double DoGetX(double y);
1843 
1848  void DefineDoGetX(void);
1849 
1850  protected:
1851 
1852  double (mpFY::*pDoGetX)(double y);
1853 
1858  virtual void DoPlot(wxDC &dc, mpWindow &w);
1859 
1864  double NormalDoGetX(double y);
1865 
1870  double LogDoGetX(double y);
1871 
1872  wxDECLARE_DYNAMIC_CLASS(mpFY);
1873 };
1874 
1885 {
1886  public:
1892  mpFXY(const wxString &name = wxEmptyString, int flags = mpALIGN_SW, bool viewAsBar = false, unsigned int yAxisID = 0);
1893 
1897  virtual void Rewind() = 0;
1898 
1902  virtual void Clear()
1903  {
1904  ;
1905  }
1906 
1910  virtual int GetSize()
1911  {
1912  return 0;
1913  }
1914 
1921  virtual bool GetNextXY(double *x, double *y) = 0;
1922 
1929  bool DoGetNextXY(double *x, double *y);
1930 
1935  void SetViewMode(bool asBar);
1936 
1941  int GetBarWidth(void) const
1942  {
1943  return m_BarWidth;
1944  }
1945 
1950  bool ViewAsBar(void) const
1951  {
1952  return m_ViewAsBar;
1953  }
1954 
1955  protected:
1956 
1957  // Data to calculate label positioning
1960 
1961  // Min delta between 2 x coordinate (used for view as bar)
1962  double m_deltaX;
1963  double m_deltaY;
1964 
1966 
1967  bool m_ViewAsBar = false;
1968 
1975  virtual void DoPlot(wxDC &dc, mpWindow &w);
1976 
1981  void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1982 
1983  wxDECLARE_DYNAMIC_CLASS(mpFXY);
1984 };
1985 
1986 //-----------------------------------------------------------------------------
1987 // mpFXYVector - provided by Jose Luis Blanco
1988 //-----------------------------------------------------------------------------
1989 
2010 {
2011  public:
2017  mpFXYVector(const wxString &name = wxEmptyString, int flags = mpALIGN_SW, bool viewAsBar = false, unsigned int yAxisID = 0);
2018 
2021  virtual ~mpFXYVector()
2022  {
2023  Clear();
2024  }
2025 
2030  void SetData(const std::vector<double> &xs, const std::vector<double> &ys);
2031 
2035  void Clear();
2036 
2041  virtual int GetSize()
2042  {
2043  return m_xs.size();
2044  }
2045 
2053  bool AddData(const double x, const double y, bool updatePlot);
2054 
2061  void SetReserve(int reserve)
2062  {
2063  m_reserveXY = reserve;
2064  m_xs.reserve(m_reserveXY);
2065  m_ys.reserve(m_reserveXY);
2066  }
2067 
2071  int GetReserve() const
2072  {
2073  return m_reserveXY;
2074  }
2075 
2076  protected:
2079  std::vector<double> m_xs;
2080  std::vector<double> m_ys;
2081 
2085 
2088  size_t m_index;
2089 
2091  double m_lastX;
2093  double m_lastY;
2094 
2098  inline void Rewind()
2099  {
2100  m_index = 0;
2101  }
2102 
2109  virtual bool GetNextXY(double *x, double *y);
2110 
2115  void DrawAddedPoint(double x, double y);
2116 
2119  virtual double GetMinX()
2120  {
2121  if (m_ViewAsBar)
2122  {
2123  // Make extra space for outer bars
2124  return m_rangeX.min - (m_deltaX / 2);
2125  }
2126  else
2127  {
2128  return m_rangeX.min;
2129  }
2130  }
2131 
2134  virtual double GetMinY()
2135  {
2136  return m_rangeY.min;
2137  }
2138 
2141  virtual double GetMaxX()
2142  {
2143  if(m_ViewAsBar)
2144  {
2145  // Make extra space for outer bars
2146  return m_rangeX.max + (m_deltaX / 2);
2147  }
2148  else
2149  {
2150  return m_rangeX.max;
2151  }
2152  }
2153 
2156  virtual double GetMaxY()
2157  {
2158  return m_rangeY.max;
2159  }
2160 
2161  private:
2164  void First_Point(double x, double y);
2165 
2168  void Check_Limit(double val, mpRange<double> *range, double *last, double *delta);
2169 
2170  wxDECLARE_DYNAMIC_CLASS(mpFXYVector);
2171 };
2172 
2182 {
2183  public:
2187  mpProfile(const wxString &name = wxEmptyString, int flags = mpALIGN_TOP);
2188 
2194  virtual double GetY(double x) = 0;
2195 
2196  protected:
2197 
2202  virtual void DoPlot(wxDC &dc, mpWindow &w);
2203 
2204  wxDECLARE_DYNAMIC_CLASS(mpProfile);
2205 };
2206 
2211 class mpFXGeneric: public mpFX
2212 {
2213  public:
2218  mpFXGeneric(const wxString &name = wxT("Generic FX function"), int flags = mpALIGN_LEFT, unsigned int yAxisID = 0) :
2219  mpFX(name, flags, yAxisID)
2220  {
2221  wxPen FXpen(*wxBLUE, 1, wxPENSTYLE_SOLID);
2222  SetDrawOutsideMargins(false);
2223  SetContinuity(true);
2224  SetPen(FXpen);
2225  SetStep(8); // Draw one point over eight
2226  }
2227 
2232  virtual double GetY(double x)
2233  {
2234  double y;
2235  try
2236  {
2237  y = ComputeY(x);
2238  }
2239  catch (...)
2240  {
2241  y = 0;
2242  }
2243  m_rangeY.Update(y);
2244  return y;
2245  }
2246 
2251  virtual double GetMinY()
2252  {
2253  return m_rangeY.min;
2254  }
2255 
2260  virtual double GetMaxY()
2261  {
2262  return m_rangeY.max;
2263  }
2264 
2265  protected:
2267 
2273  virtual double ComputeY(double x) = 0;
2274 };
2275 
2281 {
2282  public:
2288  mpGaussian(double mu, double sigma) :
2289  mpFXGeneric(wxT("Gaussian"), mpALIGN_LEFT)
2290  {
2291  m_mu = mu;
2292  m_sigma = sigma;
2293  m_variance = sigma * sigma;
2294  m_const = 1.0 / sqrt(2.0 * M_PI * m_variance);
2295  }
2296 
2297  protected:
2298  double m_mu;
2299  double m_sigma;
2300  double m_variance;
2301  double m_const;
2302 
2303  virtual double ComputeY(double x)
2304  {
2305  return m_const * exp(-(x - m_mu) * (x - m_mu) / (2.0 * m_variance));
2306  }
2307 };
2308 
2313 class mpNormal: public mpFXGeneric
2314 {
2315  public:
2321  mpNormal(double mu, double sigma) :
2322  mpFXGeneric(wxT("Gaussian"), mpALIGN_LEFT)
2323  {
2324  m_mu = mu;
2325  m_sigma = sigma;
2326  m_variance = sigma * sigma;
2327  m_const = 1.0 / (m_variance * sqrt(2.0 * M_PI));
2328  }
2329 
2330  protected:
2331  double m_mu;
2332  double m_sigma;
2333  double m_variance;
2334  double m_const;
2335 
2336  virtual double ComputeY(double x)
2337  {
2338  if (x < 0)
2339  return 0.0;
2340  else
2341  {
2342  double tmp = log(x) - m_mu;
2343  return m_const * exp(-tmp * tmp / (2.0 * m_variance)) / x;
2344  }
2345  }
2346 };
2347 
2348 //-----------------------------------------------------------------------------
2349 // mpChart
2350 //-----------------------------------------------------------------------------
2354 {
2355  public:
2357  mpChart(const wxString &name = wxEmptyString);
2358 
2361  {
2362  Clear();
2363  }
2364 
2367  void SetChartValues(const std::vector<double> &data);
2368 
2371  void SetChartLabels(const std::vector<std::string> &labelArray);
2372 
2377  void AddData(const double &data, const std::string &label);
2378 
2382  virtual void Clear();
2383 
2384  virtual bool HasBBox()
2385  {
2386  return (values.size() > 0);
2387  }
2388 
2389  protected:
2390  std::vector<double> values;
2391  std::vector<std::string> labels;
2392 
2393  double m_max_value;
2394  double m_total_value;
2395 
2396  wxDECLARE_DYNAMIC_CLASS(mpChart);
2397 };
2398 
2399 //-----------------------------------------------------------------------------
2400 // mpBarChart - provided by Jose Davide Rondini
2401 //-----------------------------------------------------------------------------
2402 /* Defines for bar charts label positioning. */
2403 #define mpBAR_NONE 0
2404 #define mpBAR_AXIS_H 1
2405 #define mpBAR_AXIS_V 2
2406 #define mpBAR_INSIDE 3
2407 #define mpBAR_TOP 4
2408 
2409 
2412 {
2413  public:
2415  mpBarChart(const wxString &name = wxEmptyString, double width = 0.5);
2416 
2419  {
2420  Clear();
2421  }
2422 
2424  void SetBarColour(const wxColour &colour);
2425 
2427  void SetColumnWidth(const double colWidth)
2428  {
2429  m_width = colWidth;
2430  }
2431 
2433  void SetBarLabelPosition(int position);
2434 
2438  virtual double GetMinX();
2439 
2443  virtual double GetMaxX();
2444 
2448  virtual double GetMinY();
2449 
2453  virtual double GetMaxY();
2454 
2455  protected:
2456 
2457  double m_width;
2458  wxColour m_barColour;
2460  double m_labelAngle;
2461 
2466  virtual void DoPlot(wxDC &dc, mpWindow &w);
2467 
2468  wxDECLARE_DYNAMIC_CLASS(mpBarChart);
2469 };
2470 
2475 {
2476  public:
2480  mpPieChart(const wxString &name = wxEmptyString, double radius = 20);
2481 
2484  {
2485  Clear();
2486  colours.clear();
2487  }
2488 
2492  void SetCenter(const wxPoint center)
2493  {
2494  m_center = center;
2495  }
2496 
2500  wxPoint GetCenter(void) const
2501  {
2502  return m_center;
2503  }
2504 
2508  void SetPieColours(const std::vector<wxColour> &colourArray);
2509 
2513  virtual double GetMinX()
2514  {
2515  return m_center.x - m_radius;
2516  }
2517 
2521  virtual double GetMaxX()
2522  {
2523  return m_center.x + m_radius;
2524  }
2525 
2529  virtual double GetMinY()
2530  {
2531  return m_center.y - m_radius;
2532  }
2533 
2537  virtual double GetMaxY()
2538  {
2539  return m_center.y + m_radius;
2540  }
2541 
2542  protected:
2543 
2544  double m_radius;
2545  wxPoint m_center;
2546  std::vector<wxColour> colours;
2547 
2552  virtual void DoPlot(wxDC &dc, mpWindow &w);
2553 
2555  const wxColour& GetColour(unsigned int id);
2556 
2557  wxDECLARE_DYNAMIC_CLASS(mpBarChart);
2558 };
2559 
2562 //-----------------------------------------------------------------------------
2563 // mpLayer implementations - furniture (scales, ...)
2564 //-----------------------------------------------------------------------------
2573 {
2574  public:
2582  mpScale(const wxString &name, int flags, bool grids, mpLabelType labelType = mpLabel_AUTO, mpOptional_uint axisID = MP_OPTNULL_INT);
2583 
2587  virtual bool HasBBox()
2588  {
2589  return false;
2590  }
2591 
2595  int GetAxisID(void)
2596  {
2597  return m_axisID;
2598  }
2599 
2604  void SetAxisID(unsigned int yAxisID)
2605  {
2606  m_axisID = yAxisID;
2607  }
2608 
2611  void ShowTicks(bool ticks)
2612  {
2613  m_ticks = ticks;
2614  }
2615 
2618  bool GetShowTicks() const
2619  {
2620  return m_ticks;
2621  }
2622 
2625  void ShowGrids(bool grids)
2626  {
2627  m_grids = grids;
2628  }
2629 
2632  bool GetShowGrids() const
2633  {
2634  return m_grids;
2635  }
2636 
2641  void SetLabelFormat(const wxString &format, bool updateLabelMode = false)
2642  {
2643  m_labelFormat = format;
2644  if (updateLabelMode)
2645  m_labelType = mpLabel_USER;
2646  }
2647 
2651  {
2652  return m_labelType;
2653  }
2654 
2658  void SetLabelMode(mpLabelType mode, unsigned int time_conv = mpX_RAWTIME)
2659  {
2660  m_labelType = mode;
2661  m_timeConv = time_conv;
2662  }
2663 
2666  const wxString& GetLabelFormat() const
2667  {
2668  return m_labelFormat;
2669  }
2670 
2674  void SetGridPen(const wxPen &pen)
2675  {
2676  m_gridpen = pen;
2677  }
2678 
2682  const wxPen& GetGridPen() const
2683  {
2684  return m_gridpen;
2685  }
2686 
2690  void SetAuto(bool automaticScalingIsEnabled)
2691  {
2692  m_auto = automaticScalingIsEnabled;
2693  }
2694 
2698  bool GetAuto() const
2699  {
2700  return m_auto;
2701  }
2702 
2706  void SetMinScale(double min)
2707  {
2708  m_axisRange.SetMin(min);
2709  }
2710 
2714  double GetMinScale() const
2715  {
2716  return m_axisRange.min;
2717  }
2718 
2722  void SetMaxScale(double max)
2723  {
2724  m_axisRange.SetMax(max);
2725  }
2726 
2730  double GetMaxScale() const
2731  {
2732  return m_axisRange.max;
2733  }
2734 
2739  void SetScale(double min, double max)
2740  {
2741  m_axisRange.Set(min, max);
2742  }
2743 
2748  void GetScale(double *min, double *max) const
2749  {
2750  *min = m_axisRange.min;
2751  *max = m_axisRange.max;
2752  }
2753 
2758  {
2759  m_axisRange = range;
2760  }
2761 
2766  {
2767  return mpRange<double>(m_axisRange);
2768  }
2769 
2773  virtual bool IsLogAxis()
2774  {
2775  return m_isLog;
2776  }
2777 
2781  virtual void SetLogAxis(bool log)
2782  {
2783  m_isLog = log;
2784  }
2785 
2786  protected:
2787  static const wxCoord kTickSize = 4;
2788  static const wxCoord kAxisExtraSpace = 6;
2789 
2790  int m_axisID;
2791  wxPen m_gridpen;
2792  bool m_ticks;
2793  bool m_grids;
2794  bool m_auto;
2797  unsigned int m_timeConv;
2798  wxString m_labelFormat;
2799  bool m_isLog;
2800 
2803  virtual int GetOrigin(mpWindow &w) = 0;
2804 
2811  double GetStep(double scale, int minLabelSpacing);
2812 
2820  virtual void DrawScaleName(wxDC &dc, mpWindow &w, int origin, int labelSize) = 0;
2821 
2828  wxString FormatLabelValue(double value, double maxAxisValue, double step);
2829 
2834  wxString FormatLogValue(double n);
2835 
2843  int GetLabelWidth(double value, wxDC &dc, double maxAxisValue, double step);
2844 
2849  bool UseScientific(double maxAxisValue);
2850 
2856  int GetSignificantDigits(double step, double maxAxisValue);
2857 
2862  int GetDecimalDigits(double step);
2863 
2864  wxDECLARE_DYNAMIC_CLASS(mpScale);
2865 };
2866 
2867 
2874 {
2875  public:
2881  mpScaleX(const wxString &name = _T("X"), int flags = mpALIGN_CENTERX, bool grids = false, mpLabelType type = mpLabel_AUTO) :
2882  mpScale(name, flags, grids, type)
2883  {
2884  m_subtype = mpsScaleX;
2885  }
2886 
2888  bool IsTopAxis()
2889  {
2890  return ((GetAlign() == mpALIGN_BORDER_TOP) || (GetAlign() == mpALIGN_TOP));
2891  }
2892 
2895  {
2896  return ((GetAlign() == mpALIGN_BORDER_BOTTOM) || (GetAlign() == mpALIGN_BOTTOM));
2897  }
2898 
2899  protected:
2900 
2903  virtual void DoPlot(wxDC &dc, mpWindow &w);
2904 
2905  virtual int GetOrigin(mpWindow &w);
2906  virtual void DrawScaleName(wxDC &dc, mpWindow &w, int origin, int labelSize);
2907 
2908  wxDECLARE_DYNAMIC_CLASS(mpScaleX);
2909 };
2910 
2918 {
2919  public:
2927  mpScaleY(const wxString &name = _T("Y"), int flags = mpALIGN_CENTERY, bool grids = false, mpOptional_uint yAxisID = MP_OPTNULL_INT, mpLabelType labelType = mpLabel_AUTO) :
2928  mpScale(name, flags, grids, labelType, yAxisID)
2929  {
2930  m_subtype = mpsScaleY;
2931  m_axisWidth = Y_BORDER_SEPARATION;
2932  m_xPos = 0;
2933  }
2934 
2937  void UpdateAxisWidth(mpWindow &w);
2938 
2941  {
2942  return m_axisWidth;
2943  }
2944 
2946  bool IsLeftAxis()
2947  {
2948  return ((GetAlign() == mpALIGN_BORDER_LEFT) || (GetAlign() == mpALIGN_LEFT));
2949  }
2950 
2953  {
2954  return ((GetAlign() == mpALIGN_BORDER_RIGHT) || (GetAlign() == mpALIGN_RIGHT));
2955  }
2956 
2958  bool IsInside(wxCoord xPixel)
2959  {
2960  if ( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
2961  {
2962  return true;
2963  }
2964  return false;
2965  }
2966 
2967  protected:
2969  int m_xPos;
2970 
2973  virtual void DoPlot(wxDC &dc, mpWindow &w);
2974 
2975  virtual int GetOrigin(mpWindow &w);
2976  virtual void DrawScaleName(wxDC &dc, mpWindow &w, int origin, int labelSize);
2977 
2978  wxDECLARE_DYNAMIC_CLASS(mpScaleY);
2979 };
2980 
2981 //-----------------------------------------------------------------------------
2982 // mpWindow
2983 //-----------------------------------------------------------------------------
2984 
2990 #define mpMOUSEMODE_DRAG 0
2991 
2992 #define mpMOUSEMODE_ZOOMBOX 1
2993 
2996 //WX_DECLARE_HASH_MAP( int, mpLayer*, wxIntegerHash, wxIntegerEqual, mpLayerList );
2997 typedef std::deque<mpLayer*> mpLayerList;
2998 
3009 {
3010  mpScale* axis = nullptr;
3011  double scale = 1.0;
3012  double pos = 0;
3016 
3017  // Note: we don't use the default operator since we don't want to compare axis pointers
3019  bool operator==(const mpAxisData& other) const
3020  {
3021  return /*(axis == other.axis) && */ (scale == other.scale) && (pos == other.pos) &&
3022  (bound == other.bound) && (desired == other.desired);
3023  }
3024 };
3025 
3027 typedef std::unordered_map<int, mpAxisData> mpAxisList;
3028 
3035 typedef enum {
3036  uXAxis = 1,
3037  uYAxis = 2,
3038  uXYAxis = 3
3039 } mpAxisUpdate;
3040 
3050 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer;
3051 
3058 typedef std::function<void(void *Sender, wxMouseEvent &event, bool &cancel)> mpOnUserMouseAction;
3059 
3065 {
3066  public:
3067  mpMagnet()
3068  {
3069  m_IsDrawn = false;
3070  m_rightClick = false;
3071  m_IsWasDrawn = false;
3072  }
3073  ~mpMagnet()
3074  {
3075  ;
3076  }
3078  void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
3079  {
3080  m_domain = wxRect(left, top, width, height);
3081  m_plot_size = wxRect(left, top, width + left, height + top);
3082  }
3084  void UpdateBox(const wxRect &size)
3085  {
3086  m_domain = size;
3087  m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
3088  size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
3089  }
3091  void Plot(wxClientDC &dc, const wxPoint &mousePos);
3093  void ClearPlot(wxClientDC &dc);
3095  void UpdatePlot(wxClientDC &dc, const wxPoint &mousePos);
3097  void SaveDrawState(void)
3098  {
3099  m_IsWasDrawn = m_IsDrawn;
3100  // In any cases, set to false because we erase and repaint all the plot
3101  m_IsDrawn = false;
3102  }
3103 
3105  void SetRightClick(void)
3106  {
3107  m_rightClick = true;
3108  }
3109 
3110  private:
3111  wxRect m_domain;
3112  wxRect m_plot_size;
3113  wxPoint m_mousePosition;
3114  bool m_IsDrawn;
3115  bool m_IsWasDrawn;
3116  bool m_rightClick;
3117  void DrawCross(wxClientDC &dc) const;
3118 };
3119 
3141 class WXDLLIMPEXP_MATHPLOT mpWindow: public wxWindow
3142 {
3143  public:
3144  mpWindow()
3145  {
3146  InitParameters();
3147  }
3148 
3156  mpWindow(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
3157  long flags = 0);
3158 
3159  ~mpWindow();
3160 
3164  wxMenu* GetPopupMenu()
3165  {
3166  return &m_popmenu;
3167  }
3168 
3177  bool AddLayer(mpLayer *layer, bool refreshDisplay = true, bool refreshConfig = true);
3178 
3191  bool DelLayer(mpLayer *layer, mpDeleteAction alsoDeleteObject, bool refreshDisplay = true, bool refreshConfig = true);
3192 
3198  void DelAllLayers(mpDeleteAction alsoDeleteObject, bool refreshDisplay = true);
3199 
3206  void DelAllPlot(mpDeleteAction alsoDeleteObject, mpFunctionType func = mpfAllType, bool refreshDisplay = true);
3207 
3214  void DelAllYAxisAfterID(mpDeleteAction alsoDeleteObject, int yAxisID = 0, bool refreshDisplay = true);
3215 
3221  mpLayer* GetLayer(int position);
3222 
3227  int GetLayerPosition(mpLayer* layer);
3228 
3235  mpLayer* GetLayersType(int position, mpLayerType type);
3236 
3243  mpLayer* GetLayerPlot(int position, mpFunctionType func = mpfAllType);
3244 
3250  mpScale* GetLayerAxis(int position, mpScaleType scale = mpsAllType);
3251 
3260  mpFXYVector* GetXYSeries(unsigned int n, const wxString &name = _T("Serie "), bool create = true);
3261 
3270  mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy, double *xnear, double *ynear);
3271 
3276  mpLayer* GetLayerByName(const wxString &name);
3277 
3282  mpLayer* GetLayerByClassName(const wxString &name);
3283 
3287  void RefreshLegend(void);
3288 
3293  bool IsYAxisUsed(int yAxisID);
3294 
3298  mpScaleX* GetLayerXAxis();
3299 
3303  mpScaleY* GetLayerYAxis(int yAxisID);
3304 
3308  void SetScaleX(const double scaleX)
3309  {
3310  if (ISNOTNULL(scaleX))
3311  {
3312  m_AxisDataX.scale = scaleX;
3313  UpdateDesiredBoundingBox(uXAxis);
3314  }
3315  UpdateAll();
3316  }
3317 
3322  double GetScaleX(void) const
3323  {
3324  return m_AxisDataX.scale;
3325  }
3326 
3331  void SetScaleY(const double scaleY, int yAxisID)
3332  {
3333  assert(m_AxisDataYList.count(yAxisID) != 0);
3334  if (ISNOTNULL(scaleY))
3335  {
3336  m_AxisDataYList[yAxisID].scale = scaleY;
3337  UpdateDesiredBoundingBox(uYAxis);
3338  }
3339  UpdateAll();
3340  }
3341 
3347  double GetScaleY(int yAxisID)
3348  {
3349  assert(m_AxisDataYList.count(yAxisID) != 0);
3350  return m_AxisDataYList[yAxisID].scale;
3351  } // Schaling's method: maybe another method exists with the same name
3352 
3353  [[deprecated("Incomplete, use UpdateBBox instead")]]
3356  void SetBound();
3357 
3360  {
3361  return m_AxisDataX.bound;
3362  }
3363 
3366  {
3367  return m_AxisDataX.desired;
3368  }
3369 
3374  {
3375  assert(m_AxisDataYList.count(yAxisID) != 0);
3376  return m_AxisDataYList[yAxisID].bound;
3377  }
3378 
3383  {
3384  assert(m_AxisDataYList.count(yAxisID) != 0);
3385  return m_AxisDataYList[yAxisID].desired;
3386  }
3387 
3392  std::unordered_map<int, mpRange<double>> GetAllBoundY()
3393  {
3394  std::unordered_map<int, mpRange<double>> yRange;
3395  for (const MP_LOOP_ITER : m_AxisDataYList)
3396  {
3397  yRange[m_yID] = m_yData.bound;
3398  }
3399  return yRange;
3400  }
3401 
3406  std::unordered_map<int, mpRange<double>> GetAllDesiredY()
3407  {
3408  std::unordered_map<int, mpRange<double>> yRange;
3409  for (const MP_LOOP_ITER : m_AxisDataYList)
3410  {
3411  yRange[m_yID] = m_yData.desired;
3412  }
3413  return yRange;
3414  }
3415 
3419  void SetPosX(const double posX)
3420  {
3421  m_AxisDataX.pos = posX;
3422  UpdateDesiredBoundingBox(uXAxis);
3423  UpdateAll();
3424  }
3425 
3430  double GetPosX(void) const
3431  {
3432  return m_AxisDataX.pos;
3433  }
3434 
3439  void SetPosY(std::unordered_map<int, double>& posYList)
3440  {
3441  for (MP_LOOP_ITER : m_AxisDataYList)
3442  {
3443  m_yData.pos = posYList[m_yID];
3444  }
3445  UpdateDesiredBoundingBox(uYAxis);
3446  UpdateAll();
3447  }
3448 
3454  double GetPosY(int yAxisID)
3455  {
3456  assert(m_AxisDataYList.count(yAxisID) != 0);
3457  return m_AxisDataYList[yAxisID].pos;
3458  }
3459 
3463  int GetNOfYAxis(void) const
3464  {
3465  return (int)m_AxisDataYList.size();
3466  }
3467 
3471  mpAxisList GetAxisDataYList(void) const
3472  {
3473  return m_AxisDataYList;
3474  }
3475 
3479  std::map<int, mpAxisData> GetSortedAxisDataYList(void) const
3480  {
3481  return std::map<int, mpAxisData>(m_AxisDataYList.begin(), m_AxisDataYList.end());
3482  }
3483 
3489  void SetScreen(const int scrX, const int scrY)
3490  {
3491  m_scrX = scrX;
3492  m_scrY = scrY;
3493  m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
3494  m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
3495 
3496  m_plotBoundaries.endPx = m_scrX;
3497  m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
3498  m_plotBoundaries.endPy = m_scrY;
3499  m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
3500 
3501  m_PlotArea = wxRect(m_margin.left - m_extraMargin, m_margin.top - m_extraMargin,
3502  m_plotWidth + 2*m_extraMargin, m_plotHeight + 2*m_extraMargin);
3503 
3504  m_magnet.UpdateBox(m_PlotArea);
3505  }
3506 
3513  int GetScreenX(void) const
3514  {
3515  return m_scrX;
3516  }
3517 
3524  int GetScreenY(void) const
3525  {
3526  return m_scrY;
3527  }
3528 
3534  void SetPos(const double posX, std::unordered_map<int, double>& posYList)
3535  {
3536  m_AxisDataX.pos = posX;
3537  SetPosY(posYList);
3538  }
3539 
3543  inline double p2x(const wxCoord pixelCoordX) const
3544  {
3545  return m_AxisDataX.pos + (pixelCoordX / m_AxisDataX.scale);
3546  }
3547 
3551  inline double p2y(const wxCoord pixelCoordY, int yAxisID = 0)
3552  {
3553  assert(m_AxisDataYList.count(yAxisID) != 0);
3554  if (m_AxisDataYList.count(yAxisID) == 0)
3555  return 0.0;
3556  return m_AxisDataYList[yAxisID].pos - (pixelCoordY / m_AxisDataYList[yAxisID].scale);
3557  }
3558 
3562  inline wxCoord x2p(const double x) const
3563  {
3564  return (wxCoord)((x - m_AxisDataX.pos) * m_AxisDataX.scale);
3565  }
3566 
3570  inline wxCoord y2p(const double y, int yAxisID = 0)
3571  {
3572  assert(m_AxisDataYList.count(yAxisID) != 0);
3573  if (m_AxisDataYList.count(yAxisID) == 0)
3574  return 0;
3575  return (wxCoord)((m_AxisDataYList[yAxisID].pos - y) * m_AxisDataYList[yAxisID].scale);
3576  }
3577 
3580  void EnableDoubleBuffer(const bool enabled)
3581  {
3582  m_enableDoubleBuffer = enabled;
3583  }
3584 
3587  void EnableMousePanZoom(const bool enabled)
3588  {
3589  m_enableMouseNavigation = enabled;
3590  }
3591 
3597  void LockAspect(bool enable = true);
3598 
3603  inline bool IsAspectLocked() const
3604  {
3605  return m_lockaspect;
3606  }
3607 
3612  inline bool IsRepainting() const
3613  {
3614  return m_repainting;
3615  }
3616 
3621  void Fit();
3622 
3629  void Fit(const mpRange<double> &rangeX, std::unordered_map<int, mpRange<double>> rangeY, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
3630 
3634  void FitX(void);
3635 
3640  void FitY(int yAxisID);
3641 
3646  void ZoomIn(const wxPoint &centerPoint = wxDefaultPosition);
3647 
3652  void ZoomOut(const wxPoint &centerPoint = wxDefaultPosition);
3653 
3655  void ZoomInX();
3656 
3658  void ZoomOutX();
3659 
3662  void ZoomInY(mpOptional_int yAxisID = MP_OPTNULL_INT);
3663 
3666  void ZoomOutY(mpOptional_int yAxisID = MP_OPTNULL_INT);
3667 
3672  void ZoomRect(wxPoint p0, wxPoint p1);
3673 
3675  void UpdateAll();
3676 
3677  // Added methods by Davide Rondini
3678 
3682  unsigned int CountLayers();
3683 
3686  unsigned int CountAllLayers()
3687  {
3688  return (unsigned int)m_layers.size();
3689  }
3690 
3694  unsigned int CountLayersType(mpLayerType type);
3695 
3699  unsigned int CountLayersFXYPlot();
3700 
3709  {
3710  // Change on X axis
3711  if (update & uXAxis)
3712  {
3713  m_AxisDataX.desired.Set(m_AxisDataX.pos + (m_margin.left / m_AxisDataX.scale),
3714  m_AxisDataX.pos + ((m_margin.left + m_plotWidth) / m_AxisDataX.scale));
3715  }
3716 
3717  // Change on Y axis
3718  if (update & uYAxis)
3719  {
3720  for (MP_LOOP_ITER : m_AxisDataYList)
3721  {
3722  m_yData.desired.Set(m_yData.pos - ((m_margin.top + m_plotHeight) / m_yData.scale),
3723  m_yData.pos - (m_margin.top / m_yData.scale));
3724  }
3725  }
3726  }
3727 
3733  mpFloatRectSimple GetBoundingBox(bool desired, unsigned int yAxisID = 0)
3734  {
3735  assert(m_AxisDataYList.count(yAxisID) != 0);
3736  if (desired)
3737  return mpFloatRectSimple(m_AxisDataX.desired, m_AxisDataYList[yAxisID].desired);
3738  else
3739  return mpFloatRectSimple(m_AxisDataX.bound, m_AxisDataYList[yAxisID].bound);
3740  }
3741 
3745  double GetDesiredXmin() const
3746  {
3747  return m_AxisDataX.desired.min;
3748  }
3749 
3754  double GetDesiredXmax() const
3755  {
3756  return m_AxisDataX.desired.max;
3757  }
3758 
3764  double GetDesiredYmin(int yAxisID)
3765  {
3766  assert(m_AxisDataYList.count(yAxisID) != 0);
3767  return m_AxisDataYList[yAxisID].desired.min;
3768  }
3769 
3775  double GetDesiredYmax(int yAxisID)
3776  {
3777  assert(m_AxisDataYList.count(yAxisID) != 0);
3778  return m_AxisDataYList[yAxisID].desired.max;
3779  }
3780 
3782  bool GetBoundingBox(mpRange<double> *boundX, mpRange<double> *boundY, int yAxisID)
3783  {
3784  if (m_AxisDataYList.count(yAxisID) == 0)
3785  return false;
3786  *boundX = m_AxisDataX.bound;
3787  *boundY = m_AxisDataYList[yAxisID].bound;
3788  return true;
3789  }
3790 
3792  bool PointIsInsideBound(double px, double py, int yAxisID)
3793  {
3794  if (m_AxisDataYList.count(yAxisID) == 0)
3795  return false;
3796 
3797  return m_AxisDataX.bound.PointIsInside(px) && GetBoundY(yAxisID).PointIsInside(py);
3798  }
3799 
3805  void UpdateBoundingBoxToInclude(double px, double py, int yAxisID)
3806  {
3807  if (m_AxisDataYList.count(yAxisID) == 0)
3808  return ;
3809 
3810  m_AxisDataX.bound.Update(px);
3811  m_AxisDataYList[yAxisID].bound.Update(py);
3812  }
3813 
3814  /* Initialize bounding box with an initial point
3815  * @param px: point on x-axis
3816  * @param py: point on y-axis
3817  * @param yAxisID: the y-axis ID
3818  */
3820  void InitializeBoundingBox(double px, double py, int yAxisID)
3821  {
3822  if (m_AxisDataYList.count(yAxisID) == 0)
3823  return ;
3824 
3825  m_AxisDataX.bound.Set(px, px);
3826  m_AxisDataYList[yAxisID].bound.Set(py, py);
3827  }
3828 
3831  void SetMPScrollbars(bool status);
3832 
3835  bool GetMPScrollbars() const
3836  {
3837  return m_enableScrollBars;
3838  }
3839 
3845  bool SaveScreenshot(const wxString &filename, int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize, bool fit = false);
3846 
3850  wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize, bool fit = false);
3851 
3855  void ClipboardScreenshot(wxSize imageSize = wxDefaultSize, bool fit = false);
3856 
3860  void SetWildcard(const wxString &wildcard)
3861  {
3862  m_wildcard = wildcard;
3863  }
3864 
3868  const wxString& GetWildcard(void) const
3869  {
3870  return m_wildcard;
3871  }
3872 
3880  bool LoadFile(const wxString &filename = wxEmptyString);
3881 
3886  void SetDefaultDir(const wxString &dirname)
3887  {
3888  m_DefaultDir = dirname;
3889  }
3890 
3894 
3901  void SetMargins(int top, int right, int bottom, int left);
3902 
3905  {
3906  SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3907  }
3908 
3910  void SetMarginTop(int top)
3911  {
3912  SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3913  }
3914 
3918  int GetMarginTop(bool minusExtra = false) const
3919  {
3920  if (minusExtra)
3921  return m_margin.top - m_extraMargin;
3922  else
3923  return m_margin.top;
3924  }
3925 
3927  void SetMarginRight(int right)
3928  {
3929  SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
3930  }
3931 
3935  int GetMarginRight(bool minusExtra = false) const
3936  {
3937  if (minusExtra)
3938  return m_margin.right - m_extraMargin;
3939  else
3940  return m_margin.right;
3941  }
3942 
3945  {
3946  return m_marginOuter.right;
3947  }
3948 
3950  void SetMarginBottom(int bottom)
3951  {
3952  SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
3953  }
3954 
3958  int GetMarginBottom(bool minusExtra = false) const
3959  {
3960  if (minusExtra)
3961  return m_margin.bottom - m_extraMargin;
3962  else
3963  return m_margin.bottom;
3964  }
3965 
3967  void SetMarginLeft(int left)
3968  {
3969  SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
3970  }
3971 
3975  int GetMarginLeft(bool minusExtra = false) const
3976  {
3977  if (minusExtra)
3978  return m_margin.left - m_extraMargin;
3979  else
3980  return m_margin.left;
3981  }
3982 
3984  void SetExtraMargin(int extra)
3985  {
3986  m_extraMargin = extra;
3987  SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3988  }
3989 
3991  int GetExtraMargin() const
3992  {
3993  return m_extraMargin;
3994  }
3995 
3998  {
3999  return m_marginOuter.left;
4000  }
4001 
4003  int GetPlotWidth() const
4004  {
4005  return m_plotWidth;
4006  }
4007 
4009  int GetPlotHeight() const
4010  {
4011  return m_plotHeight;
4012  }
4013 
4018  mpRect GetPlotBoundaries(bool with_margin) const
4019  {
4020  mpRect bond;
4021  if (with_margin)
4022  bond = m_plotBoundariesMargin;
4023  else
4024  bond = m_plotBoundaries;
4025  bond.startPx -= m_extraMargin;
4026  bond.endPx += m_extraMargin;
4027  bond.startPy -= m_extraMargin;
4028  bond.endPy += m_extraMargin;
4029  return bond;
4030  }
4031 
4035  int GetLeftYAxesWidth(mpOptional_int yAxisID = MP_OPTNULL_INT);
4036 
4040  int GetRightYAxesWidth(mpOptional_int yAxisID = MP_OPTNULL_INT);
4041 
4043  void SetDrawBox(bool drawbox)
4044  {
4045  m_drawBox = drawbox;
4046  }
4047 
4049  bool GetDrawBox() const
4050  {
4051  return m_drawBox;
4052  }
4053 
4057  mpOptional_int IsInsideYAxis(const wxPoint &point);
4058 
4062  mpInfoLayer* IsInsideInfoLayer(const wxPoint &point);
4063 
4067  void SetLayerVisible(const wxString &name, bool viewable);
4068 
4072  bool IsLayerVisible(const wxString &name);
4073 
4077  bool IsLayerVisible(const unsigned int position);
4078 
4082  void SetLayerVisible(const unsigned int position, bool viewable);
4083 
4088  void SetColourTheme(const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour);
4089 
4092  const wxColour& GetAxesColour() const
4093  {
4094  return m_axColour;
4095  }
4096 
4098  const wxColour& GetbgColour() const
4099  {
4100  return m_bgColour;
4101  }
4102 
4104  void SetbgColour(const wxColour &colour)
4105  {
4106  m_bgColour = colour;
4107  }
4108 
4114  void SetOnDeleteLayer(const mpOnDeleteLayer &event)
4115  {
4116  m_OnDeleteLayer = event;
4117  }
4118 
4121  {
4122  m_OnDeleteLayer = NULL;
4123  }
4124 
4129  void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
4130  {
4131  m_OnUserMouseAction = userMouseEventHandler;
4132  }
4133 
4136  {
4137  m_OnUserMouseAction = NULL;
4138  }
4139 
4145  bool IsLogXaxis()
4146  {
4147  if (m_AxisDataX.axis)
4148  return ((mpScaleX *)m_AxisDataX.axis)->IsLogAxis();
4149  else
4150  return false;
4151  }
4152 
4156  bool IsLogYaxis(int yAxisID)
4157  {
4158  assert(m_AxisDataYList.count(yAxisID) != 0);
4159  mpScaleY* yAxis = GetLayerYAxis(yAxisID);
4160  if (yAxis)
4161  return yAxis->IsLogAxis();
4162  else
4163  return false;
4164  }
4165 
4167  void SetLogXaxis(bool log)
4168  {
4169  if (m_AxisDataX.axis)
4170  ((mpScaleX *)m_AxisDataX.axis)->SetLogAxis(log);
4171  }
4172 
4176  void SetLogYaxis(int yAxisID, bool log)
4177  {
4178  mpScaleY* yAxis = GetLayerYAxis(yAxisID);
4179  if (yAxis)
4180  yAxis->SetLogAxis(log);
4181  }
4182 
4187  bool GetMagnetize() const
4188  {
4189  return m_magnetize;
4190  }
4191 
4193  void SetMagnetize(bool mag)
4194  {
4195  m_magnetize = mag;
4196  }
4197 
4203  {
4204  m_mouseLeftDownAction = action;
4205  }
4206 
4212  {
4213  return m_mouseLeftDownAction;
4214  }
4215 
4216 #ifdef ENABLE_MP_CONFIG
4217  void RefreshConfigWindow();
4222  MathPlotConfigDialog* GetConfigWindow(bool Create = false);
4223  void DeleteConfigWindow(void);
4224 #endif // ENABLE_MP_CONFIG
4225 
4226  protected:
4227  virtual void BindEvents(void);
4228  virtual void OnPaint(wxPaintEvent &event);
4229  virtual void OnSize(wxSizeEvent &event);
4230  virtual void OnShowPopupMenu(wxMouseEvent &event);
4231  virtual void OnCenter(wxCommandEvent &event);
4232  virtual void OnFit(wxCommandEvent &event);
4233  virtual void OnToggleGrids(wxCommandEvent &event);
4234  virtual void OnToggleCoords(wxCommandEvent &event);
4235  virtual void OnScreenShot(wxCommandEvent &event);
4236  virtual void OnFullScreen(wxCommandEvent &event);
4237 #ifdef ENABLE_MP_CONFIG
4238  virtual void OnConfiguration(wxCommandEvent &event);
4239 #endif // ENABLE_MP_CONFIG
4240  virtual void OnLoadFile(wxCommandEvent &event);
4241  virtual void OnZoomIn(wxCommandEvent &event);
4242  virtual void OnZoomOut(wxCommandEvent &event);
4243  virtual void OnLockAspect(wxCommandEvent &event);
4244  virtual void OnMouseHelp(wxCommandEvent &event);
4245  virtual void OnMouseLeftDown(wxMouseEvent &event);
4246  virtual void OnMouseRightDown(wxMouseEvent &event);
4247  virtual void OnMouseMove(wxMouseEvent &event);
4248  virtual void OnMouseLeftRelease(wxMouseEvent &event);
4249  virtual void OnMouseWheel(wxMouseEvent &event);
4250  virtual void OnMouseLeave(wxMouseEvent &event);
4251  bool CheckUserMouseAction(wxMouseEvent &event);
4252  virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
4253  virtual void OnScrollPageUp(wxScrollWinEvent &event);
4254  virtual void OnScrollPageDown(wxScrollWinEvent &event);
4255  virtual void OnScrollLineUp(wxScrollWinEvent &event);
4256  virtual void OnScrollLineDown(wxScrollWinEvent &event);
4257  virtual void OnScrollTop(wxScrollWinEvent &event);
4258  virtual void OnScrollBottom(wxScrollWinEvent &event);
4259 
4261  void DoScrollCalc(const int position, const int orientation);
4262 
4267  void DoZoomXCalc(bool zoomIn, wxCoord staticXpixel = ZOOM_AROUND_CENTER);
4268 
4275  void DoZoomYCalc(bool zoomIn, wxCoord staticYpixel = ZOOM_AROUND_CENTER, mpOptional_int yAxisID = MP_OPTNULL_INT);
4276 
4281  void SetScaleXAndCenter(double scaleX);
4282 
4288  void SetScaleYAndCenter(double scaleY, int yAxisID);
4289 
4294  void Zoom(bool zoomIn, const wxPoint &centerPoint);
4295 
4298  virtual bool UpdateBBox();
4299 
4303  void InitParameters();
4304 
4305  wxTopLevelWindow* m_parent;
4307 
4308  mpLayerList m_layers;
4310  mpAxisList m_AxisDataYList;
4311 
4312  wxMenu m_popmenu;
4314  wxColour m_bgColour;
4315  wxColour m_fgColour;
4316  wxColour m_axColour;
4317  bool m_drawBox;
4318 
4319  int m_scrX;
4320  int m_scrY;
4323 
4327  wxCoord m_plotWidth;
4328  wxCoord m_plotHeight;
4329 
4332  wxRect m_PlotArea;
4333 
4337  wxBitmap* m_buff_bmp;
4342  wxPoint m_mouseRClick;
4343  wxPoint m_mouseLClick;
4344  double m_mouseScaleX;
4345  std::unordered_map<int, double> m_mouseScaleYList;
4352 
4353  wxBitmap* m_zoom_bmp;
4354  wxRect m_zoom_Dim;
4355 
4358 
4359  wxBitmap* m_Screenshot_bmp;
4360 
4361  wxString m_wildcard;
4362  wxString m_DefaultDir;
4363 
4364 #ifdef ENABLE_MP_CONFIG
4365  MathPlotConfigDialog* m_configWindow = NULL;
4366 #endif // ENABLE_MP_CONFIG
4367 
4368  mpOnDeleteLayer m_OnDeleteLayer = NULL;
4369  mpOnUserMouseAction m_OnUserMouseAction = NULL;
4370 
4374  virtual void DesiredBoundsHaveChanged() {};
4375 
4376  private:
4378  void CheckAndReportDesiredBoundsChanges();
4379 
4384  unsigned int GetNewAxisDataID(void)
4385  {
4386  int newID = 0;
4387  for (const MP_LOOP_ITER : m_AxisDataYList)
4388  {
4389  if(m_yData.axis)
4390  {
4391  // This ID is used by an axis. Make sure the new ID is larger
4392  newID = std::max(newID, m_yID + 1);
4393  }
4394  }
4395  return newID;
4396  }
4397 
4398  wxDECLARE_DYNAMIC_CLASS(mpWindow);
4399 
4400  // To have direct access to m_Screenshot_dc
4401  friend mpPrintout;
4402 };
4403 
4404 //-----------------------------------------------------------------------------
4405 // mpText - provided by Val Greene
4406 //-----------------------------------------------------------------------------
4407 
4416 {
4417  public:
4420  mpText(const wxString &name = wxEmptyString) : mpLayer(mpLAYER_TEXT)
4421  {
4422  m_subtype = mptText;
4423  SetName(name);
4424  m_offsetx = 5;
4425  m_offsety = 50;
4426  m_location = mpMarginNone;
4427  m_ZIndex = mpZIndex_TEXT;
4428  }
4429 
4433  mpText(const wxString &name, int offsetx, int offsety);
4434 
4438  mpText(const wxString &name, mpLocation marginLocation);
4439 
4442  virtual bool HasBBox()
4443  {
4444  return false;
4445  }
4446 
4449  void SetLocation(mpLocation location)
4450  {
4451  m_location = location;
4452  }
4453 
4456  mpLocation GetLocation() const
4457  {
4458  return m_location;
4459  }
4460 
4463  void SetOffset(int offX, int offY)
4464  {
4465  m_offsetx = offX;
4466  m_offsety = offY;
4467  }
4468 
4470  void GetOffset(int *offX, int *offY) const
4471  {
4472  *offX = m_offsetx;
4473  *offY = m_offsety;
4474  }
4475 
4476  protected:
4479  mpLocation m_location;
4480 
4483  virtual void DoPlot(wxDC &dc, mpWindow &w);
4484 
4485  wxDECLARE_DYNAMIC_CLASS(mpText);
4486 };
4487 
4492 {
4493  public:
4496  mpTitle();
4497 
4500  mpTitle(const wxString &name) :
4501  mpText(name, mpMarginTopCenter)
4502  {
4503  m_subtype = mptTitle;
4504  SetPen(*wxWHITE_PEN);
4505  SetBrush(*wxWHITE_BRUSH);
4506  }
4507 
4508  protected:
4509 
4510  wxDECLARE_DYNAMIC_CLASS(mpTitle);
4511 };
4512 
4513 //-----------------------------------------------------------------------------
4514 // mpPrintout - provided by Davide Rondini
4515 //-----------------------------------------------------------------------------
4516 
4521 class WXDLLIMPEXP_MATHPLOT mpPrintout: public wxPrintout
4522 {
4523  public:
4524  mpPrintout()
4525  {
4526  plotWindow = NULL;
4527  drawn = false;
4528  stretch_factor = 2;
4529  }
4530 
4536  mpPrintout(mpWindow *drawWindow, const wxString &title = _T("wxMathPlot print output"), int factor = 2);
4537  virtual ~mpPrintout()
4538  {
4539  ;
4540  }
4541 
4545  void SetDrawState(bool drawState)
4546  {
4547  drawn = drawState;
4548  }
4549 
4551  bool OnPrintPage(int page);
4553  bool HasPage(int page);
4554 
4557  void SetFactor(int factor)
4558  {
4559  stretch_factor = factor;
4560  }
4561 
4562  private:
4563  bool drawn;
4564  mpWindow* plotWindow;
4565  int stretch_factor; // To reduce the size of plot
4566 
4567  protected:
4568 
4569  wxDECLARE_DYNAMIC_CLASS(mpPrintout);
4570 };
4571 
4572 //-----------------------------------------------------------------------------
4573 // mpMovableObject - provided by Jose Luis Blanco
4574 //-----------------------------------------------------------------------------
4583 {
4584  public:
4588  m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
4589  {
4590  assert(m_type == mpLAYER_PLOT); // m_type is already set to mpLAYER_PLOT in default-arg mpFunction ctor: m_type = mpLAYER_PLOT;
4591  m_subtype = mpfMovable;
4592  }
4593 
4594  virtual ~mpMovableObject() {}
4595 
4598  void GetCoordinateBase(double &x, double &y, double &phi) const
4599  {
4600  x = m_reference_x;
4601  y = m_reference_y;
4602  phi = m_reference_phi;
4603  }
4604 
4607  void SetCoordinateBase(double x, double y, double phi = 0)
4608  {
4609  m_reference_x = x;
4610  m_reference_y = y;
4611  m_reference_phi = phi;
4612  m_flags = mpALIGN_SW;
4613  ShapeUpdated();
4614  }
4615 
4616  virtual bool HasBBox()
4617  {
4618  return m_trans_shape_xs.size() != 0;
4619  }
4620 
4623  virtual double GetMinX()
4624  {
4625  return m_bbox_x.min;
4626  }
4627 
4630  virtual double GetMaxX()
4631  {
4632  return m_bbox_x.max;
4633  }
4634 
4637  virtual double GetMinY()
4638  {
4639  return m_bbox_y.min;
4640  }
4641 
4644  virtual double GetMaxY()
4645  {
4646  return m_bbox_y.max;
4647  }
4648 
4649  protected:
4650 
4653  double m_reference_x;
4654  double m_reference_y;
4656 
4657  virtual void DoPlot(wxDC &dc, mpWindow &w);
4658 
4661  void TranslatePoint(double x, double y, double &out_x, double &out_y) const;
4662 
4663  // the object points, in local coordinates (to be transformed by the current transformation).
4664  std::vector<double> m_shape_xs;
4665  std::vector<double> m_shape_ys;
4666 
4667  // The buffer for the translated & rotated points (to avoid recomputing them with each mpWindow refresh).
4668  std::vector<double> m_trans_shape_xs;
4669  std::vector<double> m_trans_shape_ys;
4670 
4676 
4680  void ShapeUpdated();
4681 
4682  wxDECLARE_DYNAMIC_CLASS(mpMovableObject);
4683 };
4684 
4685 //-----------------------------------------------------------------------------
4686 // mpCovarianceEllipse - provided by Jose Luis Blanco
4687 //-----------------------------------------------------------------------------
4700 {
4701  public:
4705  mpCovarianceEllipse(double cov_00 = 1, double cov_11 = 1, double cov_01 = 0, double quantiles = 2, int segments = 32,
4706  const wxString &layerName = _T("")) : mpMovableObject(),
4707  m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
4708  {
4709  m_continuous = true;
4710  m_name = layerName;
4711  RecalculateShape();
4712  }
4713 
4714  virtual ~mpCovarianceEllipse()
4715  {
4716  ;
4717  }
4718 
4721  double GetQuantiles() const
4722  {
4723  return m_quantiles;
4724  }
4725 
4728  void SetQuantiles(double q)
4729  {
4730  m_quantiles = q;
4731  RecalculateShape();
4732  }
4733 
4735  void SetSegments(int segments)
4736  {
4737  m_segments = segments;
4738  }
4739 
4741  int GetSegments() const
4742  {
4743  return m_segments;
4744  }
4745 
4748  void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
4749  {
4750  cov_00 = m_cov_00;
4751  cov_01 = m_cov_01;
4752  cov_11 = m_cov_11;
4753  }
4754 
4757  void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
4758  {
4759  m_cov_00 = cov_00;
4760  m_cov_01 = cov_01;
4761  m_cov_11 = cov_11;
4762  RecalculateShape();
4763  }
4764 
4765  protected:
4768  double m_cov_00;
4769  double m_cov_11;
4770  double m_cov_01;
4771  double m_quantiles;
4772 
4776 
4779  void RecalculateShape();
4780 
4781  wxDECLARE_DYNAMIC_CLASS(mpCovarianceEllipse);
4782 };
4783 
4784 //-----------------------------------------------------------------------------
4785 // mpPolygon - provided by Jose Luis Blanco
4786 //-----------------------------------------------------------------------------
4792 {
4793  public:
4796  mpPolygon(const wxString &layerName = _T("")) : mpMovableObject()
4797  {
4798  m_continuous = true;
4799  m_name = layerName;
4800  }
4801 
4802  virtual ~mpPolygon()
4803  {
4804  ;
4805  }
4806 
4812  void setPoints(const std::vector<double> &points_xs, const std::vector<double> &points_ys, bool closedShape = true);
4813 
4814  protected:
4815 
4816  wxDECLARE_DYNAMIC_CLASS(mpPolygon);
4817 };
4818 
4819 //-----------------------------------------------------------------------------
4820 // mpBitmapLayer - provided by Jose Luis Blanco
4821 //-----------------------------------------------------------------------------
4827 {
4828  public:
4832  {
4833  m_validImg = false;
4834  m_bitmapChanged = false;
4835  m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
4836  }
4837 
4838  virtual ~mpBitmapLayer()
4839  {
4840  ;
4841  }
4842 
4845  void GetBitmapCopy(wxImage &outBmp) const;
4846 
4854  void SetBitmap(const wxImage &inBmp, double x, double y, double lx, double ly);
4855 
4858  virtual double GetMinX()
4859  {
4860  return m_bitmapX.min;
4861  }
4862 
4865  virtual double GetMaxX()
4866  {
4867  return m_bitmapX.max;
4868  }
4869 
4872  virtual double GetMinY()
4873  {
4874  return m_bitmapY.min;
4875  }
4876 
4879  virtual double GetMaxY()
4880  {
4881  return m_bitmapY.max;
4882  }
4883 
4884  protected:
4885 
4888  wxImage m_bitmap;
4889  wxBitmap m_scaledBitmap;
4892  bool m_validImg;
4894 
4899 
4900  virtual void DoPlot(wxDC &dc, mpWindow &w);
4901 
4902  wxDECLARE_DYNAMIC_CLASS(mpBitmapLayer);
4903 };
4904 
4905 // utility class
4906 
4908 typedef enum __mp_Colour
4909 {
4910  mpBlue,
4911  mpRed,
4912  mpGreen,
4913  mpPurple,
4914  mpYellow,
4915  mpFuchsia,
4916  mpLime,
4917  mpAqua,
4918  mpOlive
4919 } mpColour;
4920 
4925 class WXDLLIMPEXP_MATHPLOT wxIndexColour: public wxColour
4926 {
4927  public:
4932  wxIndexColour(unsigned int id)
4933  {
4934  switch (id)
4935  {
4936  case 0:
4937  this->Set(0, 0, 255);
4938  break; // Blue
4939  case 1:
4940  this->Set(255, 0, 0);
4941  break; // Red
4942  case 2:
4943  this->Set(0, 128, 0);
4944  break; // Green
4945  case 3:
4946  this->Set(128, 0, 128);
4947  break; // Purple
4948  case 4:
4949  this->Set(255, 255, 0);
4950  break; // Yellow
4951  case 5:
4952  this->Set(255, 0, 255);
4953  break; // Fuchsia
4954  case 6:
4955  this->Set(0, 255, 0);
4956  break; // Lime
4957  case 7:
4958  this->Set(0, 255, 255);
4959  break; // Aqua/Cyan
4960  case 8:
4961  this->Set(128, 128, 0);
4962  break; // Olive
4963  default:
4964  this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
4965  (ChannelType)((rand() * 255) / RAND_MAX));
4966  }
4967  }
4968 };
4969 
4972 // ---------------------------------------------------------------------
4973 #ifdef ENABLE_MP_NAMESPACE
4974  }// namespace MathPlot
4975  // No, iff build enables namespace, its up to app to use it appropriately: using namespace MathPlot;
4976 #endif // ENABLE_MP_NAMESPACE
4977 
4978 #endif // MATHPLOT_H_INCLUDED
sub type for mpFXYVector function
Definition: mathplot.h:739
int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:4478
const wxString & GetLabelFormat() const
Get axis Label format (used for mpLabel_AUTO draw mode).
Definition: mathplot.h:2666
std::function< void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer
Define an event for when we delete a layer.
Definition: mathplot.h:3050
bool IsHorizontal(void) const
Is it a horizontal line?
Definition: mathplot.h:1677
__mp_Location_Type
Location for the Info layer.
Definition: mathplot.h:641
int GetAxisID(void)
Return the ID of the Axis.
Definition: mathplot.h:2595
mpRange< double > m_rangeY
Y range.
Definition: mathplot.h:2266
sub type for mpText layer
Definition: mathplot.h:728
Align the plot label towards the southeast.
Definition: mathplot.h:680
void SetValue(const double value)
Set x or y value.
Definition: mathplot.h:1669
mpInfoLegend * m_InfoLegend
Pointer to the optional info legend layer.
Definition: mathplot.h:4350
Draw a circle.
Definition: mathplot.h:703
enum __YAxis_Align_Type mpYAxis_Align
Alignment for Y axis.
Show legend items with small square with the same color of referred mpLayer.
Definition: mathplot.h:688
mpRect m_marginOuter
Margin around the plot exluding Y-axis. Default 50.
Definition: mathplot.h:4325
bool m_isLog
Is the axis a log axis ?
Definition: mathplot.h:2799
bool m_LegendIsAlwaysVisible
If true, the name is visible in the legend despite the visibility of the function. Default true.
Definition: mathplot.h:1634
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:3580
wxIndexColour(unsigned int id)
Constructor.
Definition: mathplot.h:4932
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:1052
bool IsLogYaxis(int yAxisID)
Get the log property (true or false) Y layer (Y axis) with a specific Y ID or false if not found...
Definition: mathplot.h:4156
std::vector< std::string > labels
Labels of the Values.
Definition: mathplot.h:2391
enum __mp_Colour mpColour
Enumeration of classic colour.
Bitmap type layer.
Definition: mathplot.h:818
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:1173
#define MP_LOOP_ITER
Helper macro for iterating through axis maps without structured binding.
Definition: mathplot.h:131
mpLegendDirection m_item_direction
Layout direction used when arranging legend entries.
Definition: mathplot.h:1477
__Scale_Type
sub_type values for mpLAYER_AXIS
Definition: mathplot.h:746
Plot type layer.
Definition: mathplot.h:803
int GetScreenX(void) const
Get current view&#39;s X dimension in device context units.
Definition: mathplot.h:3513
void SetLegendIsAlwaysVisible(bool alwaysVisible)
Set the visibility of the name of the function in the legend despite the visibility of the function i...
Definition: mathplot.h:1614
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:4879
bool IsRightAxis()
Return true if this Y axis is aligned to the right side.
Definition: mathplot.h:2952
void SetLabelMode(mpLabelType mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:1366
void UnSetOnDeleteLayer()
Remove the &#39;delete layer event&#39; callback.
Definition: mathplot.h:4120
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1732
void SetYAxisID(unsigned int yAxisID)
Set the ID of the Y axis used by the function.
Definition: mathplot.h:1606
mpLegendStyle GetItemMode() const
Get the current legend item drawing mode.
Definition: mathplot.h:1447
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:4791
void SetScaleX(const double scaleX)
Set current view&#39;s X scale and refresh display.
Definition: mathplot.h:3308
mpFloatRectSimple(mpRange< double > _x, mpRange< double > _y)
Construct a simple rectangular box.
Definition: mathplot.h:586
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:930
__Symbol_Type
Displaying a symbol instead of a point in the plot function.
Definition: mathplot.h:700
double m_deltaY
Min delta between 2 consecutive coordinate on y direction.
Definition: mathplot.h:1963
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:252
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:2009
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:4321
Show legend items with line with the same pen of referred mpLayer.
Definition: mathplot.h:687
__mp_Layer_Type
Major type of an mpLayer (detail is in subtype)
Definition: mathplot.h:799
Show/Hide grids.
Definition: mathplot.h:629
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:4826
int m_axisID
Unique ID that identify this axis. Default -1 mean that axis is not used.
Definition: mathplot.h:2790
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:4356
void InitializeBoundingBox(double px, double py, int yAxisID)
Initialize the bounding box from a first point for the selected Y axis.
Definition: mathplot.h:3820
mpLabelType
enum for label for grid
Definition: mathplot.h:771
void Update(T value)
Update range according new value: Expand the range to include the value.
Definition: mathplot.h:366
bool m_mouseMovedAfterRightClick
If the mouse does not move after a right click, then the context menu is displayed.
Definition: mathplot.h:4341
Classic Normal distribution f(x) = exp(-(ln(x)-μ)²/2σ²)/(xσ.sqrt(2π))
Definition: mathplot.h:2313
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:2529
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:4342
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:2513
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:4796
double m_lastX
Last x-coordinate point added.
Definition: mathplot.h:2091
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:2632
std::unordered_map< int, mpAxisData > mpAxisList
Define the type for the list of axis.
Definition: mathplot.h:3027
wxCoord y2p(const double y, int yAxisID=0)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:3570
enum __Plot_Align_Name_Type mpPlot_Align
Plot alignment (which corner should plot be placed)
mpRange< double > m_bitmapX
The shape of the bitmap:
Definition: mathplot.h:4897
Layer type undefined; SHOULD NOT BE USED.
Definition: mathplot.h:801
enum __mp_Direction_Type mpLegendDirection
Direction for the Legend layer.
__mp_Delete_Action
Action to do with the object associated to the layer when we delete it.
Definition: mathplot.h:834
sub type not defined (should be never used)
Definition: mathplot.h:748
wxString m_name
Layer&#39;s name.
Definition: mathplot.h:1172
void SetMagnetize(bool mag)
Enable or disable mouse-position magnet lines (cross-hairs) in the plot area.
Definition: mathplot.h:4193
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:1165
double m_cov_11
Covariance matrix element (1,1).
Definition: mathplot.h:4769
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1653
Lock x/y scaling aspect.
Definition: mathplot.h:628
virtual double GetMinY()
Get min Y of the function.
Definition: mathplot.h:2251
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:1440
wxString m_wildcard
For loadfile() function when we use wxFileDialog.
Definition: mathplot.h:4361
Align the info in margin center-bottom.
Definition: mathplot.h:649
int m_axisWidth
Reserved width for this Y axis including labels, in pixels.
Definition: mathplot.h:2968
Info box type layer.
Definition: mathplot.h:823
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:4477
void SetLabelMode(mpLabelType mode, unsigned int time_conv=0x20)
Set axis label view mode.
Definition: mathplot.h:2658
Abstract class providing a line.
Definition: mathplot.h:1641
mpRange< double > m_rangeX
Range min and max on x axis.
Definition: mathplot.h:2090
Abstract class providing an vertical line.
Definition: mathplot.h:1719
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:2618
void SetCenter(const wxPoint center)
Set the center of the pie chart.
Definition: mathplot.h:2492
bool IsLeftAxis()
Return true if this Y axis is aligned to the left side.
Definition: mathplot.h:2946
double m_reference_y
Current object Y position in plot coordinates.
Definition: mathplot.h:4654
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:3141
mpRange< int > m_drawY
Range min and max on y axis.
Definition: mathplot.h:1959
wxString m_DefaultDir
The default directory for wxFileDialog.
Definition: mathplot.h:4362
enum __Info_Type mpInfoType
sub_type values for mpLAYER_INFO
#define Y_BORDER_SEPARATION
Default minimum separation in pixels between Y axes and the plot border.
Definition: mathplot.h:196
wxPen m_gridpen
Grid&#39;s pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition: mathplot.h:2791
int m_labelPos
Bar-label placement mode.
Definition: mathplot.h:2459
int GetNOfYAxis(void) const
Get the number of Y axis.
Definition: mathplot.h:3463
double p2y(const wxCoord pixelCoordY, int yAxisID=0)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:3551
std::vector< double > m_ys
internal copy of the set of data on y direction
Definition: mathplot.h:2080
void SetExtraMargin(int extra)
Set the extra margin.
Definition: mathplot.h:3984
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, mpOptional_uint yAxisID=-1, mpLabelType labelType=mpLabel_AUTO)
Full constructor.
Definition: mathplot.h:2927
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:1312
bool m_bitmapChanged
True when the cached scaled bitmap must be regenerated.
Definition: mathplot.h:4893
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:4607
Chart type layer (bar chart)
Definition: mathplot.h:808
mpRange< double > x
range over x direction
Definition: mathplot.h:578
double GetPosY(int yAxisID)
Get current view&#39;s Y position.
Definition: mathplot.h:3454
virtual void SetLogAxis(bool log)
Set Logarithmic mode.
Definition: mathplot.h:2781
double GetQuantiles() const
Get the confidence-interval multiplier used for the ellipse.
Definition: mathplot.h:4721
sub type for mpLine function
Definition: mathplot.h:741
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:1029
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:3603
int m_winY
Cached mpWindow height, used to rescale the info box position when the window is resized.
Definition: mathplot.h:1315
~mpBarChart()
Destructor.
Definition: mathplot.h:2418
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:3543
T GetMaxAbs(void) const
Max absolute value of the range.
Definition: mathplot.h:421
Draw a cross X.
Definition: mathplot.h:707
void Update(mpRange range)
Update range with new range values if this expand the range.
Definition: mathplot.h:388
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:1180
double m_width
Width of each bar/column in plot units.
Definition: mathplot.h:2457
Draw a triangle up oriented.
Definition: mathplot.h:705
wxTopLevelWindow * m_parent
Pointer to the top-level window containing the plot (used for fullscreen)
Definition: mathplot.h:4305
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:4343
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:4374
T min
The min value of the range.
Definition: mathplot.h:286
bool m_InInfoLegend
Boolean value indicating that the mouse is moving over the legend area.
Definition: mathplot.h:4351
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:1037
No alignment.
Definition: mathplot.h:651
int m_flags
Holds label alignment. Default : mpALIGN_SW for series and mpALIGN_CENTER for scale.
Definition: mathplot.h:1177
mpRange< double > m_bbox_x
The precomputed bounding box:
Definition: mathplot.h:4674
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:4442
Mouse action drag the plot.
Definition: mathplot.h:767
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:914
mpNormal(double mu, double sigma)
Classic Normal distribution.
Definition: mathplot.h:2321
wxPoint GetPosition() const
Get the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:1276
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:1395
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:1083
~mpPieChart()
Destructor.
Definition: mathplot.h:2483
mpRange()
Default constructor.
Definition: mathplot.h:290
T max
The max value of the range.
Definition: mathplot.h:287
sub type not defined (should be never used)
Definition: mathplot.h:757
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1630
void SetDefaultDir(const wxString &dirname)
Set the default directory for wxFileDialog.
Definition: mathplot.h:3886
enum __Function_Type mpFunctionType
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
sub type not defined (should be never used)
Definition: mathplot.h:735
void Check(void)
Check to always have a range. If min = max then introduce the 0 to make a range.
Definition: mathplot.h:397
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:4003
sub type not defined (should be never used)
Definition: mathplot.h:727
double m_lastY
Last y-coordinate point added.
Definition: mathplot.h:2093
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:1167
T GetCenter(void) const
Center of the range.
Definition: mathplot.h:415
Just the end of ZOrder.
Definition: mathplot.h:825
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:4637
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
Definition: mathplot.h:816
void Set(T _value)
Initialize min and max.
Definition: mathplot.h:312
mpRange< double > m_axisRange
Range axis values when autosize is false.
Definition: mathplot.h:2795
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:3927
static double m_zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:3893
double m_cov_01
Covariance matrix element (0,1), equal to element (1,0).
Definition: mathplot.h:4770
void SetContinuity(bool continuity)
Set the &#39;continuity&#39; property of the layer.
Definition: mathplot.h:1534
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition: mathplot.h:3997
Draw a plus +.
Definition: mathplot.h:708
void SetMouseLeftDownAction(mpMouseButtonAction action)
Set the type of action for the left mouse button.
Definition: mathplot.h:4202
wxMenu m_popmenu
Canvas&#39; context menu.
Definition: mathplot.h:4312
Keep the object, just remove the layer from the layer list.
Definition: mathplot.h:836
double m_mu
Mean value.
Definition: mathplot.h:2298
double m_mouseScaleX
Store current X-scale, used as reference during drag zooming.
Definition: mathplot.h:4344
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1820
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1884
enum __mp_Style_Type mpLegendStyle
Style for the Legend layer.
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:4316
wxColour m_barColour
Fill colour used for the bars.
Definition: mathplot.h:2458
Delete the object regardless of the CanDelete value and remove it from the layer list.
Definition: mathplot.h:838
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:1175
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:4330
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:4598
std::function< void(void *Sender, wxMouseEvent &event, bool &cancel)> mpOnUserMouseAction
Define an event for when we have a mouse click Use like this : your_plot->SetOnUserMouseAction([this]...
Definition: mathplot.h:3058
Align the plot label towards the southwest.
Definition: mathplot.h:681
Implement the legend to be added to the plot This layer allows you to add a legend to describe the pl...
Definition: mathplot.h:1422
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2873
double m_quantiles
Confidence-interval multiplier used when drawing the ellipse.
Definition: mathplot.h:4771
Align the y-axis towards left border.
Definition: mathplot.h:668
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:1176
#define ISNOTNULL(x)
Nullity test according small epsilon.
Definition: mathplot.h:208
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:4449
Align the x-axis towards bottom border.
Definition: mathplot.h:658
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:2384
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:3587
void Assign(T value1, T value2)
Assign values to min and max.
Definition: mathplot.h:342
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:4317
Plot (function) type layer.
Definition: mathplot.h:821
void UpdateDesiredBoundingBox(mpAxisUpdate update)
Update m_desired bounds.
Definition: mathplot.h:3708
void UpdateBoundingBoxToInclude(double px, double py)
Update bounding box (X and Y axis) to include this point.
Definition: mathplot.h:602
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:2682
bool m_IsHorizontal
Is the line horizontal? Default false.
Definition: mathplot.h:1684
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:1179
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1570
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:867
wxFont m_font
Layer&#39;s font.
Definition: mathplot.h:1168
bool GetCanDelete(void) const
Retreive what we do with the object associated with the layer when we delete the layer.
Definition: mathplot.h:1152
Axis type layer.
Definition: mathplot.h:819
Dialog box for configuring the plot&#39;s layer objects In this dialog, you can configure: ...
Definition: MathPlotConfig.h:154
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:2537
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:2794
Draw a triangle down oriented.
Definition: mathplot.h:706
wxCoord m_mouseY
Last mouse Y position in window pixel coordinates.
Definition: mathplot.h:1405
Axis type layer.
Definition: mathplot.h:802
void SetCanDelete(bool canDelete)
Set what we do with the object associated with the layer when we delete the layer.
Definition: mathplot.h:1145
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:4858
bool GetMagnetize() const
Is mouse magnetization enabled? Useful to read the position on the axes.
Definition: mathplot.h:4187
double m_value
The x or y coordinates of the line.
Definition: mathplot.h:1683
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:4348
wxPen m_penSeries
Pen used to draw the series marker when series-coordinate mode is active.
Definition: mathplot.h:1407
wxPoint m_center
Center of the pie chart in device coordinates.
Definition: mathplot.h:2545
std::vector< double > m_trans_shape_ys
Transformed shape vertices in Y coordinates.
Definition: mathplot.h:4669
mpLabelType m_labelType
Select labels mode: mpLabel_AUTO for normal labels, mpLabel_TIME for time axis in hours...
Definition: mathplot.h:2796
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:1351
void UpdateBox(const wxRect &size)
Update the drawable magnet area from a wxRect.
Definition: mathplot.h:3084
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:2625
Align the info in margin center-right.
Definition: mathplot.h:647
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:4092
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:1062
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition: mathplot.h:2997
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:2156
void SetDrawState(bool drawState)
Set whether the plot has already been drawn on the current printout.
Definition: mathplot.h:4545
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:4420
mpRange< double > lastDesired
Last desired ranged, used for check if desired has changed.
Definition: mathplot.h:3015
double m_const
Const factor.
Definition: mathplot.h:2301
std::unordered_map< int, mpRange< double > > GetAllBoundY()
Returns the bounds for all Y-axes.
Definition: mathplot.h:3392
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:4888
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:4129
void UpdateBoundingBoxToInclude(double px, double py, int yAxisID)
Ensure the bounding box includes the given point for the selected Y axis.
Definition: mathplot.h:3805
each visible plot is described on its own line, one above the other
Definition: mathplot.h:695
void SetPosX(const double posX)
Set current view&#39;s X position and refresh display.
Definition: mathplot.h:3419
int m_xPos
Leftmost X pixel occupied by this axis (starting point).
Definition: mathplot.h:2969
Align the x-axis towards top plot.
Definition: mathplot.h:661
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:1159
mpRange< double > bound
Range min and max.
Definition: mathplot.h:3013
Set label for axis in auto mode, automatically switch between decimal and scientific notation...
Definition: mathplot.h:774
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:4009
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:1381
#define EPSILON
An epsilon for float comparison to 0.
Definition: mathplot.h:206
Align the y-axis towards right border.
Definition: mathplot.h:672
__Info_Type
sub_type values for mpLAYER_INFO
Definition: mathplot.h:716
std::unordered_map< int, mpRange< double > > GetAllDesiredY()
Returns the desired bounds for all Y-axes.
Definition: mathplot.h:3406
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:2088
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:4865
Show/Hide info coord.
Definition: mathplot.h:630
Align the x-axis towards top border.
Definition: mathplot.h:662
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:1076
Mouse action draw a box to zoom inside.
Definition: mathplot.h:766
mpFXGeneric(const wxString &name=wxT("Generic FX function"), int flags=mpALIGN_LEFT, unsigned int yAxisID=0)
Definition: mathplot.h:2218
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:4757
__Function_Type
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
Definition: mathplot.h:733
Classic Gaussian distribution f(x) = exp(-(x-μ)²/2σ²)/sqrt(2πσ²)
Definition: mathplot.h:2280
#define WXDLLIMPEXP_MATHPLOT
Definition uses windows dll to export function.
Definition: mathplot.h:77
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:4521
Align the y-axis towards left plot.
Definition: mathplot.h:669
int m_last_ly
Last logical Y origin, used for double buffering.
Definition: mathplot.h:4336
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:4357
wxSize GetSize() const
Get the size of the box (in pixels)
Definition: mathplot.h:1283
Chart type layer.
Definition: mathplot.h:822
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:2793
Set label for axis in scientific notation.
Definition: mathplot.h:778
enum __mp_Location_Type mpLocation
Location for the Info layer.
void Update(T _min, T _max)
Update range with new min and max values if this expand the range If _min < min then min = _min and i...
Definition: mathplot.h:378
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:1310
Copy a screen shot to the clipboard.
Definition: mathplot.h:631
Create a generic FX function Override the ComputeY() function with your function. ...
Definition: mathplot.h:2211
Fit view to match bounding box of all layers.
Definition: mathplot.h:624
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:4456
bool PointIsInside(double px, double py) const
Is point inside this bounding box?
Definition: mathplot.h:593
Toggle fullscreen only if parent is a frame windows.
Definition: mathplot.h:637
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:4337
mpRange< double > m_bitmapY
Range of the bitmap on y direction.
Definition: mathplot.h:4898
Center view on click position.
Definition: mathplot.h:627
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1632
mpLegendStyle m_item_mode
Visual style used for each legend entry.
Definition: mathplot.h:1476
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:2021
__XAxis_Align_Type
Alignment for X axis.
Definition: mathplot.h:656
sub type for all layers who are function.
Definition: mathplot.h:742
Draw a square.
Definition: mathplot.h:704
mpRange< double > GetBoundX(void) const
Get bounding box for X axis.
Definition: mathplot.h:3359
bool operator==(const mpAxisData &other) const
Compare axis data while ignoring the axis pointer itself.
Definition: mathplot.h:3019
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:4582
double m_variance
Sigma² is the variance.
Definition: mathplot.h:2333
Align the x-axis center plot.
Definition: mathplot.h:660
__Text_Type
sub_type values for mpLAYER_TEXT
Definition: mathplot.h:725
double m_radius
Radius of the pie chart in pixels.
Definition: mathplot.h:2544
double m_deltaX
Min delta between 2 consecutive coordinate on x direction.
Definition: mathplot.h:1962
__mp_Colour
Enumeration of classic colour.
Definition: mathplot.h:4908
mpRange< double > GetDesiredBoundY(int yAxisID)
Get desired bounding box for Y axis of ID yAxisID.
Definition: mathplot.h:3382
int m_BarWidth
Bar width in pixels when the XY series is drawn in bar mode.
Definition: mathplot.h:1965
Align the plot label towards the northwest.
Definition: mathplot.h:678
double m_total_value
Total of the values vector.
Definition: mathplot.h:2394
mpAxisList m_AxisDataYList
List of axis data for the Y direction.
Definition: mathplot.h:4310
void SetMinScale(double min)
Set the minimum of the scale range when we are in automatic mode.
Definition: mathplot.h:2706
void SetbgColour(const wxColour &colour)
Set the plot background colour.
Definition: mathplot.h:4104
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1910
std::vector< double > m_shape_xs
Shape vertices in object-local X coordinates.
Definition: mathplot.h:4664
virtual bool IsLogAxis()
Get if we are in Logarithmic mode.
Definition: mathplot.h:2773
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1577
mpRange< double > desired
Desired range min and max.
Definition: mathplot.h:3014
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, mpLabelType type=mpLabel_AUTO)
Full constructor.
Definition: mathplot.h:2881
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:4925
int m_yAxisID
The ID of the Y axis used by the function. Equal 0 if no axis.
Definition: mathplot.h:1633
mpRange(T value1, T value2)
Create range with the 2 values.
Definition: mathplot.h:297
bool IsTopAxis()
Return true when this X axis is aligned at the top edge or top border.
Definition: mathplot.h:2888
bool GetContinuity() const
Gets the &#39;continuity&#39; property of the layer.
Definition: mathplot.h:1542
int m_extraMargin
Extra margin around the plot. Default 8.
Definition: mathplot.h:4326
No symbol is drawing.
Definition: mathplot.h:702
Layer for bar chart.
Definition: mathplot.h:2411
mpFloatRectSimple GetBoundingBox(bool desired, unsigned int yAxisID=0)
Return a bounding box for an y-axis ID.
Definition: mathplot.h:3733
__Chart_Type
sub_type values for mpLAYER_CHART
Definition: mathplot.h:755
wxPen m_pen
Layer&#39;s pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:1170
wxCoord m_scaledBitmap_offset_x
Cached X pixel offset used when drawing the scaled bitmap.
Definition: mathplot.h:4890
virtual double ComputeY(double x)
The main computation of the FX function.
Definition: mathplot.h:2336
double m_variance
Sigma² is the variance.
Definition: mathplot.h:2300
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:1401
abstract Layer for chart (bar and pie).
Definition: mathplot.h:2353
Show legend items with symbol used with the referred mpLayer.
Definition: mathplot.h:689
Define a simple rectangular box X refer to X axis Y refer to Y axis.
Definition: mathplot.h:576
sub type for all layers who are chart.
Definition: mathplot.h:760
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:1045
unsigned int mpOptional_uint
Optional unsigned integer fallback type used when std::optional is unavailable.
Definition: mathplot.h:120
Align the info in margin center-left.
Definition: mathplot.h:643
void SetLabelFormat(const wxString &format, bool updateLabelMode=false)
Set axis Label format (used for mpLabel_AUTO draw mode).
Definition: mathplot.h:2641
const wxRect & GetRectangle() const
Get the current rectangle coordinates.
Definition: mathplot.h:1290
double GetDesiredXmin() const
Returns the left-border layer coordinate that the user wants the mpWindow to show (it may be not exac...
Definition: mathplot.h:3745
Set label for axis in decimal notation, with number of decimals automatically calculated based on zoo...
Definition: mathplot.h:776
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition: mathplot.h:676
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1629
double GetDesiredYmin(int yAxisID)
Return the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exa...
Definition: mathplot.h:3764
void ToLog(void)
Convert to log range.
Definition: mathplot.h:427
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:3950
mpRange< double > m_rangeY
Range min and max on y axis.
Definition: mathplot.h:2092
bool operator!=(const mpRange &other) const
Compare two ranges for inequality.
Definition: mathplot.h:448
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:2041
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1631
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:4872
void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
Update the drawable magnet area from raw rectangle coordinates.
Definition: mathplot.h:3078
sub type for mpInfoLegend layer
Definition: mathplot.h:721
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:2698
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:2119
void SetLogXaxis(bool log)
Enable or disable logarithmic scaling on the X axis.
Definition: mathplot.h:4167
int GetMarginRight(bool minusExtra=false) const
Get the right margin.
Definition: mathplot.h:3935
mpRange< int > m_drawX
Range min and max on x axis.
Definition: mathplot.h:1958
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1705
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:2061
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:2071
double GetDesiredYmax(int yAxisID)
Return the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactl...
Definition: mathplot.h:3775
bool GetLegendIsAlwaysVisible() const
Get the visibility of the legend.
Definition: mathplot.h:1622
Text box type layer.
Definition: mathplot.h:805
mpMouseButtonAction GetMouseLeftDownAction()
Returns the type of action for the left mouse button.
Definition: mathplot.h:4211
double pos
Position.
Definition: mathplot.h:3012
void UpdateMargins()
Update margins if e.g.
Definition: mathplot.h:3904
__YAxis_Align_Type
Alignment for Y axis.
Definition: mathplot.h:666
sub type for mpBarChart
Definition: mathplot.h:758
wxRect m_PlotArea
The full size of the plot with m_extraMargin.
Definition: mathplot.h:4332
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:1225
Load a file.
Definition: mathplot.h:635
enum __Symbol_Type mpSymbol
Displaying a symbol instead of a point in the plot function.
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:879
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:4470
bool m_fullscreen
Boolean value indicating that we are in fullscreen mode (default false)
Definition: mathplot.h:4306
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:4327
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:1252
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:887
Line (horizontal or vertical) type layer.
Definition: mathplot.h:820
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:4353
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:1335
double m_mu
Mean value.
Definition: mathplot.h:2331
int m_winX
Cached mpWindow width, used to rescale the info box position when the window is resized.
Definition: mathplot.h:1314
mpRange< double > y
range over y direction
Definition: mathplot.h:579
mpLocation m_location
The location of the text.
Definition: mathplot.h:4479
Delete the object if CanDelete is true and remove it from the layer list.
Definition: mathplot.h:837
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:3835
mpLabelType m_labelType
Label formatting mode used for the X coordinate display.
Definition: mathplot.h:1402
int m_scrY
Current view&#39;s Y dimension.
Definition: mathplot.h:4320
sub type for mpTitle layer
Definition: mathplot.h:729
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:3562
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1549
mpAxisData m_AxisDataX
Axis data for the X direction.
Definition: mathplot.h:4309
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1436
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:1311
double GetMaxScale() const
Get the maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2730
Align the info in margin center-top.
Definition: mathplot.h:645
Set label for axis in date mode: the value is always represented as yyyy-mm-dd.
Definition: mathplot.h:785
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:4314
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:4145
void SetScreen(const int scrX, const int scrY)
Set current view&#39;s dimensions in device context units.
Definition: mathplot.h:3489
int GetBarWidth(void) const
Get the width of the bar when we plot in bar mode.
Definition: mathplot.h:1941
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:4114
double m_labelAngle
Rotation angle used for bar labels, in degrees.
Definition: mathplot.h:2460
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:1374
void SetAxisID(unsigned int yAxisID)
Set an ID to the axis.
Definition: mathplot.h:2604
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:2141
int mpOptional_int
Optional integer fallback type used when std::optional is unavailable.
Definition: mathplot.h:122
void SetMin(T _min)
Set min function, correct max.
Definition: mathplot.h:326
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:4043
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:4338
double m_max_value
Max value of the values vector.
Definition: mathplot.h:2393
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1521
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1759
wxPoint GetCenter(void) const
Get the center of the pie chart.
Definition: mathplot.h:2500
mpTitle(const wxString &name)
Definition: mathplot.h:4500
Plot layer implementing a simple title.
Definition: mathplot.h:4491
Set no label for axis (useful for bar)
Definition: mathplot.h:791
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2917
bool m_validImg
True when the source image is valid and ready to draw.
Definition: mathplot.h:4892
enum __mp_Layer_ZOrder mpLayerZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
mpMouseButtonAction
enum for left button mouse action: box zoom or drag
Definition: mathplot.h:764
#define MP_OPTNULL_INT
Null sentinel used for mpOptional_int / mpOptional_uint in the fallback implementation.
Definition: mathplot.h:124
sub type for mpPieChart
Definition: mathplot.h:759
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:4616
bool ViewAsBar(void) const
Get if we are in bar mode.
Definition: mathplot.h:1950
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:1316
mpRange< double > GetBoundY(int yAxisID)
Get bounding box for Y axis of ID yAxisID.
Definition: mathplot.h:3373
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:1110
mpGaussian(double mu, double sigma)
Classic Gaussian distribution.
Definition: mathplot.h:2288
Align the plot label towards the northeast.
Definition: mathplot.h:679
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:4018
double GetPosX(void) const
Get current view&#39;s X position.
Definition: mathplot.h:3430
only for mpInfoCoords
Definition: mathplot.h:652
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:1138
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:1174
std::vector< double > m_trans_shape_xs
Transformed shape vertices in X coordinates.
Definition: mathplot.h:4668
mpLegendDirection GetItemDirection() const
Get the current legend item layout direction.
Definition: mathplot.h:1461
int GetAxisWidth()
Get the reserved width of the Y axis in pixels.
Definition: mathplot.h:2940
int GetExtraMargin() const
Get the extra margin.
Definition: mathplot.h:3991
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:2690
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1902
virtual double ComputeY(double x)
The main computation of the FX function.
Definition: mathplot.h:2303
sub type for mpFXY function
Definition: mathplot.h:738
wxCoord m_mouseX
Last mouse X position in window pixel coordinates.
Definition: mathplot.h:1404
enum __XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
#define ZOOM_AROUND_CENTER
Default value for zoom around a point (default -1 is no zoom)
Definition: mathplot.h:214
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1628
void UnSetOnUserMouseAction()
Remove the &#39;user mouse action event&#39; callback.
Definition: mathplot.h:4135
enum __Chart_Type mpChartType
sub_type values for mpLAYER_CHART
bool IsBottomAxis()
Return true when this X axis is aligned at the bottom edge or bottom border.
Definition: mathplot.h:2894
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:2079
void SetScale(mpRange< double > range)
Set the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2757
mpRange< double > GetDesiredBoundX(void) const
Get desired bounding box for X axis.
Definition: mathplot.h:3365
#define m_yID
Alias for the Y-axis identifier when structured binding is unavailable.
Definition: mathplot.h:133
~mpChart()
Destructor.
Definition: mathplot.h:2360
bool GetBoundingBox(mpRange< double > *boundX, mpRange< double > *boundY, int yAxisID)
Return the bounding box coordinates for the Y axis of ID yAxisID.
Definition: mathplot.h:3782
virtual double GetY(double x)
Get function value for argument.
Definition: mathplot.h:2232
Abstract class providing an horizontal line.
Definition: mathplot.h:1691
Zoom into view at clickposition / window center.
Definition: mathplot.h:625
int GetMarginLeft(bool minusExtra=false) const
Get the left margin.
Definition: mathplot.h:3975
wxBitmap m_scaledBitmap
Cached scaled bitmap used for drawing.
Definition: mathplot.h:4889
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:4313
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:4775
int GetSegments() const
Get the number of line segments used to approximate the ellipse. */.
Definition: mathplot.h:4741
bool m_enableScrollBars
Enable scrollbar in plot window (default false)
Definition: mathplot.h:4347
double scale
Scale.
Definition: mathplot.h:3011
Align the info in margin top-left.
Definition: mathplot.h:644
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:2098
bool IsSet()
Check if this mpRange has been assigned any values.
Definition: mathplot.h:357
Zoom out.
Definition: mathplot.h:626
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2572
enum __mp_Layer_Type mpLayerType
Major type of an mpLayer (detail is in subtype)
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:1005
Class for drawing mouse magnetization Draw an horizontal and a vertical line at the mouse position...
Definition: mathplot.h:3064
double GetMinScale() const
Get the minimum of the scale range when we are in automatic mode.
Definition: mathplot.h:2714
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:2084
bool PointIsInside(T point) const
Return true if the point is inside the range (min and max included)
Definition: mathplot.h:434
__mp_Direction_Type
Direction for the Legend layer.
Definition: mathplot.h:693
sub type for mpInfoLayer layer
Definition: mathplot.h:719
Align the x-axis towards bottom plot.
Definition: mathplot.h:659
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:4699
virtual double GetMaxY()
Get max Y of the function.
Definition: mathplot.h:2260
mpLabelType GetLabelMode() const
Get axis label view mode.
Definition: mathplot.h:2650
int GetMarginTop(bool minusExtra=false) const
Get the top margin.
Definition: mathplot.h:3918
mpInfoCoords * m_InfoCoords
Pointer to the optional info coords layer.
Definition: mathplot.h:4349
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:3754
bool m_series_coord
True to show the nearest plotted series value instead of raw mouse Y coordinates. ...
Definition: mathplot.h:1406
Set label for axis in hours mode: the value is always represented as hours:minutes:seconds.
Definition: mathplot.h:783
void SaveDrawState(void)
Save whether the magnet was drawn before a full repaint.
Definition: mathplot.h:3097
Represents all the informations needed for plotting a layer in one direction (X or Y) This struct hol...
Definition: mathplot.h:3008
__mp_Style_Type
Style for the Legend layer.
Definition: mathplot.h:685
const wxColour & GetbgColour() const
Get the plot background colour.
Definition: mathplot.h:4098
Layer for pie chart.
Definition: mathplot.h:2474
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:1021
Align the y-axis towards right plot.
Definition: mathplot.h:671
void GetScale(double *min, double *max) const
Get the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2748
T Length(void) const
Length of the range.
Definition: mathplot.h:409
sub type for mpScaleX
Definition: mathplot.h:749
bool PointIsInsideBound(double px, double py, int yAxisID)
Is the given point inside the current bounding box for the selected Y axis?
Definition: mathplot.h:3792
sub type for mpInfoCoords layer
Definition: mathplot.h:720
struct deprecated("Deprecated! No longer used as X and Y are now separated")]] mpFloatRect
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer t...
Definition: mathplot.h:460
Set label user defined.
Definition: mathplot.h:789
void SetColumnWidth(const double colWidth)
Set the bar width in plot units.
Definition: mathplot.h:2427
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:4705
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:1013
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:4339
wxColour m_fontcolour
Layer&#39;s font foreground colour.
Definition: mathplot.h:1169
void SetPosY(std::unordered_map< int, double > &posYList)
Set current view&#39;s Y position and refresh display.
Definition: mathplot.h:3439
Set label for axis in time mode: the value is represented as minutes:seconds.milliseconds if time is ...
Definition: mathplot.h:781
sub type not defined (should be never used)
Definition: mathplot.h:718
Set label for axis in datetime mode: the value is always represented as yyyy-mm-ddThh:mm:ss.
Definition: mathplot.h:787
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:4748
void SetMax(T _max)
Set max function, correct min.
Definition: mathplot.h:334
Bitmap type layer.
Definition: mathplot.h:806
wxRect m_zoom_Dim
Rectangular area selected for zoom.
Definition: mathplot.h:4354
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:1297
bool IsVisible() const
Is this layer visible?
Definition: mathplot.h:1103
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:2611
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:895
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:1124
int m_last_lx
Last logical X origin, used for double buffering.
Definition: mathplot.h:4335
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1585
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2797
Align the info in margin bottom-left.
Definition: mathplot.h:648
const wxString & GetWildcard(void) const
Get wildcard.
Definition: mathplot.h:3868
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:4587
enum __mp_Delete_Action mpDeleteAction
Action to do with the object associated to the layer when we delete it.
sub type for mpFY function
Definition: mathplot.h:737
Info box type layer.
Definition: mathplot.h:804
void SetPos(const double posX, std::unordered_map< int, double > &posYList)
Set current view&#39;s X and Y position and refresh display.
Definition: mathplot.h:3534
mpOptional_int m_mouseYAxisID
Indicate which ID of Y-axis the mouse was on during zoom/pan.
Definition: mathplot.h:4346
int GetScreenY(void) const
Get current view&#39;s Y dimension in device context units.
Definition: mathplot.h:3524
mpAxisList GetAxisDataYList(void) const
Get the Y-axis data map.
Definition: mathplot.h:3471
wxCoord m_scaledBitmap_offset_y
Cached Y pixel offset used when drawing the scaled bitmap.
Definition: mathplot.h:4891
Align the y-axis center plot.
Definition: mathplot.h:670
virtual bool DoBeforePlot()
This is the only case where we don&#39;t need and Y axis So no need to test m_yAxisID.
Definition: mathplot.h:1745
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:938
Plot layer implementing a text string.
Definition: mathplot.h:4415
virtual bool IsLayerType(mpLayerType typeOfInterest, int *subtype)
Set the layer&#39;s subtype in caller variable, and return true if the layer is of type "typeOfInterest"...
Definition: mathplot.h:905
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:4328
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:4644
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:4049
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:1090
wxBrush m_brush
Layer&#39;s brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:1171
double m_sigma
Sigma value.
Definition: mathplot.h:2299
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition: mathplot.h:3944
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:922
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:1313
int GetMarginBottom(bool minusExtra=false) const
Get the bottom margin.
Definition: mathplot.h:3958
Shows information about the mouse commands.
Definition: mathplot.h:636
void SetLogYaxis(int yAxisID, bool log)
Set the log property (true or false) for a Y layer (Y axis) given by is ID.
Definition: mathplot.h:4176
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:3910
double GetScaleX(void) const
Get current view&#39;s X scale.
Definition: mathplot.h:3322
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:4315
mpRange< double > m_bbox_y
Range of bounding box on y direction.
Definition: mathplot.h:4675
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:4359
legend components follow each other horizontally on a single line
Definition: mathplot.h:696
void SetRightClick(void)
Mark that the magnet update originated from a right-click.
Definition: mathplot.h:3105
Align the info in margin top-right.
Definition: mathplot.h:646
double m_reference_phi
Current object rotation angle in radians.
Definition: mathplot.h:4655
void InitializeBoundingBox(double px, double py)
Initialize bounding box with an initial point.
Definition: mathplot.h:612
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1454
enum __Text_Type mpTextType
sub_type values for mpLAYER_TEXT
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see GetQuantiles a...
Definition: mathplot.h:4728
double m_const
Const factor.
Definition: mathplot.h:2334
bool m_repainting
Boolean value indicating that we are in repaint step.
Definition: mathplot.h:4334
int GetYAxisID() const
Get the ID of the Y axis used by the function.
Definition: mathplot.h:1598
void SetSegments(int segments)
Set the number of line segments used to approximate the ellipse.
Definition: mathplot.h:4735
sub type for all layers who are scale.
Definition: mathplot.h:751
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:4322
Represents a numeric range with minimum and maximum values.
Definition: mathplot.h:284
void Set(T _min, T _max)
Set min, max function.
Definition: mathplot.h:319
Align the info in margin bottom-right.
Definition: mathplot.h:650
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:4653
double GetScaleY(int yAxisID)
Get current view&#39;s Y scale.
Definition: mathplot.h:3347
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:2521
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1556
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:4623
sub type for mpMovableObject function
Definition: mathplot.h:740
Plot layer, abstract base class.
Definition: mathplot.h:851
std::vector< double > values
Values of the chart.
Definition: mathplot.h:2390
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:1178
void SetNeedUpdate()
Mark the legend bitmap as needing regeneration.
Definition: mathplot.h:1467
bool IsInside(wxCoord xPixel)
Return true if the given X pixel lies within this Y-axis drawing area.
Definition: mathplot.h:2958
mpRange< double > GetScale() const
Get the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2765
std::vector< double > m_shape_ys
Shape vertices in object-local Y coordinates.
Definition: mathplot.h:4665
double GetValue() const
Get the x or y coordinates of the line.
Definition: mathplot.h:1661
enum __Scale_Type mpScaleType
sub_type values for mpLAYER_AXIS
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:4463
void SetFactor(int factor)
Definition: mathplot.h:4557
sub type for mpFX function
Definition: mathplot.h:736
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:989
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:1166
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:2798
int m_scrX
Current view&#39;s X dimension in DC units, including all scales, margins.
Definition: mathplot.h:4319
double m_sigma
Sigma value.
Definition: mathplot.h:2332
std::unordered_map< int, double > m_mouseScaleYList
Store current Y-scales, used as reference during drag zooming.
Definition: mathplot.h:4345
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:1069
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:997
unsigned int m_timeConv
Time conversion mode used when formatting date/time X values.
Definition: mathplot.h:1403
void SetScale(double min, double max)
Set the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2739
virtual bool DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:1196
#define mpX_RAWTIME
Shortcut for mpX_UTCTIME.
Definition: mathplot.h:203
double m_cov_00
The elements of the matrix (only 3 since cov(0,1)=cov(1,0) in any positive definite matrix)...
Definition: mathplot.h:4768
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:3967
#define m_yData
Alias for the Y-axis data when structured binding is unavailable.
Definition: mathplot.h:135
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:4308
std::vector< wxColour > colours
Per-slice colours used when drawing the chart.
Definition: mathplot.h:2546
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:2792
std::map< int, mpAxisData > GetSortedAxisDataYList(void) const
Get a sorted version of the Y-axis data map.
Definition: mathplot.h:3479
mpRect m_margin
Margin around the plot including Y-axis.
Definition: mathplot.h:4324
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:2181
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:1304
void SetWildcard(const wxString &wildcard)
Set wildcard for LoadFile() function when we use wxFileDialog.
Definition: mathplot.h:3860
mpMouseButtonAction m_mouseLeftDownAction
Type of action for left mouse button.
Definition: mathplot.h:4340
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:4331
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:1117
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:2587
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:4630
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:3612
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:3686
void SetMaxScale(double max)
Set the maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2722
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:2674
sub type for mpScaleY
Definition: mathplot.h:750
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1563
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:4831
void SetScaleY(const double scaleY, int yAxisID)
Set current view&#39;s Y scale and refresh display.
Definition: mathplot.h:3331
mpAxisUpdate
Define the axis we want to update.
Definition: mathplot.h:3035
Text box type layer.
Definition: mathplot.h:824
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:3164
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:1131
Line (horizontal or vertical) type layer.
Definition: mathplot.h:807
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:2134