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" 75 #include <wx/scrolwin.h> 77 #include <wx/dynarray.h> 79 #include <wx/dcmemory.h> 80 #include <wx/string.h> 89 #ifdef ENABLE_MP_CONFIG 90 #include "MathPlotConfig.h" 91 #endif // ENABLE_MP_CONFIG 98 #ifdef ENABLE_MP_NAMESPACE 100 #endif // ENABLE_MP_NAMESPACE 102 #ifdef ENABLE_MP_DEBUG 107 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) 109 #define DEBUG_NEW new 112 #endif // ENABLE_MP_DEBUG 115 #define X_BORDER_SEPARATION 40 116 #define Y_BORDER_SEPARATION 60 119 #define mpX_LOCALTIME 0x10 121 #define mpX_UTCTIME 0x20 122 #define mpX_RAWTIME mpX_UTCTIME 126 #define ISNOTNULL(x) (fabs(x) > EPSILON) 129 #define EXTRA_MARGIN 8 135 class WXDLLIMPEXP_MATHPLOT
mpLayer;
137 class WXDLLIMPEXP_MATHPLOT
mpLine;
140 class WXDLLIMPEXP_MATHPLOT
mpFX;
141 class WXDLLIMPEXP_MATHPLOT
mpFY;
142 class WXDLLIMPEXP_MATHPLOT
mpFXY;
145 class WXDLLIMPEXP_MATHPLOT
mpChart;
147 class WXDLLIMPEXP_MATHPLOT
mpScale;
148 class WXDLLIMPEXP_MATHPLOT
mpScaleX;
149 class WXDLLIMPEXP_MATHPLOT
mpScaleY;
153 class WXDLLIMPEXP_MATHPLOT
mpWindow;
154 class WXDLLIMPEXP_MATHPLOT
mpText;
155 class WXDLLIMPEXP_MATHPLOT
mpTitle;
162 #ifdef ENABLE_MP_CONFIG 164 #endif // ENABLE_MP_CONFIG 207 mpFloatRect() : Xmin(0.0), Xmax(0.0), Ymin(0.0), Ymax(0.0), Y2min(0.0), Y2max(0.0) {}
210 if( (x < Xmin || x > Xmax) ||
211 (y < Ymin || y > Ymax) )
return false;
216 if (x < Xmin ) Xmin = x;
217 else if (x > Xmax ) Xmax = x;
218 if (y < Ymin ) Ymin = y;
219 else if (y > Ymax ) Ymax = y;
220 if (y2 < Y2min) Y2min = y2;
221 else if (y2 > Y2max) Y2max = y2;
232 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions> 233 bool operator==(
const mpFloatRect&)
const =
default;
239 auto Same = [
this,rect] (
double a,
double b) {
return fabs(a - b) < EPSILON; };
240 return Same(Xmin, rect.Xmin) && Same(Xmax, rect.Xmax) &&
241 Same(Ymin, rect.Ymin) && Same(Ymax, rect.Ymax) &&
242 Same(Y2min, rect.Y2min) && Same(Y2max, rect.Y2max) ;
260 #ifdef ENABLE_MP_CONFIG 262 #endif // ENABLE_MP_CONFIG 277 mpMarginBottomCenter,
286 mpALIGN_BORDER_BOTTOM = 10,
296 mpALIGN_BORDER_LEFT = 20,
327 typedef enum __Symbol_Type
359 typedef enum __Function_Type
371 typedef enum __Scale_Type
379 typedef enum __Chart_Type
430 class WXDLLIMPEXP_MATHPLOT
mpLayer:
public wxObject
433 mpLayer(mpLayerType layerType);
490 *sub_type = m_subtype;
491 return (m_type == type);
606 m_fontcolour = colour;
637 if (brush == wxNullBrush)
638 m_brush = *wxTRANSPARENT_BRUSH;
668 m_drawOutsideMargins = drawModeOutside;
675 return m_drawOutsideMargins;
682 wxBitmap GetColourSquare(
int side = 16);
730 m_CanDelete = canDelete;
767 void UpdateContext(wxDC &dc)
const;
773 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
786 void CheckLog(
double *x,
double *y);
792 wxDECLARE_DYNAMIC_CLASS(
mpLayer);
814 mpInfoLayer(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
821 virtual void SetVisible(
bool show);
827 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
839 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
844 virtual bool Inside(
const wxPoint &point);
848 virtual void Move(wxPoint delta);
851 virtual void UpdateReference();
857 return m_dim.GetPosition();
864 return m_dim.GetSize();
878 m_location = location;
900 virtual void DoPlot(wxDC &dc,
mpWindow &w);
904 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
926 mpInfoCoords(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
937 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
939 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
943 void SetLabelMode(
unsigned int mode,
unsigned int time_conv = mpX_RAWTIME)
946 m_timeConv = time_conv;
953 m_series_coord = show;
960 return m_series_coord;
966 virtual wxString GetInfoCoordsText(
double xVal,
double yVal,
double y2Val,
bool isY2Axis =
false);
977 unsigned int m_labelType;
978 unsigned int m_timeConv;
988 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1008 mpInfoLegend(wxRect rect,
const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1018 m_needs_update =
true;
1021 mpLegendStyle GetItemMode()
const 1030 m_item_direction = mode;
1031 m_needs_update =
true;
1034 mpLegendDirection GetItemDirection()
const 1036 return m_item_direction;
1039 void SetNeedUpdate()
1041 m_needs_update =
true;
1045 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1048 mpLegendStyle m_item_mode;
1049 mpLegendDirection m_item_direction;
1055 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1061 unsigned int layerIdx;
1065 std::vector<LegendDetail> m_LegendDetailList;
1066 bool m_needs_update;
1077 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1098 mpFunction(mpLayerType layerType =
mpLAYER_PLOT,
const wxString &name = wxEmptyString,
bool useY2Axis =
false);
1105 m_continuous = continuity;
1113 return m_continuous;
1148 m_symbolSize = size;
1149 m_symbolSize2 = size / 2;
1156 return m_symbolSize;
1162 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1169 m_UseY2Axis = _useY2;
1196 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1224 return m_IsHorizontal;
1229 bool m_IsHorizontal;
1231 wxDECLARE_DYNAMIC_CLASS(
mpLine);
1239 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN,
bool useY2Axis =
false);
1251 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1273 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1290 mpFX(
const wxString &name = wxEmptyString,
int flags = mpALIGN_RIGHT,
bool useY2Axis =
false);
1297 virtual double GetY(
double x) = 0;
1302 double DoGetY(
double x);
1310 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1312 wxDECLARE_DYNAMIC_CLASS(
mpFX);
1327 mpFY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP,
bool useY2Axis =
false);
1334 virtual double GetX(
double y) = 0;
1339 double DoGetX(
double y);
1347 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1349 wxDECLARE_DYNAMIC_CLASS(
mpFY);
1367 mpFXY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
bool useY2Axis =
false);
1372 virtual void Rewind() = 0;
1396 virtual bool GetNextXY(
double *x,
double *y) = 0;
1401 bool DoGetNextXY(
double *x,
double *y);
1406 void SetViewMode(
bool asBar);
1427 wxCoord maxDrawX, minDrawX, maxDrawY, minDrawY;
1430 double m_deltaX, m_deltaY;
1436 bool m_ViewAsBar =
false;
1439 bool m_CanDelete =
true;
1445 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1451 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1453 wxDECLARE_DYNAMIC_CLASS(
mpFXY);
1485 mpFXYVector(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
bool useY2Axis =
false);
1498 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
1521 bool AddData(
const double x,
const double y,
bool updatePlot);
1530 m_reserveXY = reserve;
1531 m_xs.reserve(m_reserveXY);
1532 m_ys.reserve(m_reserveXY);
1557 double m_minX, m_maxX, m_minY, m_maxY, m_lastX, m_lastY;
1572 virtual bool GetNextXY(
double *x,
double *y);
1576 void DrawAddedPoint(
double x,
double y);
1609 void First_Point(
double x,
double y);
1613 void Check_Limit(
double val,
double *min,
double *max,
double *last,
double *delta);
1632 mpProfile(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP);
1639 virtual double GetY(
double x) = 0;
1647 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1661 mpChart(
const wxString &name = wxEmptyString);
1671 void SetChartValues(
const std::vector<double> &data);
1675 void SetChartLabels(
const std::vector<std::string> &labelArray);
1681 void AddData(
const double &data,
const std::string &label);
1686 virtual void Clear();
1690 return (values.size() > 0);
1694 std::vector<double> values;
1695 std::vector<std::string> labels;
1698 double m_total_value;
1700 wxDECLARE_DYNAMIC_CLASS(
mpChart);
1707 #define mpBAR_NONE 0 1708 #define mpBAR_AXIS_H 1 1709 #define mpBAR_AXIS_V 2 1710 #define mpBAR_INSIDE 3 1719 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
1727 void SetBarColour(
const wxColour &colour);
1729 void SetColumnWidth(
const double colWidth)
1735 void SetBarLabelPosition(
int position);
1740 virtual double GetMinX();
1745 virtual double GetMaxX();
1750 virtual double GetMinY();
1755 virtual double GetMaxY();
1760 wxColour m_barColour;
1762 double m_labelAngle;
1768 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1781 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
1793 void SetPieColours(
const std::vector<wxColour> &colourArray);
1830 std::vector<wxColour> colours;
1836 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1838 const wxColour& GetColour(
unsigned int id);
1861 mpScale(
const wxString &name,
int flags,
bool grids);
1903 m_labelFormat = format;
1910 return m_labelFormat;
1934 m_auto = automaticScalingIsEnabled;
1945 void SetMinScale(
double min)
1950 double GetMinScale()
const 1955 void SetMaxScale(
double max)
1960 double GetMaxScale()
const 1965 virtual bool IsLogAxis() = 0;
1966 virtual void SetLogAxis(
bool log) = 0;
1976 virtual int GetOrigin(
mpWindow &w) = 0;
1977 double GetStep(
double scale);
1978 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
1980 wxString FormatLogValue(
double n);
1982 wxDECLARE_DYNAMIC_CLASS(
mpScale);
1986 #define mpX_NORMAL 0x00 1989 #define mpX_TIME 0x01 1991 #define mpX_HOURS 0x02 1993 #define mpX_DATE 0x03 1995 #define mpX_DATETIME 0x04 1997 #define mpX_USER 0x05 1999 #define mpX_NONE 0x06 2014 mpScaleX(
const wxString &name = _T(
"X"),
int flags = mpALIGN_CENTERX,
bool grids =
false,
unsigned int type =
mpX_NORMAL) :
2017 m_subtype = mpsScaleX;
2019 m_timeConv = mpX_RAWTIME;
2040 m_timeConv = time_conv;
2046 virtual bool IsLogAxis();
2047 virtual void SetLogAxis(
bool log);
2055 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2057 virtual int GetOrigin(
mpWindow &w);
2058 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2059 wxString FormatValue(
const wxString &fmt,
double n);
2078 mpScaleY(
const wxString &name = _T(
"Y"),
int flags = mpALIGN_CENTERY,
bool grids =
false,
bool Y2Axis =
false) :
2081 m_subtype = mpsScaleY;
2082 m_isY2Axis = Y2Axis;
2088 virtual bool IsLogAxis();
2089 virtual void SetLogAxis(
bool log);
2091 virtual bool IsY2Axis()
2095 virtual void SetY2Axis(
bool y2Axis);
2102 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2104 virtual int GetOrigin(
mpWindow &w);
2105 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2118 #define mpMOUSEMODE_DRAG 0 2120 #define mpMOUSEMODE_ZOOMBOX 1 2133 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)>
mpOnDeleteLayer;
2152 m_rightClick =
false;
2153 m_IsWasDrawn =
false;
2159 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2161 m_domain = wxRect(left, top, width, height);
2162 m_plot_size = wxRect(left, top, width + left, height + top);
2164 void UpdateBox(
const wxRect &size)
2167 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2168 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2170 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2171 void ClearPlot(wxClientDC &dc);
2172 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2173 void SaveDrawState(
void)
2175 m_IsWasDrawn = m_IsDrawn;
2180 void SetRightClick(
void)
2182 m_rightClick =
true;
2188 wxPoint m_mousePosition;
2192 void DrawCross(wxClientDC &dc)
const;
2224 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2244 bool AddLayer(
mpLayer *layer,
bool refreshDisplay =
true);
2255 bool DelLayer(
mpLayer *layer,
bool alsoDeleteObject,
bool refreshDisplay =
true);
2261 void DelAllLayers(
bool alsoDeleteObject,
bool refreshDisplay =
true);
2268 void DelAllPlot(
bool alsoDeleteObject, mpFunctionType func = mpfAllType,
bool refreshDisplay =
true);
2275 mpLayer* GetLayer(
int position);
2283 mpLayer* GetLayersType(
int position, mpLayerType type);
2290 mpLayer* GetLayerPlot(
int position, mpFunctionType func = mpfAllType);
2294 mpLayer* GetLayerAxis(
int position, mpScaleType scale = mpsAllType);
2300 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
2305 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear,
bool *isY2Axis);
2311 mpLayer* GetLayerByName(
const wxString &name);
2317 mpLayer* GetLayerByClassName(
const wxString &name);
2322 void RefreshLegend(
void);
2344 if (ISNOTNULL(scaleX))
2363 if (ISNOTNULL(scaleY))
2380 [[deprecated(
"Incomplete, use UpdateBBox instead")]]
2412 void SetPosY(
const double posY,
const double posY2)
2440 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
2441 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
2443 m_plotBoundaries.endPx = m_scrX;
2444 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
2445 m_plotBoundaries.endPy = m_scrY;
2446 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
2448 m_PlotArea = wxRect(m_margin.left - EXTRA_MARGIN, m_margin.top - EXTRA_MARGIN,
2449 m_plotWidth + 2*EXTRA_MARGIN, m_plotHeight + 2*EXTRA_MARGIN);
2451 m_magnet.UpdateBox(m_PlotArea);
2480 void SetPos(
const double posX,
const double posY,
const double posY2)
2491 inline double p2x(
const wxCoord pixelCoordX)
const 2493 return m_posX + pixelCoordX / m_scaleX;
2499 inline double p2y(
const wxCoord pixelCoordY,
bool Y2 =
false)
const 2502 return m_posY2 - pixelCoordY / m_scaleY2;
2504 return m_posY - pixelCoordY / m_scaleY;
2510 inline wxCoord
x2p(
const double x)
const 2512 return (wxCoord)((x - m_posX) * m_scaleX);
2518 inline wxCoord
y2p(
const double y,
bool Y2 =
false)
const 2521 return (wxCoord)((m_posY2 - y) * m_scaleY2);
2523 return (wxCoord)((m_posY - y) * m_scaleY);
2530 m_enableDoubleBuffer = enabled;
2537 m_enableMouseNavigation = enabled;
2545 void LockAspect(
bool enable =
true);
2553 return m_lockaspect;
2562 return m_repainting;
2577 void Fit(
const mpFloatRect &rect, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
2583 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
2589 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
2604 void ZoomRect(wxPoint p0, wxPoint p1);
2614 unsigned int CountLayers();
2620 return (
unsigned int)m_layers.size();
2626 unsigned int CountLayersType(mpLayerType type);
2627 unsigned int CountLayersFXYPlot();
2642 return m_desired.Xmin;
2651 return m_desired.Xmax;
2660 return m_desired.Ymin;
2669 return m_desired.Ymax;
2674 void GetBoundingBox(
double *bbox)
const;
2682 void SetMPScrollbars(
bool status);
2688 return m_enableScrollBars;
2696 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
2701 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2706 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2712 bool LoadFile(
const wxString &filename);
2724 void SetMargins(
int top,
int right,
int bottom,
int left);
2729 SetMargins(top, m_margin.right, m_margin.bottom, m_margin.left);
2735 return m_margin.top;
2741 SetMargins(m_margin.top, right, m_margin.bottom, m_margin.left);
2747 return m_margin.right;
2753 SetMargins(m_margin.top, m_margin.right, bottom, m_margin.left);
2759 return m_margin.bottom;
2765 SetMargins(m_margin.top, m_margin.right, m_margin.bottom, left);
2771 return m_margin.left;
2783 return m_plotHeight;
2791 bond = m_plotBoundariesMargin;
2793 bond = m_plotBoundaries;
2794 bond.startPx -= EXTRA_MARGIN;
2795 bond.endPx += EXTRA_MARGIN;
2796 bond.startPy -= EXTRA_MARGIN;
2797 bond.endPy += EXTRA_MARGIN;
2804 m_drawBox = drawbox;
2816 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
2821 void SetLayerVisible(
const wxString &name,
bool viewable);
2826 bool IsLayerVisible(
const wxString &name);
2831 bool IsLayerVisible(
const unsigned int position);
2836 void SetLayerVisible(
const unsigned int position,
bool viewable);
2842 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
2851 const wxColour& GetbgColour()
const 2856 void SetbgColour(
const wxColour &colour)
2858 m_bgColour = colour;
2867 m_OnDeleteLayer = event;
2873 m_OnDeleteLayer = NULL;
2882 m_OnUserMouseAction = userMouseEventHandler;
2888 m_OnUserMouseAction = NULL;
2901 bool IsLogYaxis()
const 2906 void SetLogXaxis(
bool log)
2911 void SetLogYaxis(
bool log)
2916 bool GetMagnetize()
const 2921 void SetMagnetize(
bool mag)
2926 #ifdef ENABLE_MP_CONFIG 2927 void RefreshConfigWindow();
2933 #endif // ENABLE_MP_CONFIG 2935 void Update_CountY2Axis(
bool Y2Axis);
2937 bool Y2AxisExist(
void)
const 2939 return m_countY2Axis > 0;
2943 virtual void OnPaint(wxPaintEvent &event);
2944 virtual void OnSize(wxSizeEvent &event);
2945 virtual void OnShowPopupMenu(wxMouseEvent &event);
2946 virtual void OnCenter(wxCommandEvent &event);
2947 virtual void OnFit(wxCommandEvent &event);
2948 virtual void OnToggleGrids(wxCommandEvent &event);
2949 virtual void OnToggleCoords(wxCommandEvent &event);
2950 virtual void OnScreenShot(wxCommandEvent &event);
2951 virtual void OnFullScreen(wxCommandEvent &event);
2952 #ifdef ENABLE_MP_CONFIG 2953 virtual void OnConfiguration(wxCommandEvent &event);
2954 #endif // ENABLE_MP_CONFIG 2955 virtual void OnLoadFile(wxCommandEvent &event);
2956 virtual void OnZoomIn(wxCommandEvent &event);
2957 virtual void OnZoomOut(wxCommandEvent &event);
2958 virtual void OnLockAspect(wxCommandEvent &event);
2959 virtual void OnMouseHelp(wxCommandEvent &event);
2960 virtual void OnMouseLeftDown(wxMouseEvent &event);
2961 virtual void OnMouseRightDown(wxMouseEvent &event);
2962 virtual void OnMouseMove(wxMouseEvent &event);
2963 virtual void OnMouseLeftRelease(wxMouseEvent &event);
2964 virtual void OnMouseWheel(wxMouseEvent &event);
2965 virtual void OnMouseLeave(wxMouseEvent &event);
2966 bool CheckUserMouseAction(wxMouseEvent &event);
2967 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
2968 virtual void OnScrollPageUp(wxScrollWinEvent &event);
2969 virtual void OnScrollPageDown(wxScrollWinEvent &event);
2970 virtual void OnScrollLineUp(wxScrollWinEvent &event);
2971 virtual void OnScrollLineDown(wxScrollWinEvent &event);
2972 virtual void OnScrollTop(wxScrollWinEvent &event);
2973 virtual void OnScrollBottom(wxScrollWinEvent &event);
2975 void DoScrollCalc(
const int position,
const int orientation);
2977 void DoZoomInXCalc(
const int staticXpixel);
2978 void DoZoomInYCalc(
const int staticYpixel);
2979 void DoZoomOutXCalc(
const int staticXpixel);
2980 void DoZoomOutYCalc(
const int staticYpixel);
2982 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
2986 virtual bool UpdateBBox();
2988 void InitParameters();
2990 wxTopLevelWindow* m_parent;
3035 bool m_mouseMovedAfterRightClick;
3038 bool m_enableScrollBars;
3039 int m_scrollX, m_scrollY;
3043 bool m_InInfoLegend;
3047 wxRect m_zoom_oldDim;
3052 bool m_LogXaxis =
false;
3053 bool m_LogYaxis =
false;
3057 #ifdef ENABLE_MP_CONFIG 3059 #endif // ENABLE_MP_CONFIG 3061 mpOnDeleteLayer m_OnDeleteLayer = NULL;
3062 mpOnUserMouseAction m_OnUserMouseAction = NULL;
3070 int m_countY2Axis = 0;
3071 void FillI18NString();
3074 void CheckAndReportDesiredBoundsChanges();
3075 bool m_initialDesiredBoundsRecorded =
false;
3079 wxDECLARE_EVENT_TABLE();
3103 m_subtype = mptText;
3107 m_location = mpMarginNone;
3114 mpText(
const wxString &name,
int offsetx,
int offsety);
3119 mpText(
const wxString &name, mpLocation marginLocation);
3132 m_location = location;
3161 mpLocation m_location;
3165 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3167 wxDECLARE_DYNAMIC_CLASS(
mpText);
3183 mpText(name, mpMarginTopCenter)
3185 m_subtype = mptTitle;
3186 SetPen(*wxWHITE_PEN);
3187 SetBrush(*wxWHITE_BRUSH);
3192 wxDECLARE_DYNAMIC_CLASS(
mpTitle);
3213 mpPrintout(
mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
3219 void SetDrawState(
bool drawState)
3224 bool OnPrintPage(
int page);
3225 bool HasPage(
int page);
3231 stretch_factor = factor;
3260 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
3263 m_subtype = mpfMovable;
3264 m_bbox_min_x = m_bbox_max_x = 0;
3265 m_bbox_min_y = m_bbox_max_y = 0;
3276 phi = m_reference_phi;
3285 m_reference_phi = phi;
3286 m_flags = mpALIGN_NE;
3292 return m_trans_shape_xs.size() != 0;
3299 return m_bbox_min_x;
3306 return m_bbox_max_x;
3313 return m_bbox_min_y;
3320 return m_bbox_max_y;
3329 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3333 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
3352 void ShapeUpdated();
3377 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
3379 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
3381 m_continuous =
true;
3391 double GetQuantiles()
const 3404 void SetSegments(
int segments)
3406 m_segments = segments;
3409 int GetSegments()
const 3445 void RecalculateShape();
3464 m_continuous =
true;
3478 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
3499 m_min_x = m_max_x = 0;
3500 m_min_y = m_max_y = 0;
3502 m_bitmapChanged =
false;
3503 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
3513 void GetBitmapCopy(wxImage &outBmp)
const;
3522 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
3557 wxBitmap m_scaledBitmap;
3558 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
3560 bool m_bitmapChanged;
3566 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3574 typedef enum __mp_Colour
3599 this->Set(0, 0, 255);
3602 this->Set(255, 0, 0);
3605 this->Set(0, 128, 0);
3608 this->Set(128, 0, 128);
3611 this->Set(255, 255, 0);
3614 this->Set(255, 0, 255);
3617 this->Set(0, 255, 0);
3620 this->Set(0, 255, 255);
3623 this->Set(128, 128, 0);
3626 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
3627 (ChannelType)((rand() * 255) / RAND_MAX));
3635 #ifdef ENABLE_MP_NAMESPACE 3638 #endif // ENABLE_MP_NAMESPACE 3640 #endif // MATHPLOT_H_INCLUDED int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:3160
const wxString & GetLabelFormat() const
Get axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1908
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:2133
bool IsHorizontal(void) const
Get if is horizontal line.
Definition: mathplot.h:1222
__mp_Location_Type
Location for the Info layer.
Definition: mathplot.h:269
void SetScaleY(const double scaleY)
Set current view's Y scale and refresh display.
Definition: mathplot.h:2361
double GetDesiredYmin() const
Returns the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not ex...
Definition: mathplot.h:2658
double m_posY
Current view's Y position.
Definition: mathplot.h:3010
void SetValue(const double value)
Set x or y.
Definition: mathplot.h:1215
mpInfoLegend * m_InfoLegend
pointer to the optional info legend layer
Definition: mathplot.h:3042
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:316
double m_min_x
The shape of the bitmap:
Definition: mathplot.h:3564
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:2528
mpFloatRect m_bound
Global layer bounding box in user coordinates. Does NOT include borders.
Definition: mathplot.h:3005
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:635
Bitmap type layer.
Definition: mathplot.h:410
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:756
double GetScaleY(bool Y2=false) const
Get current view's Y scale.
Definition: mathplot.h:2372
Plot type layer.
Definition: mathplot.h:395
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:2460
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3547
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:2871
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1266
double GetPosY(bool Y2=false) const
Get current view's Y position.
Definition: mathplot.h:2423
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:3457
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:2342
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:513
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:167
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1479
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:3014
Show legend items with line with the same pen of referred mpLayer.
Definition: mathplot.h:315
__mp_Layer_Type
Definition: mathplot.h:391
bool PointIsInside(double x, double y) const
Is point inside this bounding box (ignoring Y2)?
Definition: mathplot.h:209
Show/Hide grids.
Definition: mathplot.h:257
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:3492
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:3049
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:1814
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:3036
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:1798
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:3462
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:1894
void InitializeBoundingBox(double x, double y, double y2=0)
Initialize bounding box with an initial point.
Definition: mathplot.h:224
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:393
enum __mp_Direction_Type mpLegendDirection
Direction for the Legend layer.
wxString m_name
Layer's name.
Definition: mathplot.h:755
virtual bool IsLayerType(mpLayerType type, int *sub_type)
Specifies that if the layer is of type "type".
Definition: mathplot.h:488
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:748
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1199
Lock x/y scaling aspect.
Definition: mathplot.h:256
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:1015
Info box type layer.
Definition: mathplot.h:415
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:3159
Abstract class providing a line.
Definition: mathplot.h:1193
Abstract class providing an vertical line.
Definition: mathplot.h:1258
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:1880
mpFloatRect m_desired
These are updated in Fit() only (also Zoom) May be different from the real borders (layer coordinates...
Definition: mathplot.h:3020
void SetPos(const double posX, const double posY, const double posY2)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:2480
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2216
enum __Info_Type mpInfoType
sub_type values for mpLAYER_INFO
double m_scaleY
Current view's Y scale.
Definition: mathplot.h:3007
wxPen m_gridpen
Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition: mathplot.h:1969
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:891
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:3281
Chart type layer (bar chart)
Definition: mathplot.h:400
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:612
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:2551
int m_winY
Holds the mpWindow size. Used to rescale position when window is resized.
Definition: mathplot.h:893
~mpBarChart()
Destructor.
Definition: mathplot.h:1722
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:2491
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:763
double p2y(const wxCoord pixelCoordY, bool Y2=false) const
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2499
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:2037
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:3037
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:3067
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:620
int m_flags
Holds label alignment. Default : mpALIGN_NE.
Definition: mathplot.h:760
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:3123
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:497
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:855
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:970
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:666
unsigned int GetLabelMode() const
Get X axis label view mode.
Definition: mathplot.h:2030
~mpPieChart()
Destructor.
Definition: mathplot.h:1784
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1183
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:2775
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:750
Just the end of ZOrder.
Definition: mathplot.h:417
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3311
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
Definition: mathplot.h:408
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:2739
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:2716
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1103
wxMenu m_popmenu
Canvas' context menu.
Definition: mathplot.h:2998
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1321
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1361
enum __mp_Style_Type mpLegendStyle
Style for the Legend layer.
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:3002
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:758
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:3026
double m_scaleY2
Current view's Y2 scale.
Definition: mathplot.h:3008
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:3272
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:2141
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:997
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2006
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:759
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:3130
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1688
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2022
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:2535
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:3003
Plot (function) type layer.
Definition: mathplot.h:413
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:1924
int GetMarginRight() const
Get the right margin.
Definition: mathplot.h:2745
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:762
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1139
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:442
wxFont m_font
Layer's font.
Definition: mathplot.h:751
bool GetCanDelete(void) const
Get CanDelete for plot.
Definition: mathplot.h:735
Axis type layer.
Definition: mathplot.h:411
Definition: MathPlotConfig.h:44
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:1822
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:1972
Axis type layer.
Definition: mathplot.h:394
void SetCanDelete(bool canDelete)
Set CanDelete for plot.
Definition: mathplot.h:728
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3526
mpFloatRect Get_Bound(void) const
Get bounding box encompassing all visible plots on this mpWindow.
Definition: mathplot.h:2386
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:3040
void SetPosY(const double posY, const double posY2)
Set current view's Y position and refresh display.
Definition: mathplot.h:2412
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:929
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:1887
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, bool Y2Axis=false)
Full constructor.
Definition: mathplot.h:2078
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:2846
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:645
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition: mathplot.h:2125
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:1601
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:3101
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:3556
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:2880
each visible plot is described on its own line, one above the other
Definition: mathplot.h:323
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:2394
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:742
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:2781
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:958
__Info_Type
sub_type values for mpLAYER_INFO
Definition: mathplot.h:343
#define mpX_NORMAL
Set label for X axis in normal mode.
Definition: mathplot.h:1986
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:1553
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3533
Show/Hide info coord.
Definition: mathplot.h:258
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:659
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:3425
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:3203
int m_last_ly
For double buffering.
Definition: mathplot.h:3031
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:3050
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:862
Chart type layer.
Definition: mathplot.h:414
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:1971
enum __mp_Location_Type mpLocation
Location for the Info layer.
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:889
Copy a screen shot to the clipboard.
Definition: mathplot.h:259
Fit view to match bounding box of all layers.
Definition: mathplot.h:252
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:3137
Toggle fullscreen only if parent is a frame windows.
Definition: mathplot.h:265
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:3032
Center view on click position.
Definition: mathplot.h:255
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1185
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1489
__XAxis_Align_Type
Alignment for X axis.
Definition: mathplot.h:284
mpFloatRect GetDesiredBoundingBox() const
Draws the mpWindow on a page for printing.
Definition: mathplot.h:2635
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:3254
double m_scaleX
Current view's X scale.
Definition: mathplot.h:3006
__Text_Type
sub_type values for mpLAYER_TEXT
Definition: mathplot.h:352
double m_posY2
Current view's Y2 position.
Definition: mathplot.h:3011
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1385
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
Definition: mathplot.h:3337
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1146
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:3591
unsigned int m_labelType
Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
Definition: mathplot.h:2050
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1111
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer t...
Definition: mathplot.h:199
Layer for bar chart.
Definition: mathplot.h:1715
#define mpX_USER
Set label user defined.
Definition: mathplot.h:1997
double m_max
Min and max axis values when autosize is false.
Definition: mathplot.h:1973
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:753
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:976
abstract Layer for chart (bar and pie).
Definition: mathplot.h:1657
bool GetY2Axis() const
Is second Y axis selected for this layer?
Definition: mathplot.h:1175
Show legend items with symbol used with the referred mpLayer.
Definition: mathplot.h:317
bool m_UseY2Axis
Use Y2 axis. This second axis must exist.
Definition: mathplot.h:1186
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:628
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:869
double m_bbox_min_x
The precomputed bounding box:
Definition: mathplot.h:3347
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:2640
virtual void DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:778
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition: mathplot.h:304
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1182
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:2751
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:1509
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1184
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3540
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:1940
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:1580
mpScaleY * m_Y2Axis
Pointer to the optional Y2 axis layer of this mpWindow.
Definition: mathplot.h:2996
mpScaleY * m_YAxis
Pointer to the optional Y axis layer of this mpWindow.
Definition: mathplot.h:2995
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1244
void SetY2Axis(bool _useY2)
Set use of second Y axis.
Definition: mathplot.h:1167
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:1528
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:1537
Text box type layer.
Definition: mathplot.h:397
__YAxis_Align_Type
Alignment for Y axis.
Definition: mathplot.h:294
int GetMarginTop() const
Get the top margin.
Definition: mathplot.h:2733
wxRect m_PlotArea
The full size of the plot with EXTRA_MARGIN.
Definition: mathplot.h:3028
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:804
Load a file.
Definition: mathplot.h:263
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:454
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:3152
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:3023
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:831
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:469
Line (horizontal or vertical) type layer.
Definition: mathplot.h:412
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:3045
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:913
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:2686
int m_scrY
Current view's Y dimension.
Definition: mathplot.h:3013
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:2510
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1118
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1011
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:890
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:3000
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:2436
int GetBarWidth(void) const
return the width of the bar
Definition: mathplot.h:1411
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:2865
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:951
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:1594
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:2802
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:3033
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1093
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1284
mpTitle(const wxString &name)
Definition: mathplot.h:3182
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:943
Plot layer implementing a simple title.
Definition: mathplot.h:3173
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2070
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:3290
bool ViewAsBar(void) const
return true if XY series is plotted with bar
Definition: mathplot.h:1419
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:894
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:693
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:2787
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:2404
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:721
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:757
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:3342
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1901
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:1932
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1377
double GetDesiredYmax() const
Returns the top layer-border coordinate that the user wants the mpWindow to show (it may be not exact...
Definition: mathplot.h:2667
enum __XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
bool IsLogXaxis() const
Log axis control.
Definition: mathplot.h:2896
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1181
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:2886
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:1545
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
Full constructor.
Definition: mathplot.h:2014
~mpChart()
Destructor.
Definition: mathplot.h:1664
Abstract class providing an horizontal line.
Definition: mathplot.h:1236
Zoom into view at clickposition / window center.
Definition: mathplot.h:253
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:2999
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:3441
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:1562
Zoom out.
Definition: mathplot.h:254
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:1854
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:588
Class for drawing mouse magnetization.
Definition: mathplot.h:2146
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:1549
__mp_Direction_Type
Direction for the Legend layer.
Definition: mathplot.h:321
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:3371
double m_minX
Loaded at SetData.
Definition: mathplot.h:1557
mpInfoCoords * m_InfoCoords
pointer to the optional info coords layer
Definition: mathplot.h:3041
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:2649
__mp_Style_Type
Style for the Legend layer.
Definition: mathplot.h:313
Layer for pie chart.
Definition: mathplot.h:1777
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:604
bool IsNotSet() const
Is mpFloatRect set ?
Definition: mathplot.h:230
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:3377
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:596
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:3034
int GetMarginLeft() const
Get the left margin.
Definition: mathplot.h:2769
wxColour m_fontcolour
Layer's font foreground colour.
Definition: mathplot.h:752
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:3416
Bitmap type layer.
Definition: mathplot.h:398
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:876
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:686
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:1873
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:477
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:707
int GetMarginBottom() const
Get the bottom margin.
Definition: mathplot.h:2757
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1154
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:3259
Info box type layer.
Definition: mathplot.h:396
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:2471
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:521
Plot layer implementing a text string.
Definition: mathplot.h:3096
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:3024
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3318
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:2808
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:673
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:754
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:505
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:892
Shows information about the mouse commands.
Definition: mathplot.h:264
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:2727
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:2353
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:3001
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:3055
legend components follow each other horizontally on a single line
Definition: mathplot.h:324
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1028
mpScaleX * m_XAxis
Pointer to the optional X axis layer of this mpWindow.
Definition: mathplot.h:2994
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:3398
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:3015
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:3327
wxCoord y2p(const double y, bool Y2=false) const
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2518
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:1806
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1125
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3297
Plot layer, abstract base class.
Definition: mathplot.h:430
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:761
double GetValue() const
Set x or y.
Definition: mathplot.h:1207
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:3144
void SetFactor(int factor)
Definition: mathplot.h:3229
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:572
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:749
void UpdateBoundingBoxToInclude(double x, double y, double y2=0)
Update bounding box to include this point.
Definition: mathplot.h:215
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:1974
double m_posX
Current view's X position.
Definition: mathplot.h:3009
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition: mathplot.h:3012
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:652
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:580
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:3436
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:2763
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:2993
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:1970
mpRect m_margin
Margin around the plot. Default 50.
Definition: mathplot.h:3022
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1626
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:883
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:3027
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:700
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1866
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3304
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:2560
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:2618
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:1916
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2051
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1132
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:3497
Text box type layer.
Definition: mathplot.h:416
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2232
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:714
Line (horizontal or vertical) type layer.
Definition: mathplot.h:399
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:1587