13 #ifndef MATHPLOT_H_INCLUDED 14 #define MATHPLOT_H_INCLUDED 58 #ifdef mathplot_EXPORTS 59 #define WXDLLIMPEXP_MATHPLOT WXEXPORT 60 #define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type 61 #else // not making DLL 62 #define WXDLLIMPEXP_MATHPLOT 63 #define WXDLLIMPEXP_DATA_MATHPLOT(type) type 66 #if defined(__GNUG__) && !defined(__APPLE__) 67 #pragma interface "mathplot.h" 76 #include <wx/scrolwin.h> 78 #include <wx/dynarray.h> 80 #include <wx/dcmemory.h> 81 #include <wx/string.h> 91 #ifdef ENABLE_MP_CONFIG 92 #include "MathPlotConfig.h" 93 #endif // ENABLE_MP_CONFIG 100 #ifdef ENABLE_MP_NAMESPACE 102 #endif // ENABLE_MP_NAMESPACE 104 #ifdef ENABLE_MP_DEBUG 109 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) 111 #define DEBUG_NEW new 114 #endif // ENABLE_MP_DEBUG 117 #define X_BORDER_SEPARATION 40 118 #define Y_BORDER_SEPARATION 60 121 #define mpX_LOCALTIME 0x10 123 #define mpX_UTCTIME 0x20 124 #define mpX_RAWTIME mpX_UTCTIME 128 #define ISNOTNULL(x) (fabs(x) > EPSILON) 131 #define EXTRA_MARGIN 8 133 #define ZOOM_AROUND_CENTER -1 139 class WXDLLIMPEXP_MATHPLOT
mpLayer;
141 class WXDLLIMPEXP_MATHPLOT
mpLine;
144 class WXDLLIMPEXP_MATHPLOT
mpFX;
145 class WXDLLIMPEXP_MATHPLOT
mpFY;
146 class WXDLLIMPEXP_MATHPLOT
mpFXY;
149 class WXDLLIMPEXP_MATHPLOT
mpChart;
151 class WXDLLIMPEXP_MATHPLOT
mpScale;
152 class WXDLLIMPEXP_MATHPLOT
mpScaleX;
153 class WXDLLIMPEXP_MATHPLOT
mpScaleY;
157 class WXDLLIMPEXP_MATHPLOT
mpWindow;
158 class WXDLLIMPEXP_MATHPLOT
mpText;
159 class WXDLLIMPEXP_MATHPLOT
mpTitle;
166 #ifdef ENABLE_MP_CONFIG 168 #endif // ENABLE_MP_CONFIG 204 inline static int ySize = 1;
207 std::vector<double> YminList;
208 std::vector<double> YmaxList;
210 mpFloatRect() : Xmin(0.0), Xmax(0.0) {YminList.resize(ySize, 0.0); YmaxList.resize(ySize, 0.0);}
213 if(yIndex < YminList.size())
215 if( (x < Xmin || x > Xmax) ||
216 (y < YminList[yIndex] || y > YmaxList[yIndex]))
230 if(yIndex < YminList.size())
232 if (x < Xmin ) Xmin = x;
233 else if (x > Xmax ) Xmax = x;
234 if (y < YminList[yIndex] ) YminList[yIndex] = y;
235 else if (y > YmaxList[yIndex] ) YmaxList[yIndex] = y;
240 if(yIndex < YminList.size())
243 YminList[yIndex] = YmaxList[yIndex] = y;
249 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions> 250 bool operator==(
const mpFloatRect&)
const =
default;
256 auto Same = [](
double a,
double b) {
257 return std::fabs(a - b) < EPSILON;
261 if (!Same(Xmin, rect.Xmin) || !Same(Xmax, rect.Xmax))
267 if (YminList.size() != rect.YminList.size() || YmaxList.size() != rect.YmaxList.size())
273 auto vectorSame = [&Same](
const std::vector<double>& a,
const std::vector<double>& b) {
274 return std::equal(a.begin(), a.end(), b.begin(), Same);
277 return vectorSame(YminList, rect.YminList) && vectorSame(YmaxList, rect.YmaxList);
295 #ifdef ENABLE_MP_CONFIG 297 #endif // ENABLE_MP_CONFIG 312 mpMarginBottomCenter,
321 mpALIGN_BORDER_BOTTOM = 10,
331 mpALIGN_BORDER_LEFT = 20,
362 typedef enum __Symbol_Type
394 typedef enum __Function_Type
406 typedef enum __Scale_Type
414 typedef enum __Chart_Type
465 class WXDLLIMPEXP_MATHPLOT
mpLayer:
public wxObject
468 mpLayer(mpLayerType layerType);
519 *sub_type = m_subtype;
520 return (m_type == type);
635 m_fontcolour = colour;
666 if (brush == wxNullBrush)
667 m_brush = *wxTRANSPARENT_BRUSH;
697 m_drawOutsideMargins = drawModeOutside;
704 return m_drawOutsideMargins;
711 wxBitmap GetColourSquare(
int side = 16);
759 m_CanDelete = canDelete;
796 void UpdateContext(wxDC &dc)
const;
802 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
815 void CheckLog(
double *x,
double *y);
821 wxDECLARE_DYNAMIC_CLASS(
mpLayer);
843 mpInfoLayer(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
850 virtual void SetVisible(
bool show);
856 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
868 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
873 virtual bool Inside(
const wxPoint &point);
877 virtual void Move(wxPoint delta);
880 virtual void UpdateReference();
886 return m_dim.GetPosition();
893 return m_dim.GetSize();
907 m_location = location;
929 virtual void DoPlot(wxDC &dc,
mpWindow &w);
933 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
955 mpInfoCoords(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
966 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
968 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
972 void SetLabelMode(
unsigned int mode,
unsigned int time_conv = mpX_RAWTIME)
975 m_timeConv = time_conv;
982 m_series_coord = show;
989 return m_series_coord;
996 virtual wxString GetInfoCoordsText(
double xVal, std::vector<double> yValList);
1007 unsigned int m_labelType;
1008 unsigned int m_timeConv;
1011 bool m_series_coord;
1018 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1038 mpInfoLegend(wxRect rect,
const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1048 m_needs_update =
true;
1051 mpLegendStyle GetItemMode()
const 1060 m_item_direction = mode;
1061 m_needs_update =
true;
1064 mpLegendDirection GetItemDirection()
const 1066 return m_item_direction;
1069 void SetNeedUpdate()
1071 m_needs_update =
true;
1075 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1078 mpLegendStyle m_item_mode;
1079 mpLegendDirection m_item_direction;
1085 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1091 unsigned int layerIdx;
1095 std::vector<LegendDetail> m_LegendDetailList;
1096 bool m_needs_update;
1107 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1128 mpFunction(mpLayerType layerType =
mpLAYER_PLOT,
const wxString &name = wxEmptyString,
size_t yAxisIndex = 0);
1135 m_continuous = continuity;
1143 return m_continuous;
1178 m_symbolSize = size;
1179 m_symbolSize2 = size / 2;
1186 return m_symbolSize;
1192 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1194 size_t GetYAxisIndex()
const 1196 return m_yAxisIndex;
1199 void SetYAxisIndex(
size_t index)
1201 m_yAxisIndex = index;
1220 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1248 return m_IsHorizontal;
1253 bool m_IsHorizontal;
1255 wxDECLARE_DYNAMIC_CLASS(
mpLine);
1263 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN,
size_t yAxisIndex = 0);
1275 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1297 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1314 mpFX(
const wxString &name = wxEmptyString,
int flags = mpALIGN_RIGHT,
int yAxisIndex = 0);
1321 virtual double GetY(
double x) = 0;
1326 double DoGetY(
double x);
1334 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1336 wxDECLARE_DYNAMIC_CLASS(
mpFX);
1351 mpFY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP,
int yAxisIndex = 0);
1358 virtual double GetX(
double y) = 0;
1363 double DoGetX(
double y);
1371 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1373 wxDECLARE_DYNAMIC_CLASS(
mpFY);
1391 mpFXY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
int yAxisIndex = 0);
1396 virtual void Rewind() = 0;
1420 virtual bool GetNextXY(
double *x,
double *y) = 0;
1425 bool DoGetNextXY(
double *x,
double *y);
1430 void SetViewMode(
bool asBar);
1451 wxCoord maxDrawX, minDrawX, maxDrawY, minDrawY;
1454 double m_deltaX, m_deltaY;
1460 bool m_ViewAsBar =
false;
1463 bool m_CanDelete =
true;
1469 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1475 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1477 wxDECLARE_DYNAMIC_CLASS(
mpFXY);
1509 mpFXYVector(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
int yAxisIndex = 0);
1522 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
1545 bool AddData(
const double x,
const double y,
bool updatePlot);
1554 m_reserveXY = reserve;
1555 m_xs.reserve(m_reserveXY);
1556 m_ys.reserve(m_reserveXY);
1581 double m_minX, m_maxX, m_minY, m_maxY, m_lastX, m_lastY;
1596 virtual bool GetNextXY(
double *x,
double *y);
1600 void DrawAddedPoint(
double x,
double y);
1633 void First_Point(
double x,
double y);
1637 void Check_Limit(
double val,
double *min,
double *max,
double *last,
double *delta);
1656 mpProfile(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP);
1663 virtual double GetY(
double x) = 0;
1671 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1685 mpChart(
const wxString &name = wxEmptyString);
1695 void SetChartValues(
const std::vector<double> &data);
1699 void SetChartLabels(
const std::vector<std::string> &labelArray);
1705 void AddData(
const double &data,
const std::string &label);
1710 virtual void Clear();
1714 return (values.size() > 0);
1718 std::vector<double> values;
1719 std::vector<std::string> labels;
1722 double m_total_value;
1724 wxDECLARE_DYNAMIC_CLASS(
mpChart);
1731 #define mpBAR_NONE 0 1732 #define mpBAR_AXIS_H 1 1733 #define mpBAR_AXIS_V 2 1734 #define mpBAR_INSIDE 3 1743 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
1751 void SetBarColour(
const wxColour &colour);
1753 void SetColumnWidth(
const double colWidth)
1759 void SetBarLabelPosition(
int position);
1764 virtual double GetMinX();
1769 virtual double GetMaxX();
1774 virtual double GetMinY();
1779 virtual double GetMaxY();
1784 wxColour m_barColour;
1786 double m_labelAngle;
1792 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1805 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
1817 void SetPieColours(
const std::vector<wxColour> &colourArray);
1854 std::vector<wxColour> colours;
1860 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1862 const wxColour& GetColour(
unsigned int id);
1885 mpScale(
const wxString &name,
int flags,
bool grids);
1927 m_labelFormat = format;
1934 return m_labelFormat;
1958 m_auto = automaticScalingIsEnabled;
1969 void SetMinScale(
double min)
1974 double GetMinScale()
const 1979 void SetMaxScale(
double max)
1984 double GetMaxScale()
const 1989 virtual bool IsLogAxis() = 0;
1990 virtual void SetLogAxis(
bool log) = 0;
2000 virtual int GetOrigin(
mpWindow &w) = 0;
2008 double GetStep(
double scale,
int minLabelSpacing);
2009 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
2011 wxString FormatLogValue(
double n);
2013 wxDECLARE_DYNAMIC_CLASS(
mpScale);
2017 #define mpX_NORMAL 0x00 2020 #define mpX_TIME 0x01 2022 #define mpX_HOURS 0x02 2024 #define mpX_DATE 0x03 2026 #define mpX_DATETIME 0x04 2028 #define mpX_USER 0x05 2030 #define mpX_NONE 0x06 2045 mpScaleX(
const wxString &name = _T(
"X"),
int flags = mpALIGN_CENTERX,
bool grids =
false,
unsigned int type =
mpX_NORMAL) :
2048 m_subtype = mpsScaleX;
2050 m_timeConv = mpX_RAWTIME;
2071 m_timeConv = time_conv;
2077 virtual bool IsLogAxis();
2078 virtual void SetLogAxis(
bool log);
2086 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2093 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
2095 virtual int GetOrigin(
mpWindow &w);
2096 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2097 wxString FormatValue(
const wxString &fmt,
double n);
2115 mpScaleY(
const wxString &name = _T(
"Y"),
int flags = mpALIGN_CENTERY,
bool grids =
false,
size_t axisIndex = 0) :
2118 m_subtype = mpsScaleY;
2119 m_axisWidth = Y_BORDER_SEPARATION;
2120 m_axisIndex = axisIndex;
2127 virtual bool IsLogAxis();
2128 virtual void SetLogAxis(
bool log);
2134 size_t GetAxisIndex(
void)
2146 return ((GetAlign() == mpALIGN_BORDER_LEFT) || (GetAlign() == mpALIGN_LEFT));
2151 return ((GetAlign() == mpALIGN_BORDER_RIGHT) || (GetAlign() == mpALIGN_RIGHT));
2154 bool IsInside(wxCoord xPixel)
2156 if( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
2170 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2172 virtual int GetOrigin(
mpWindow &w);
2173 wxString GetLabelFormat(
mpWindow &w);
2174 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
2175 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2188 #define mpMOUSEMODE_DRAG 0 2190 #define mpMOUSEMODE_ZOOMBOX 1 2203 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)>
mpOnDeleteLayer;
2222 m_rightClick =
false;
2223 m_IsWasDrawn =
false;
2229 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2231 m_domain = wxRect(left, top, width, height);
2232 m_plot_size = wxRect(left, top, width + left, height + top);
2234 void UpdateBox(
const wxRect &size)
2237 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2238 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2240 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2241 void ClearPlot(wxClientDC &dc);
2242 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2243 void SaveDrawState(
void)
2245 m_IsWasDrawn = m_IsDrawn;
2250 void SetRightClick(
void)
2252 m_rightClick =
true;
2258 wxPoint m_mousePosition;
2262 void DrawCross(wxClientDC &dc)
const;
2294 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2314 bool AddLayer(
mpLayer *layer,
bool refreshDisplay =
true);
2325 bool DelLayer(
mpLayer *layer,
bool alsoDeleteObject,
bool refreshDisplay =
true);
2331 void DelAllLayers(
bool alsoDeleteObject,
bool refreshDisplay =
true);
2338 void DelAllPlot(
bool alsoDeleteObject, mpFunctionType func = mpfAllType,
bool refreshDisplay =
true);
2345 mpLayer* GetLayer(
int position);
2353 mpLayer* GetLayersType(
int position, mpLayerType type);
2360 mpLayer* GetLayerPlot(
int position, mpFunctionType func = mpfAllType);
2364 mpLayer* GetLayerAxis(
int position, mpScaleType scale = mpsAllType);
2370 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
2375 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear);
2381 mpLayer* GetLayerByName(
const wxString &name);
2387 mpLayer* GetLayerByClassName(
const wxString &name);
2392 void RefreshLegend(
void);
2404 if (ISNOTNULL(scaleX))
2423 if (ISNOTNULL(scaleY))
2424 m_yAxisDataList[yIndex].m_scaleY = scaleY;
2434 return m_yAxisDataList[yIndex].m_scaleY;
2437 [[deprecated(
"Incomplete, use UpdateBBox instead")]]
2471 for(
size_t i = 0; i < m_yAxisDataList.size(); i++)
2473 m_yAxisDataList[i].m_posY = posYList[i];
2485 return m_yAxisDataList[yIndex].m_posY;
2488 int GetNOfYScales(
void)
2490 return m_yAxisDataList.size();
2493 std::vector<mpScaleY*> GetYAxisList(
void)
const 2507 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
2508 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
2510 m_plotBoundaries.endPx = m_scrX;
2511 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
2512 m_plotBoundaries.endPy = m_scrY;
2513 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
2515 m_PlotArea = wxRect(m_margin.left - EXTRA_MARGIN, m_margin.top - EXTRA_MARGIN,
2516 m_plotWidth + 2*EXTRA_MARGIN, m_plotHeight + 2*EXTRA_MARGIN);
2518 m_magnet.UpdateBox(m_PlotArea);
2547 void SetPos(
const double posX,
const std::vector<double>& posYList)
2550 for(
size_t i = 0; i < m_yAxisDataList.size(); i++)
2552 m_yAxisDataList[i].m_posY = posYList[i];
2561 inline double p2x(
const wxCoord pixelCoordX)
const 2563 return m_posX + (pixelCoordX / m_scaleX);
2569 inline double p2y(
const wxCoord pixelCoordY,
int yIndex = 0)
const 2571 return m_yAxisDataList[yIndex].m_posY - (pixelCoordY / m_yAxisDataList[yIndex].m_scaleY);
2577 inline wxCoord
x2p(
const double x)
const 2579 return (wxCoord)((x - m_posX) * m_scaleX);
2585 inline wxCoord
y2p(
const double y,
int yIndex = 0)
const 2587 return (wxCoord)((m_yAxisDataList[yIndex].m_posY - y) * m_yAxisDataList[yIndex].m_scaleY);
2594 m_enableDoubleBuffer = enabled;
2601 m_enableMouseNavigation = enabled;
2609 void LockAspect(
bool enable =
true);
2617 return m_lockaspect;
2626 return m_repainting;
2641 void Fit(
const mpFloatRect &rect, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
2647 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
2653 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
2663 void ZoomInY(std::optional<size_t> yIndex = std::nullopt);
2667 void ZoomOutY(std::optional<size_t> yIndex = std::nullopt);
2670 void ZoomRect(wxPoint p0, wxPoint p1);
2680 unsigned int CountLayers();
2686 return (
unsigned int)m_layers.size();
2692 unsigned int CountLayersType(mpLayerType type);
2693 unsigned int CountLayersFXYPlot();
2708 return m_desired.Xmin;
2717 return m_desired.Xmax;
2726 return m_desired.YminList[yIndex];
2735 return m_desired.YmaxList[yIndex];
2740 void GetBoundingBox(
double *bbox)
const;
2748 void SetMPScrollbars(
bool status);
2754 return m_enableScrollBars;
2762 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
2767 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2772 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2778 bool LoadFile(
const wxString &filename);
2790 void SetMargins(
int top,
int right,
int bottom,
int left);
2795 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
2801 SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
2807 return m_margin.top;
2813 SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
2819 return m_margin.right;
2825 return m_marginOuter.right;
2831 SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
2837 return m_margin.bottom;
2843 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
2849 return m_margin.left;
2855 return m_marginOuter.left;
2867 return m_plotHeight;
2875 bond = m_plotBoundariesMargin;
2877 bond = m_plotBoundaries;
2878 bond.startPx -= EXTRA_MARGIN;
2879 bond.endPx += EXTRA_MARGIN;
2880 bond.startPy -= EXTRA_MARGIN;
2881 bond.endPy += EXTRA_MARGIN;
2887 int GetLeftYAxesWidth(
int yAxisIndex = -1);
2891 int GetRightYAxesWidth(
int yAxisIndex = -1);
2896 m_drawBox = drawbox;
2908 std::optional<size_t> IsInsideYAxis(
const wxPoint &point);
2913 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
2918 void SetLayerVisible(
const wxString &name,
bool viewable);
2923 bool IsLayerVisible(
const wxString &name);
2928 bool IsLayerVisible(
const unsigned int position);
2933 void SetLayerVisible(
const unsigned int position,
bool viewable);
2939 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
2948 const wxColour& GetbgColour()
const 2953 void SetbgColour(
const wxColour &colour)
2955 m_bgColour = colour;
2964 m_OnDeleteLayer = event;
2970 m_OnDeleteLayer = NULL;
2979 m_OnUserMouseAction = userMouseEventHandler;
2985 m_OnUserMouseAction = NULL;
2998 bool IsLogYaxis()
const 3003 void SetLogXaxis(
bool log)
3008 void SetLogYaxis(
bool log)
3013 bool GetMagnetize()
const 3018 void SetMagnetize(
bool mag)
3023 #ifdef ENABLE_MP_CONFIG 3024 void RefreshConfigWindow();
3030 #endif // ENABLE_MP_CONFIG 3033 virtual void OnPaint(wxPaintEvent &event);
3034 virtual void OnSize(wxSizeEvent &event);
3035 virtual void OnShowPopupMenu(wxMouseEvent &event);
3036 virtual void OnCenter(wxCommandEvent &event);
3037 virtual void OnFit(wxCommandEvent &event);
3038 virtual void OnToggleGrids(wxCommandEvent &event);
3039 virtual void OnToggleCoords(wxCommandEvent &event);
3040 virtual void OnScreenShot(wxCommandEvent &event);
3041 virtual void OnFullScreen(wxCommandEvent &event);
3042 #ifdef ENABLE_MP_CONFIG 3043 virtual void OnConfiguration(wxCommandEvent &event);
3044 #endif // ENABLE_MP_CONFIG 3045 virtual void OnLoadFile(wxCommandEvent &event);
3046 virtual void OnZoomIn(wxCommandEvent &event);
3047 virtual void OnZoomOut(wxCommandEvent &event);
3048 virtual void OnLockAspect(wxCommandEvent &event);
3049 virtual void OnMouseHelp(wxCommandEvent &event);
3050 virtual void OnMouseLeftDown(wxMouseEvent &event);
3051 virtual void OnMouseRightDown(wxMouseEvent &event);
3052 virtual void OnMouseMove(wxMouseEvent &event);
3053 virtual void OnMouseLeftRelease(wxMouseEvent &event);
3054 virtual void OnMouseWheel(wxMouseEvent &event);
3055 virtual void OnMouseLeave(wxMouseEvent &event);
3056 bool CheckUserMouseAction(wxMouseEvent &event);
3057 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
3058 virtual void OnScrollPageUp(wxScrollWinEvent &event);
3059 virtual void OnScrollPageDown(wxScrollWinEvent &event);
3060 virtual void OnScrollLineUp(wxScrollWinEvent &event);
3061 virtual void OnScrollLineDown(wxScrollWinEvent &event);
3062 virtual void OnScrollTop(wxScrollWinEvent &event);
3063 virtual void OnScrollBottom(wxScrollWinEvent &event);
3065 void DoScrollCalc(
const int position,
const int orientation);
3071 void DoZoomXCalc(
bool zoomIn,
int staticXpixel = ZOOM_AROUND_CENTER);
3079 void DoZoomYCalc(
bool zoomIn,
int staticYpixel = ZOOM_AROUND_CENTER, std::optional<size_t> = std::nullopt);
3081 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
3085 virtual bool UpdateBBox();
3087 void InitParameters();
3093 void UpdateNOfYAxes(
size_t nOfYAxes);
3097 double m_scaleY = 1.0;
3101 wxTopLevelWindow* m_parent;
3145 bool m_mouseMovedAfterRightClick;
3149 bool m_enableScrollBars;
3150 int m_scrollX, m_scrollY;
3154 bool m_InInfoLegend;
3158 wxRect m_zoom_oldDim;
3163 bool m_LogXaxis =
false;
3164 bool m_LogYaxis =
false;
3168 #ifdef ENABLE_MP_CONFIG 3170 #endif // ENABLE_MP_CONFIG 3172 mpOnDeleteLayer m_OnDeleteLayer = NULL;
3173 mpOnUserMouseAction m_OnUserMouseAction = NULL;
3181 void FillI18NString();
3184 void CheckAndReportDesiredBoundsChanges();
3185 bool m_initialDesiredBoundsRecorded =
false;
3189 wxDECLARE_EVENT_TABLE();
3213 m_subtype = mptText;
3217 m_location = mpMarginNone;
3224 mpText(
const wxString &name,
int offsetx,
int offsety);
3229 mpText(
const wxString &name, mpLocation marginLocation);
3242 m_location = location;
3271 mpLocation m_location;
3275 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3277 wxDECLARE_DYNAMIC_CLASS(
mpText);
3293 mpText(name, mpMarginTopCenter)
3295 m_subtype = mptTitle;
3296 SetPen(*wxWHITE_PEN);
3297 SetBrush(*wxWHITE_BRUSH);
3302 wxDECLARE_DYNAMIC_CLASS(
mpTitle);
3323 mpPrintout(
mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
3329 void SetDrawState(
bool drawState)
3334 bool OnPrintPage(
int page);
3335 bool HasPage(
int page);
3341 stretch_factor = factor;
3370 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
3373 m_subtype = mpfMovable;
3374 m_bbox_min_x = m_bbox_max_x = 0;
3375 m_bbox_min_y = m_bbox_max_y = 0;
3386 phi = m_reference_phi;
3395 m_reference_phi = phi;
3396 m_flags = mpALIGN_NE;
3402 return m_trans_shape_xs.size() != 0;
3409 return m_bbox_min_x;
3416 return m_bbox_max_x;
3423 return m_bbox_min_y;
3430 return m_bbox_max_y;
3439 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3443 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
3462 void ShapeUpdated();
3487 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
3489 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
3491 m_continuous =
true;
3501 double GetQuantiles()
const 3514 void SetSegments(
int segments)
3516 m_segments = segments;
3519 int GetSegments()
const 3555 void RecalculateShape();
3574 m_continuous =
true;
3588 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
3609 m_min_x = m_max_x = 0;
3610 m_min_y = m_max_y = 0;
3612 m_bitmapChanged =
false;
3613 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
3623 void GetBitmapCopy(wxImage &outBmp)
const;
3632 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
3667 wxBitmap m_scaledBitmap;
3668 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
3670 bool m_bitmapChanged;
3676 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3684 typedef enum __mp_Colour
3709 this->Set(0, 0, 255);
3712 this->Set(255, 0, 0);
3715 this->Set(0, 128, 0);
3718 this->Set(128, 0, 128);
3721 this->Set(255, 255, 0);
3724 this->Set(255, 0, 255);
3727 this->Set(0, 255, 0);
3730 this->Set(0, 255, 255);
3733 this->Set(128, 128, 0);
3736 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
3737 (ChannelType)((rand() * 255) / RAND_MAX));
3745 #ifdef ENABLE_MP_NAMESPACE 3748 #endif // ENABLE_MP_NAMESPACE 3750 #endif // MATHPLOT_H_INCLUDED int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:3270
const wxString & GetLabelFormat() const
Get axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1932
std::function< void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer
Define an event for when we delete a layer Use like this : your_plot->SetOnDeleteLayer([this](void *S...
Definition: mathplot.h:2203
bool IsHorizontal(void) const
Get if is horizontal line.
Definition: mathplot.h:1246
__mp_Location_Type
Location for the Info layer.
Definition: mathplot.h:304
void SetValue(const double value)
Set x or y.
Definition: mathplot.h:1239
mpInfoLegend * m_InfoLegend
pointer to the optional info legend layer
Definition: mathplot.h:3153
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:351
double m_min_x
The shape of the bitmap:
Definition: mathplot.h:3674
mpRect m_marginOuter
Margin around the plot exluding Y-axis. Default 50.
Definition: mathplot.h:3132
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:2592
mpFloatRect m_bound
Global layer bounding box in user coordinates. Does NOT include borders.
Definition: mathplot.h:3115
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:664
Bitmap type layer.
Definition: mathplot.h:445
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:785
Plot type layer.
Definition: mathplot.h:430
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:2527
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3657
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:2968
bool operator==(const mpFloatRect &rect) const
Equal operator.
Definition: mathplot.h:254
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1290
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:3567
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:2402
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:542
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:171
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1503
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:3123
Show legend items with line with the same pen of referred mpLayer.
Definition: mathplot.h:350
__mp_Layer_Type
Definition: mathplot.h:426
Show/Hide grids.
Definition: mathplot.h:292
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:3602
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:3160
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:1838
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:3146
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:1822
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:3572
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:1918
enum __Plot_Align_Name_Type mpPlot_Align
Plot alignment (which corner should plot be placed)
Layer type undefined; SHOULD NOT BE USED.
Definition: mathplot.h:428
enum __mp_Direction_Type mpLegendDirection
Direction for the Legend layer.
wxString m_name
Layer's name.
Definition: mathplot.h:784
virtual bool IsLayerType(mpLayerType type, int *sub_type)
Specifies that if the layer is of type "type".
Definition: mathplot.h:517
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:777
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1223
Lock x/y scaling aspect.
Definition: mathplot.h:291
void SetItemMode(mpLegendStyle mode)
Set item mode (the element on the left of text representing the plot line may be line or square)...
Definition: mathplot.h:1045
bool PointIsInside(double x, double y, size_t yIndex=0) const
Is point inside this bounding box?
Definition: mathplot.h:212
Info box type layer.
Definition: mathplot.h:450
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:3269
Abstract class providing a line.
Definition: mathplot.h:1217
Abstract class providing an vertical line.
Definition: mathplot.h:1282
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:1904
mpFloatRect m_desired
These are updated in Fit() only (also Zoom) May be different from the real borders (layer coordinates...
Definition: mathplot.h:3129
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2286
enum __Info_Type mpInfoType
sub_type values for mpLAYER_INFO
wxPen m_gridpen
Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition: mathplot.h:1993
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:920
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:3391
Chart type layer (bar chart)
Definition: mathplot.h:435
std::optional< size_t > m_mouseYAxisIndex
Indicate which Y-axis the mouse was on during zoom/pan.
Definition: mathplot.h:3148
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:641
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:2615
int m_winY
Holds the mpWindow size. Used to rescale position when window is resized.
Definition: mathplot.h:922
~mpBarChart()
Destructor.
Definition: mathplot.h:1746
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:2561
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:792
double GetScaleY(int yIndex=0) const
Get current view's Y scale.
Definition: mathplot.h:2432
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:2068
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:3147
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:3178
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:649
int m_flags
Holds label alignment. Default : mpALIGN_NE.
Definition: mathplot.h:789
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:3233
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:526
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:884
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:1000
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:695
unsigned int GetLabelMode() const
Get X axis label view mode.
Definition: mathplot.h:2061
~mpPieChart()
Destructor.
Definition: mathplot.h:1808
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1207
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:2859
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:779
Just the end of ZOrder.
Definition: mathplot.h:452
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3421
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
Definition: mathplot.h:443
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:2811
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:2782
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1133
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition: mathplot.h:2853
wxMenu m_popmenu
Canvas' context menu.
Definition: mathplot.h:3108
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1345
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1385
enum __mp_Style_Type mpLegendStyle
Style for the Legend layer.
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:3112
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:787
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:3136
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:3382
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:2211
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1027
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2037
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:788
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:3240
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1712
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2053
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:2599
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:3113
Plot (function) type layer.
Definition: mathplot.h:448
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:1948
int GetMarginRight() const
Get the right margin.
Definition: mathplot.h:2817
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:791
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1169
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:477
wxFont m_font
Layer's font.
Definition: mathplot.h:780
bool GetCanDelete(void) const
Get CanDelete for plot.
Definition: mathplot.h:764
Axis type layer.
Definition: mathplot.h:446
Definition: MathPlotConfig.h:44
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:1846
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:1996
Axis type layer.
Definition: mathplot.h:429
void SetCanDelete(bool canDelete)
Set CanDelete for plot.
Definition: mathplot.h:757
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3636
mpFloatRect Get_Bound(void) const
Get bounding box encompassing all visible plots on this mpWindow.
Definition: mathplot.h:2443
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:3151
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:958
double GetDesiredYmax(int yIndex) const
Returns the top layer-border coordinate that the user wants the mpWindow to show (it may be not exact...
Definition: mathplot.h:2733
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:1911
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:2943
double GetDesiredYmin(int yIndex) const
Returns the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not ex...
Definition: mathplot.h:2724
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:674
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition: mathplot.h:2195
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:1625
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:3211
Definition: mathplot.h:3095
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:3666
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:2977
each visible plot is described on its own line, one above the other
Definition: mathplot.h:358
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:2451
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:771
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:2865
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:987
__Info_Type
sub_type values for mpLAYER_INFO
Definition: mathplot.h:378
#define mpX_NORMAL
Set label for X axis in normal mode.
Definition: mathplot.h:2017
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:1577
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3643
Show/Hide info coord.
Definition: mathplot.h:293
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:688
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:3535
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:3313
int m_last_ly
For double buffering.
Definition: mathplot.h:3141
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:3161
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:891
Chart type layer.
Definition: mathplot.h:449
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:1995
enum __mp_Location_Type mpLocation
Location for the Info layer.
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, size_t axisIndex=0)
Full constructor.
Definition: mathplot.h:2115
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:918
std::vector< m_axisData > m_yAxisDataList
Current view's Y scales and Y positions.
Definition: mathplot.h:3119
Copy a screen shot to the clipboard.
Definition: mathplot.h:294
Fit view to match bounding box of all layers.
Definition: mathplot.h:287
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:3247
Toggle fullscreen only if parent is a frame windows.
Definition: mathplot.h:300
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:3142
Center view on click position.
Definition: mathplot.h:290
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1209
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1513
__XAxis_Align_Type
Alignment for X axis.
Definition: mathplot.h:319
mpFloatRect GetDesiredBoundingBox() const
Draws the mpWindow on a page for printing.
Definition: mathplot.h:2701
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:3364
double m_scaleX
Current view's X scale.
Definition: mathplot.h:3117
__Text_Type
sub_type values for mpLAYER_TEXT
Definition: mathplot.h:387
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1409
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
Definition: mathplot.h:3447
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1176
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:3701
unsigned int m_labelType
Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
Definition: mathplot.h:2081
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1141
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer t...
Definition: mathplot.h:202
Layer for bar chart.
Definition: mathplot.h:1739
#define mpX_USER
Set label user defined.
Definition: mathplot.h:2028
double m_max
Min and max axis values when autosize is false.
Definition: mathplot.h:1997
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:782
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:1006
abstract Layer for chart (bar and pie).
Definition: mathplot.h:1681
Show legend items with symbol used with the referred mpLayer.
Definition: mathplot.h:352
void SetPosY(const std::vector< double > &posYList)
Set current view's Y position and refresh display.
Definition: mathplot.h:2469
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:657
std::vector< mpScaleY * > m_YAxisList
Pointer to the optional Y axes layer of this mpWindow.
Definition: mathplot.h:3106
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:898
double m_bbox_min_x
The precomputed bounding box:
Definition: mathplot.h:3457
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:2706
virtual void DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:807
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition: mathplot.h:339
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1206
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:2829
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:1533
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1208
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3650
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:1964
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:1604
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1268
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:1552
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:1561
Text box type layer.
Definition: mathplot.h:432
void UpdateMargins()
Update margins if e.g.
Definition: mathplot.h:2793
__YAxis_Align_Type
Alignment for Y axis.
Definition: mathplot.h:329
int GetMarginTop() const
Get the top margin.
Definition: mathplot.h:2805
wxRect m_PlotArea
The full size of the plot with EXTRA_MARGIN.
Definition: mathplot.h:3138
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:833
Load a file.
Definition: mathplot.h:298
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:489
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:3262
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:3133
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:860
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:498
Line (horizontal or vertical) type layer.
Definition: mathplot.h:447
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:3156
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:942
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:2752
int m_scrY
Current view's Y dimension.
Definition: mathplot.h:3122
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:2577
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1148
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1041
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:919
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:3110
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:2503
int GetBarWidth(void) const
return the width of the bar
Definition: mathplot.h:1435
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:2962
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:980
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:1618
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:2894
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:3143
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1123
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1308
double GetPosY(int yIndex=0) const
Get current view's Y position.
Definition: mathplot.h:2483
mpTitle(const wxString &name)
Definition: mathplot.h:3292
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:972
Plot layer implementing a simple title.
Definition: mathplot.h:3283
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2108
enum __mp_Layer_ZOrder mpLayerZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:3400
bool ViewAsBar(void) const
return true if XY series is plotted with bar
Definition: mathplot.h:1443
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:923
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:722
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:2871
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:2461
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:750
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:786
std::vector< double > m_trans_shape_xs
The buffer for the translated & rotated points (to avoid recomputing them with each mpWindow refresh)...
Definition: mathplot.h:3452
void SetScaleY(const double scaleY, int yIndex)
Set current view's Y scale and refresh display.
Definition: mathplot.h:2421
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1925
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:1956
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1401
enum __XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
bool IsLogXaxis() const
Log axis control.
Definition: mathplot.h:2993
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1205
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:2983
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:1569
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
Full constructor.
Definition: mathplot.h:2045
~mpChart()
Destructor.
Definition: mathplot.h:1688
Abstract class providing an horizontal line.
Definition: mathplot.h:1260
Zoom into view at clickposition / window center.
Definition: mathplot.h:288
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:3109
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:3551
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:1586
void SetPos(const double posX, const std::vector< double > &posYList)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:2547
Zoom out.
Definition: mathplot.h:289
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:1878
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:617
Class for drawing mouse magnetization.
Definition: mathplot.h:2216
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:1573
__mp_Direction_Type
Direction for the Legend layer.
Definition: mathplot.h:356
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:3481
double m_minX
Loaded at SetData.
Definition: mathplot.h:1581
mpInfoCoords * m_InfoCoords
pointer to the optional info coords layer
Definition: mathplot.h:3152
double GetDesiredXmax() const
Returns the right-border layer coordinate that the user wants the mpWindow to show (it may be not exa...
Definition: mathplot.h:2715
__mp_Style_Type
Style for the Legend layer.
Definition: mathplot.h:348
Layer for pie chart.
Definition: mathplot.h:1801
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:633
bool IsNotSet() const
Is mpFloatRect set ?
Definition: mathplot.h:247
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:3487
wxCoord y2p(const double y, int yIndex=0) const
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2585
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:625
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:3144
int GetMarginLeft() const
Get the left margin.
Definition: mathplot.h:2847
wxColour m_fontcolour
Layer's font foreground colour.
Definition: mathplot.h:781
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:3526
Bitmap type layer.
Definition: mathplot.h:433
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:905
void UpdateBoundingBoxToInclude(double x, double y, size_t yIndex=0)
Update bounding box to include this point.
Definition: mathplot.h:229
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:715
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:1897
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:506
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:736
int GetMarginBottom() const
Get the bottom margin.
Definition: mathplot.h:2835
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1184
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:3369
Info box type layer.
Definition: mathplot.h:431
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:2538
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:550
Plot layer implementing a text string.
Definition: mathplot.h:3206
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:3134
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3428
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:2900
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:702
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:783
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition: mathplot.h:2823
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:534
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:921
Shows information about the mouse commands.
Definition: mathplot.h:299
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:2799
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:2413
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:3111
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:3166
legend components follow each other horizontally on a single line
Definition: mathplot.h:359
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1058
mpScaleX * m_XAxis
Pointer to the optional X axis layer of this mpWindow.
Definition: mathplot.h:3105
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 above)...
Definition: mathplot.h:3508
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:3124
void InitializeBoundingBox(double x, double y, size_t yIndex=0)
Initialize bounding box with an initial point.
Definition: mathplot.h:239
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:3437
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:1830
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1155
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3407
Plot layer, abstract base class.
Definition: mathplot.h:465
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:790
double p2y(const wxCoord pixelCoordY, int yIndex=0) const
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2569
double GetValue() const
Set x or y.
Definition: mathplot.h:1231
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:3254
void SetFactor(int factor)
Definition: mathplot.h:3339
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:601
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:778
size_t m_yAxisIndex
The index of the Y axis, 0 is the first axis (default)
Definition: mathplot.h:1210
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:1998
double m_posX
Current view's X position.
Definition: mathplot.h:3118
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition: mathplot.h:3121
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:681
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:609
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:3546
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:2841
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:3104
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:1994
mpRect m_margin
Margin around the plot including Y-axis.
Definition: mathplot.h:3131
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1650
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:912
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:3137
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:729
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1890
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3414
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:2624
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:2684
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:1940
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2082
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1162
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:3607
Text box type layer.
Definition: mathplot.h:451
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2302
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:743
Line (horizontal or vertical) type layer.
Definition: mathplot.h:434
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:1611