13 #ifndef _MP_MATHPLOT_H_ 14 #define _MP_MATHPLOT_H_ 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> 88 #define ENABLE_MP_CONFIG 89 #ifdef ENABLE_MP_CONFIG 90 #include "MathPlotConfig.h" 91 #endif // ENABLE_MP_CONFIG 96 #define ENABLE_MP_NAMESPACE 97 #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 210 mpFloatRect() : Xmin(0.0), Xmax(0.0), Ymin(0.0), Ymax(0.0), Y2min(0.0), Y2max(0.0) {}
213 if( (x < Xmin || x > Xmax) ||
214 (y < Ymin || y > Ymax) )
return false;
219 if (x < Xmin ) Xmin = x;
220 else if (x > Xmax ) Xmax = x;
221 if (y < Ymin ) Ymin = y;
222 else if (y > Ymax ) Ymax = y;
223 if (y2 < Y2min) Y2min = y2;
224 else if (y2 > Y2max) Y2max = y2;
235 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions> 242 auto Same = [
this,rect] (
double a,
double b) {
return fabs(a - b) < EPSILON; };
243 return Same(Xmin, rect.Xmin) && Same(Xmax, rect.Xmax) &&
244 Same(Ymin, rect.Ymin) && Same(Ymax, rect.Ymax) &&
245 Same(Y2min, rect.Y2min) && Same(Y2max, rect.Y2max) ;
263 #ifdef ENABLE_MP_CONFIG 265 #endif // ENABLE_MP_CONFIG 280 mpMarginBottomCenter,
289 mpALIGN_BORDER_BOTTOM = 10,
299 mpALIGN_BORDER_LEFT = 20,
330 typedef enum __Symbol_Type
362 typedef enum __Function_Type
374 typedef enum __Scale_Type
382 typedef enum __Chart_Type
433 class WXDLLIMPEXP_MATHPLOT
mpLayer:
public wxObject
436 mpLayer(mpLayerType layerType);
493 *sub_type = m_subtype;
494 return (m_type == type);
609 m_fontcolour = colour;
640 if (brush == wxNullBrush)
641 m_brush = *wxTRANSPARENT_BRUSH;
671 m_drawOutsideMargins = drawModeOutside;
678 return m_drawOutsideMargins;
685 wxBitmap GetColourSquare(
int side = 16);
733 m_CanDelete = canDelete;
770 void UpdateContext(wxDC &dc)
const;
776 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
789 void CheckLog(
double *x,
double *y);
795 wxDECLARE_DYNAMIC_CLASS(
mpLayer);
817 mpInfoLayer(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
824 virtual void SetVisible(
bool show);
830 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
842 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
847 virtual bool Inside(
const wxPoint &point);
851 virtual void Move(wxPoint delta);
854 virtual void UpdateReference();
860 return m_dim.GetPosition();
867 return m_dim.GetSize();
881 m_location = location;
903 virtual void DoPlot(wxDC &dc,
mpWindow &w);
907 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
929 mpInfoCoords(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
940 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
942 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
946 void SetLabelMode(
unsigned int mode,
unsigned int time_conv = mpX_RAWTIME)
949 m_timeConv = time_conv;
956 m_series_coord = show;
963 return m_series_coord;
969 virtual wxString GetInfoCoordsText(
double xVal,
double yVal,
double y2Val,
bool isY2Axis =
false);
980 unsigned int m_labelType;
981 unsigned int m_timeConv;
991 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1011 mpInfoLegend(wxRect rect,
const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1021 m_needs_update =
true;
1024 mpLegendStyle GetItemMode()
const 1033 m_item_direction = mode;
1034 m_needs_update =
true;
1037 mpLegendDirection GetItemDirection()
const 1039 return m_item_direction;
1042 void SetNeedUpdate()
1044 m_needs_update =
true;
1048 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1051 mpLegendStyle m_item_mode;
1052 mpLegendDirection m_item_direction;
1058 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1064 unsigned int layerIdx;
1068 std::vector<LegendDetail> m_LegendDetailList;
1069 bool m_needs_update;
1080 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1101 mpFunction(mpLayerType layerType =
mpLAYER_PLOT,
const wxString &name = wxEmptyString,
bool useY2Axis =
false);
1108 m_continuous = continuity;
1116 return m_continuous;
1151 m_symbolSize = size;
1152 m_symbolSize2 = size / 2;
1159 return m_symbolSize;
1165 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1172 m_UseY2Axis = _useY2;
1199 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1227 return m_IsHorizontal;
1232 bool m_IsHorizontal;
1234 wxDECLARE_DYNAMIC_CLASS(
mpLine);
1242 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN,
bool useY2Axis =
false);
1254 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1276 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1293 mpFX(
const wxString &name = wxEmptyString,
int flags = mpALIGN_RIGHT,
bool useY2Axis =
false);
1300 virtual double GetY(
double x) = 0;
1305 double DoGetY(
double x);
1313 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1315 wxDECLARE_DYNAMIC_CLASS(
mpFX);
1330 mpFY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP,
bool useY2Axis =
false);
1337 virtual double GetX(
double y) = 0;
1342 double DoGetX(
double y);
1350 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1352 wxDECLARE_DYNAMIC_CLASS(
mpFY);
1370 mpFXY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
bool useY2Axis =
false);
1375 virtual void Rewind() = 0;
1399 virtual bool GetNextXY(
double *x,
double *y) = 0;
1404 bool DoGetNextXY(
double *x,
double *y);
1409 void SetViewMode(
bool asBar);
1430 wxCoord maxDrawX, minDrawX, maxDrawY, minDrawY;
1433 double m_deltaX, m_deltaY;
1439 bool m_ViewAsBar =
false;
1442 bool m_CanDelete =
true;
1448 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1454 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1456 wxDECLARE_DYNAMIC_CLASS(
mpFXY);
1488 mpFXYVector(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
bool useY2Axis =
false);
1501 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
1524 bool AddData(
const double x,
const double y,
bool updatePlot);
1533 m_reserveXY = reserve;
1534 m_xs.reserve(m_reserveXY);
1535 m_ys.reserve(m_reserveXY);
1560 double m_minX, m_maxX, m_minY, m_maxY, m_lastX, m_lastY;
1575 virtual bool GetNextXY(
double *x,
double *y);
1579 void DrawAddedPoint(
double x,
double y);
1612 void First_Point(
double x,
double y);
1616 void Check_Limit(
double val,
double *min,
double *max,
double *last,
double *delta);
1635 mpProfile(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP);
1642 virtual double GetY(
double x) = 0;
1650 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1664 mpChart(
const wxString &name = wxEmptyString);
1674 void SetChartValues(
const std::vector<double> &data);
1678 void SetChartLabels(
const std::vector<std::string> &labelArray);
1684 void AddData(
const double &data,
const std::string &label);
1689 virtual void Clear();
1693 return (values.size() > 0);
1697 std::vector<double> values;
1698 std::vector<std::string> labels;
1701 double m_total_value;
1703 wxDECLARE_DYNAMIC_CLASS(
mpChart);
1710 #define mpBAR_NONE 0 1711 #define mpBAR_AXIS_H 1 1712 #define mpBAR_AXIS_V 2 1713 #define mpBAR_INSIDE 3 1722 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
1730 void SetBarColour(
const wxColour &colour);
1732 void SetColumnWidth(
const double colWidth)
1738 void SetBarLabelPosition(
int position);
1743 virtual double GetMinX();
1748 virtual double GetMaxX();
1753 virtual double GetMinY();
1758 virtual double GetMaxY();
1763 wxColour m_barColour;
1765 double m_labelAngle;
1771 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1784 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
1796 void SetPieColours(
const std::vector<wxColour> &colourArray);
1833 std::vector<wxColour> colours;
1839 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1841 const wxColour& GetColour(
unsigned int id);
1864 mpScale(
const wxString &name,
int flags,
bool grids);
1906 m_labelFormat = format;
1913 return m_labelFormat;
1937 m_auto = automaticScalingIsEnabled;
1948 void SetMinScale(
double min)
1953 double GetMinScale()
const 1958 void SetMaxScale(
double max)
1963 double GetMaxScale()
const 1968 virtual bool IsLogAxis() = 0;
1969 virtual void SetLogAxis(
bool log) = 0;
1979 virtual int GetOrigin(
mpWindow &w) = 0;
1980 double GetStep(
double scale);
1981 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
1983 wxString FormatLogValue(
double n);
1985 wxDECLARE_DYNAMIC_CLASS(
mpScale);
1989 #define mpX_NORMAL 0x00 1992 #define mpX_TIME 0x01 1994 #define mpX_HOURS 0x02 1996 #define mpX_DATE 0x03 1998 #define mpX_DATETIME 0x04 2000 #define mpX_USER 0x05 2002 #define mpX_NONE 0x06 2017 mpScaleX(
const wxString &name = _T(
"X"),
int flags = mpALIGN_CENTERX,
bool grids =
false,
unsigned int type =
mpX_NORMAL) :
2020 m_subtype = mpsScaleX;
2022 m_timeConv = mpX_RAWTIME;
2043 m_timeConv = time_conv;
2049 virtual bool IsLogAxis();
2050 virtual void SetLogAxis(
bool log);
2058 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2060 virtual int GetOrigin(
mpWindow &w);
2061 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2062 wxString FormatValue(
const wxString &fmt,
double n);
2081 mpScaleY(
const wxString &name = _T(
"Y"),
int flags = mpALIGN_CENTERY,
bool grids =
false,
bool Y2Axis =
false) :
2084 m_subtype = mpsScaleY;
2085 m_isY2Axis = Y2Axis;
2091 virtual bool IsLogAxis();
2092 virtual void SetLogAxis(
bool log);
2094 virtual bool IsY2Axis()
2098 virtual void SetY2Axis(
bool y2Axis);
2105 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2107 virtual int GetOrigin(
mpWindow &w);
2108 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2121 #define mpMOUSEMODE_DRAG 0 2123 #define mpMOUSEMODE_ZOOMBOX 1 2136 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)>
mpOnDeleteLayer;
2155 m_rightClick =
false;
2156 m_IsWasDrawn =
false;
2162 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2164 m_domain = wxRect(left, top, width, height);
2165 m_plot_size = wxRect(left, top, width + left, height + top);
2167 void UpdateBox(
const wxRect &size)
2170 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2171 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2173 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2174 void ClearPlot(wxClientDC &dc);
2175 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2176 void SaveDrawState(
void)
2178 m_IsWasDrawn = m_IsDrawn;
2183 void SetRightClick(
void)
2185 m_rightClick =
true;
2191 wxPoint m_mousePosition;
2195 void DrawCross(wxClientDC &dc)
const;
2227 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2247 bool AddLayer(
mpLayer *layer,
bool refreshDisplay =
true);
2258 bool DelLayer(
mpLayer *layer,
bool alsoDeleteObject,
bool refreshDisplay =
true);
2264 void DelAllLayers(
bool alsoDeleteObject,
bool refreshDisplay =
true);
2271 void DelAllPlot(
bool alsoDeleteObject, mpFunctionType func = mpfAllType,
bool refreshDisplay =
true);
2278 mpLayer* GetLayer(
int position);
2286 mpLayer* GetLayersType(
int position, mpLayerType type);
2293 mpLayer* GetLayerPlot(
int position, mpFunctionType func = mpfAllType);
2297 mpLayer* GetLayerAxis(
int position, mpScaleType scale = mpsAllType);
2303 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
2308 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear,
bool *isY2Axis);
2314 mpLayer* GetLayerByName(
const wxString &name);
2320 mpLayer* GetLayerByClassName(
const wxString &name);
2325 void RefreshLegend(
void);
2347 if (ISNOTNULL(scaleX))
2366 if (ISNOTNULL(scaleY))
2383 [[deprecated(
"Incomplete, use UpdateBBox instead")]]
2415 void SetPosY(
const double posY,
const double posY2)
2443 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
2444 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
2446 m_plotBoundaries.endPx = m_scrX;
2447 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
2448 m_plotBoundaries.endPy = m_scrY;
2449 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
2451 m_PlotArea = wxRect(m_margin.left - EXTRA_MARGIN, m_margin.top - EXTRA_MARGIN,
2452 m_plotWidth + 2*EXTRA_MARGIN, m_plotHeight + 2*EXTRA_MARGIN);
2454 m_magnet.UpdateBox(m_PlotArea);
2483 void SetPos(
const double posX,
const double posY,
const double posY2)
2494 inline double p2x(
const wxCoord pixelCoordX)
const 2496 return m_posX + pixelCoordX / m_scaleX;
2502 inline double p2y(
const wxCoord pixelCoordY,
bool Y2 =
false)
const 2505 return m_posY2 - pixelCoordY / m_scaleY2;
2507 return m_posY - pixelCoordY / m_scaleY;
2513 inline wxCoord
x2p(
const double x)
const 2515 return (wxCoord)((x - m_posX) * m_scaleX);
2521 inline wxCoord
y2p(
const double y,
bool Y2 =
false)
const 2524 return (wxCoord)((m_posY2 - y) * m_scaleY2);
2526 return (wxCoord)((m_posY - y) * m_scaleY);
2533 m_enableDoubleBuffer = enabled;
2540 m_enableMouseNavigation = enabled;
2548 void LockAspect(
bool enable =
true);
2556 return m_lockaspect;
2565 return m_repainting;
2580 void Fit(
const mpFloatRect &rect, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
2586 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
2592 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
2607 void ZoomRect(wxPoint p0, wxPoint p1);
2617 unsigned int CountLayers();
2623 return (
unsigned int)m_layers.size();
2629 unsigned int CountLayersType(mpLayerType type);
2630 unsigned int CountLayersFXYPlot();
2645 return m_desired.Xmin;
2654 return m_desired.Xmax;
2663 return m_desired.Ymin;
2672 return m_desired.Ymax;
2677 void GetBoundingBox(
double *bbox)
const;
2685 void SetMPScrollbars(
bool status);
2691 return m_enableScrollBars;
2699 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
2704 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2709 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2715 bool LoadFile(
const wxString &filename);
2727 void SetMargins(
int top,
int right,
int bottom,
int left);
2732 SetMargins(top, m_margin.right, m_margin.bottom, m_margin.left);
2738 return m_margin.top;
2744 SetMargins(m_margin.top, right, m_margin.bottom, m_margin.left);
2750 return m_margin.right;
2756 SetMargins(m_margin.top, m_margin.right, bottom, m_margin.left);
2762 return m_margin.bottom;
2768 SetMargins(m_margin.top, m_margin.right, m_margin.bottom, left);
2774 return m_margin.left;
2786 return m_plotHeight;
2794 bond = m_plotBoundariesMargin;
2796 bond = m_plotBoundaries;
2797 bond.startPx -= EXTRA_MARGIN;
2798 bond.endPx += EXTRA_MARGIN;
2799 bond.startPy -= EXTRA_MARGIN;
2800 bond.endPy += EXTRA_MARGIN;
2807 m_drawBox = drawbox;
2819 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
2824 void SetLayerVisible(
const wxString &name,
bool viewable);
2829 bool IsLayerVisible(
const wxString &name);
2834 bool IsLayerVisible(
const unsigned int position);
2839 void SetLayerVisible(
const unsigned int position,
bool viewable);
2845 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
2854 const wxColour& GetbgColour()
const 2859 void SetbgColour(
const wxColour &colour)
2861 m_bgColour = colour;
2870 m_OnDeleteLayer = event;
2876 m_OnDeleteLayer = NULL;
2885 m_OnUserMouseAction = userMouseEventHandler;
2891 m_OnUserMouseAction = NULL;
2904 bool IsLogYaxis()
const 2909 void SetLogXaxis(
bool log)
2914 void SetLogYaxis(
bool log)
2919 bool GetMagnetize()
const 2924 void SetMagnetize(
bool mag)
2929 #ifdef ENABLE_MP_CONFIG 2930 void RefreshConfigWindow();
2936 #endif // ENABLE_MP_CONFIG 2938 void Update_CountY2Axis(
bool Y2Axis);
2940 bool Y2AxisExist(
void)
const 2942 return m_countY2Axis > 0;
2946 virtual void OnPaint(wxPaintEvent &event);
2947 virtual void OnSize(wxSizeEvent &event);
2948 virtual void OnShowPopupMenu(wxMouseEvent &event);
2949 virtual void OnCenter(wxCommandEvent &event);
2950 virtual void OnFit(wxCommandEvent &event);
2951 virtual void OnToggleGrids(wxCommandEvent &event);
2952 virtual void OnToggleCoords(wxCommandEvent &event);
2953 virtual void OnScreenShot(wxCommandEvent &event);
2954 virtual void OnFullScreen(wxCommandEvent &event);
2955 #ifdef ENABLE_MP_CONFIG 2956 virtual void OnConfiguration(wxCommandEvent &event);
2957 #endif // ENABLE_MP_CONFIG 2958 virtual void OnLoadFile(wxCommandEvent &event);
2959 virtual void OnZoomIn(wxCommandEvent &event);
2960 virtual void OnZoomOut(wxCommandEvent &event);
2961 virtual void OnLockAspect(wxCommandEvent &event);
2962 virtual void OnMouseHelp(wxCommandEvent &event);
2963 virtual void OnMouseLeftDown(wxMouseEvent &event);
2964 virtual void OnMouseRightDown(wxMouseEvent &event);
2965 virtual void OnMouseMove(wxMouseEvent &event);
2966 virtual void OnMouseLeftRelease(wxMouseEvent &event);
2967 virtual void OnMouseWheel(wxMouseEvent &event);
2968 virtual void OnMouseLeave(wxMouseEvent &event);
2969 bool CheckUserMouseAction(wxMouseEvent &event);
2970 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
2971 virtual void OnScrollPageUp(wxScrollWinEvent &event);
2972 virtual void OnScrollPageDown(wxScrollWinEvent &event);
2973 virtual void OnScrollLineUp(wxScrollWinEvent &event);
2974 virtual void OnScrollLineDown(wxScrollWinEvent &event);
2975 virtual void OnScrollTop(wxScrollWinEvent &event);
2976 virtual void OnScrollBottom(wxScrollWinEvent &event);
2978 void DoScrollCalc(
const int position,
const int orientation);
2980 void DoZoomInXCalc(
const int staticXpixel);
2981 void DoZoomInYCalc(
const int staticYpixel);
2982 void DoZoomOutXCalc(
const int staticXpixel);
2983 void DoZoomOutYCalc(
const int staticYpixel);
2985 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
2989 virtual bool UpdateBBox();
2991 void InitParameters();
2993 wxTopLevelWindow* m_parent;
3038 bool m_mouseMovedAfterRightClick;
3041 bool m_enableScrollBars;
3042 int m_scrollX, m_scrollY;
3046 bool m_InInfoLegend;
3050 wxRect m_zoom_oldDim;
3055 bool m_LogXaxis =
false;
3056 bool m_LogYaxis =
false;
3060 #ifdef ENABLE_MP_CONFIG 3062 #endif // ENABLE_MP_CONFIG 3064 mpOnDeleteLayer m_OnDeleteLayer = NULL;
3065 mpOnUserMouseAction m_OnUserMouseAction = NULL;
3073 int m_countY2Axis = 0;
3074 void FillI18NString();
3077 void CheckAndReportDesiredBoundsChanges();
3078 bool m_initialDesiredBoundsRecorded =
false;
3082 wxDECLARE_EVENT_TABLE();
3106 m_subtype = mptText;
3110 m_location = mpMarginNone;
3117 mpText(
const wxString &name,
int offsetx,
int offsety);
3122 mpText(
const wxString &name, mpLocation marginLocation);
3135 m_location = location;
3164 mpLocation m_location;
3168 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3170 wxDECLARE_DYNAMIC_CLASS(
mpText);
3186 mpText(name, mpMarginTopCenter)
3188 m_subtype = mptTitle;
3189 SetPen(*wxWHITE_PEN);
3190 SetBrush(*wxWHITE_BRUSH);
3195 wxDECLARE_DYNAMIC_CLASS(
mpTitle);
3216 mpPrintout(
mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
3222 void SetDrawState(
bool drawState)
3227 bool OnPrintPage(
int page);
3228 bool HasPage(
int page);
3234 stretch_factor = factor;
3263 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
3266 m_subtype = mpfMovable;
3267 m_bbox_min_x = m_bbox_max_x = 0;
3268 m_bbox_min_y = m_bbox_max_y = 0;
3279 phi = m_reference_phi;
3288 m_reference_phi = phi;
3289 m_flags = mpALIGN_NE;
3295 return m_trans_shape_xs.size() != 0;
3302 return m_bbox_min_x;
3309 return m_bbox_max_x;
3316 return m_bbox_min_y;
3323 return m_bbox_max_y;
3332 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3336 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
3355 void ShapeUpdated();
3380 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
3382 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
3384 m_continuous =
true;
3394 double GetQuantiles()
const 3407 void SetSegments(
int segments)
3409 m_segments = segments;
3412 int GetSegments()
const 3448 void RecalculateShape();
3467 m_continuous =
true;
3481 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
3502 m_min_x = m_max_x = 0;
3503 m_min_y = m_max_y = 0;
3505 m_bitmapChanged =
false;
3506 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
3516 void GetBitmapCopy(wxImage &outBmp)
const;
3525 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
3560 wxBitmap m_scaledBitmap;
3561 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
3563 bool m_bitmapChanged;
3569 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3577 typedef enum __mp_Colour
3602 this->Set(0, 0, 255);
3605 this->Set(255, 0, 0);
3608 this->Set(0, 128, 0);
3611 this->Set(128, 0, 128);
3614 this->Set(255, 255, 0);
3617 this->Set(255, 0, 255);
3620 this->Set(0, 255, 0);
3623 this->Set(0, 255, 255);
3626 this->Set(128, 128, 0);
3629 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
3630 (ChannelType)((rand() * 255) / RAND_MAX));
3638 #ifdef ENABLE_MP_NAMESPACE 3641 #endif // ENABLE_MP_NAMESPACE 3643 #endif // _MP_MATHPLOT_H_ int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:480
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2025
enum MathPlot::__Info_Type mpInfoType
sub_type values for mpLAYER_INFO
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:3559
mpFloatRect Get_Bound(void) const
Get bounding box encompassing all visible plots on this mpWindow.
Definition: mathplot.h:2389
double m_minX
Loaded at SetData.
Definition: mathplot.h:1560
wxMenu m_popmenu
Canvas' context menu.
Definition: mathplot.h:3001
unsigned int GetLabelMode() const
Get X axis label view mode.
Definition: mathplot.h:2033
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:3206
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1184
Abstract class providing an vertical line.
Definition: mathplot.h:1261
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:3284
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:1977
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1629
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:2521
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:3006
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:2996
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:886
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:3495
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:2463
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:3419
bool GetCanDelete(void) const
Get CanDelete for plot.
Definition: mathplot.h:738
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:3070
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:2563
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:759
mpTitle(const wxString &name)
Definition: mathplot.h:3185
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:591
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1135
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:1531
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:961
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:765
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:3052
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:3380
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:3133
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition: mathplot.h:2128
Plot layer, abstract base class.
Definition: mathplot.h:433
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:3005
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:2719
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:472
double m_scaleX
Current view's X scale.
Definition: mathplot.h:3009
int GetMarginRight() const
Get the right margin.
Definition: mathplot.h:2748
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:3104
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3529
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:3058
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:3465
Layer for pie chart.
Definition: mathplot.h:1780
~mpChart()
Destructor.
Definition: mathplot.h:1667
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1031
unsigned int m_labelType
Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
Definition: mathplot.h:2053
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:2474
Load a file.
Definition: mathplot.h:266
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:1935
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:752
mpFloatRect m_bound
Global layer bounding box in user coordinates. Does NOT include borders.
Definition: mathplot.h:3008
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:1540
int GetMarginLeft() const
Get the left margin.
Definition: mathplot.h:2772
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:1556
const wxString & GetLabelFormat() const
Get axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1911
void SetY2Axis(bool _useY2)
Set use of second Y axis.
Definition: mathplot.h:1170
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:631
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:1825
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1247
wxRect m_PlotArea
The full size of the plot with EXTRA_MARGIN.
Definition: mathplot.h:3031
__Info_Type
sub_type values for mpLAYER_INFO
Definition: mathplot.h:346
double m_bbox_min_x
The precomputed bounding box:
Definition: mathplot.h:3350
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1202
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:893
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:3039
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:2652
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:623
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:3053
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1186
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:615
Class for drawing mouse magnetization.
Definition: mathplot.h:2149
bool operator==(const mpFloatRect &rect) const
Equal operator.
Definition: mathplot.h:240
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:2356
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:1857
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:2689
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:583
Copy a screen shot to the clipboard.
Definition: mathplot.h:262
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:2778
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:2554
int GetMarginBottom() const
Get the bottom margin.
Definition: mathplot.h:2760
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:3035
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:879
mpInfoLegend * m_InfoLegend
pointer to the optional info legend layer
Definition: mathplot.h:3045
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:946
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:2730
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:2643
wxString m_name
Layer's name.
Definition: mathplot.h:758
Plot layer implementing a simple title.
Definition: mathplot.h:3176
abstract Layer for chart (bar and pie).
Definition: mathplot.h:1660
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1380
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:1876
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:954
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:757
double GetPosY(bool Y2=false) const
Get current view's Y position.
Definition: mathplot.h:2426
virtual bool IsLayerType(mpLayerType type, int *sub_type)
Specifies that if the layer is of type "type".
Definition: mathplot.h:491
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:892
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:2874
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1128
bool ViewAsBar(void) const
return true if XY series is plotted with bar
Definition: mathplot.h:1422
enum MathPlot::__XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
Info box type layer.
Definition: mathplot.h:418
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:3040
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:2407
legend components follow each other horizontally on a single line
Definition: mathplot.h:327
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:2621
void SetValue(const double value)
Set x or y.
Definition: mathplot.h:1218
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
Definition: mathplot.h:411
virtual void DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:781
int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:3163
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:1890
Layer for bar chart.
Definition: mathplot.h:1718
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1869
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1114
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:3439
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1691
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:3002
Axis type layer.
Definition: mathplot.h:414
__mp_Direction_Type
Direction for the Legend layer.
Definition: mathplot.h:324
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3321
Bitmap type layer.
Definition: mathplot.h:413
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition: mathplot.h:307
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:3444
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1142
Abstract class providing an horizontal line.
Definition: mathplot.h:1239
Bitmap type layer.
Definition: mathplot.h:401
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:3027
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:1974
wxColour m_fontcolour
Layer's font foreground colour.
Definition: mathplot.h:755
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:761
__mp_Location_Type
Location for the Info layer.
Definition: mathplot.h:272
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:3018
void SetFactor(int factor)
Definition: mathplot.h:3232
Show legend items with small square with the same color of referred mpLayer.
Definition: mathplot.h:319
double m_scaleY
Current view's Y scale.
Definition: mathplot.h:3010
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:167
#define mpX_NORMAL
Set label for X axis in normal mode.
Definition: mathplot.h:1989
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1388
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:916
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:1943
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:1883
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1096
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:2531
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:648
__XAxis_Align_Type
Alignment for X axis.
Definition: mathplot.h:287
mpInfoCoords * m_InfoCoords
pointer to the optional info coords layer
Definition: mathplot.h:3044
double m_posY2
Current view's Y2 position.
Definition: mathplot.h:3014
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:766
Axis type layer.
Definition: mathplot.h:397
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
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:3594
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:2502
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3300
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:655
Definition: MathPlotConfig.h:46
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:762
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
Full constructor.
Definition: mathplot.h:2017
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:3026
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:764
~mpPieChart()
Destructor.
Definition: mathplot.h:1787
int m_winY
Holds the mpWindow size. Used to rescale position when window is resized.
Definition: mathplot.h:896
mpFloatRect GetDesiredBoundingBox() const
Draws the mpWindow on a page for printing.
Definition: mathplot.h:2638
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:3147
mpScaleY * m_YAxis
Pointer to the optional Y axis layer of this mpWindow.
Definition: mathplot.h:2998
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1187
Show/Hide grids.
Definition: mathplot.h:260
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1185
#define mpX_USER
Set label user defined.
Definition: mathplot.h:2000
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:575
enum MathPlot::__mp_Direction_Type mpLegendDirection
Direction for the Legend layer.
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:717
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:751
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1324
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:1552
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1121
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2219
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1492
Text box type layer.
Definition: mathplot.h:400
bool IsNotSet() const
Is mpFloatRect set ?
Definition: mathplot.h:233
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:2670
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:3004
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1106
mpScaleY * m_Y2Axis
Pointer to the optional Y2 axis layer of this mpWindow.
Definition: mathplot.h:2999
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:2811
mpRect m_margin
Margin around the plot. Default 50.
Definition: mathplot.h:3025
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1188
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:689
Lock x/y scaling aspect.
Definition: mathplot.h:259
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:932
Show legend items with symbol used with the referred mpLayer.
Definition: mathplot.h:320
Info box type layer.
Definition: mathplot.h:399
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:2483
enum MathPlot::__mp_Layer_ZOrder mpLayerZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:1597
Text box type layer.
Definition: mathplot.h:419
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition: mathplot.h:3015
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:834
double m_posX
Current view's X position.
Definition: mathplot.h:3012
Center view on click position.
Definition: mathplot.h:258
Show/Hide info coord.
Definition: mathplot.h:261
enum MathPlot::__Text_Type mpTextType
sub_type values for mpLAYER_TEXT
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:865
double m_scaleY2
Current view's Y2 scale.
Definition: mathplot.h:3011
Toggle fullscreen only if parent is a frame windows.
Definition: mathplot.h:268
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:1512
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:1590
void UpdateBoundingBoxToInclude(double x, double y, double y2=0)
Update bounding box to include this point.
Definition: mathplot.h:218
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:1919
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:3460
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:2790
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1000
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:1604
double m_max
Min and max axis values when autosize is false.
Definition: mathplot.h:1976
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:3029
int m_flags
Holds label alignment. Default : mpALIGN_NE.
Definition: mathplot.h:763
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:1809
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:508
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2009
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:2742
wxFont m_font
Layer's font.
Definition: mathplot.h:754
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:3003
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1269
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:872
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:607
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:2849
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:895
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:2883
Abstract class providing a line.
Definition: mathplot.h:1196
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:1018
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:753
bool PointIsInside(double x, double y) const
Is point inside this bounding box (ignoring Y2)?
Definition: mathplot.h:212
void SetPosY(const double posY, const double posY2)
Set current view's Y position and refresh display.
Definition: mathplot.h:2415
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:724
bool IsHorizontal(void) const
Get if is horizontal line.
Definition: mathplot.h:1225
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:676
int m_last_ly
For double buffering.
Definition: mathplot.h:3034
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:807
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:760
bool m_UseY2Axis
Use Y2 axis. This second axis must exist.
Definition: mathplot.h:1189
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3314
__mp_Style_Type
Style for the Legend layer.
Definition: mathplot.h:316
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1157
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1149
Show legend items with line with the same pen of referred mpLayer.
Definition: mathplot.h:318
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
Definition: mathplot.h:3340
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:858
Shows information about the mouse commands.
Definition: mathplot.h:267
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:3374
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:710
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:2784
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:1817
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:3330
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:3275
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:3043
Fit view to match bounding box of all layers.
Definition: mathplot.h:255
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:669
bool GetY2Axis() const
Is second Y axis selected for this layer?
Definition: mathplot.h:1178
Line (horizontal or vertical) type layer.
Definition: mathplot.h:415
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:2439
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:1973
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:524
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:979
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1287
bool IsLogXaxis() const
Log axis control.
Definition: mathplot.h:2899
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:445
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:3036
void SetCanDelete(bool canDelete)
Set CanDelete for plot.
Definition: mathplot.h:731
enum MathPlot::__mp_Location_Type mpLocation
Location for the Info layer.
__YAxis_Align_Type
Alignment for Y axis.
Definition: mathplot.h:297
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1482
void InitializeBoundingBox(double x, double y, double y2=0)
Initialize bounding box with an initial point.
Definition: mathplot.h:227
Zoom into view at clickposition / window center.
Definition: mathplot.h:256
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:973
Zoom out.
Definition: mathplot.h:257
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1364
Plot type layer.
Definition: mathplot.h:398
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see above)...
Definition: mathplot.h:3401
double GetScaleY(bool Y2=false) const
Get current view's Y scale.
Definition: mathplot.h:2375
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2235
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:638
double GetValue() const
Set x or y.
Definition: mathplot.h:1210
mpFloatRect m_desired
These are updated in Fit() only (also Zoom) May be different from the real borders (layer coordinates...
Definition: mathplot.h:3023
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3307
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:1975
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:897
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:2868
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:1583
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:2494
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:1927
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:2538
Layer type undefined; SHOULD NOT BE USED.
Definition: mathplot.h:396
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:2754
int m_scrY
Current view's Y dimension.
Definition: mathplot.h:3016
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:1801
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:3428
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:2766
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:703
__Text_Type
sub_type values for mpLAYER_TEXT
Definition: mathplot.h:355
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:2397
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:2040
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:516
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:3030
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:894
__mp_Layer_Type
Definition: mathplot.h:394
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:3162
each visible plot is described on its own line, one above the other
Definition: mathplot.h:326
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:500
Just the end of ZOrder.
Definition: mathplot.h:420
Definition: mathplot.h:98
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2073
~mpBarChart()
Destructor.
Definition: mathplot.h:1725
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:1548
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:2661
wxPen m_gridpen
Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition: mathplot.h:1972
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:2136
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:2889
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:756
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3550
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:3140
enum MathPlot::__mp_Style_Type mpLegendStyle
Style for the Legend layer.
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:2513
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2054
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:3293
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:1565
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:3345
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:2144
Chart type layer (bar chart)
Definition: mathplot.h:403
double m_min_x
The shape of the bitmap:
Definition: mathplot.h:3567
int GetMarginTop() const
Get the top margin.
Definition: mathplot.h:2736
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:3155
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:745
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, bool Y2Axis=false)
Full constructor.
Definition: mathplot.h:2081
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1014
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:457
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:1897
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:599
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:3017
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:2345
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3543
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:3257
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:2805
enum MathPlot::__Plot_Align_Name_Type mpPlot_Align
Plot alignment (which corner should plot be placed)
Configuration.
Definition: mathplot.h:264
enum MathPlot::__YAxis_Align_Type mpYAxis_Align
Alignment for Y axis.
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3536
Line (horizontal or vertical) type layer.
Definition: mathplot.h:402
void SetScaleY(const double scaleY)
Set current view's Y scale and refresh display.
Definition: mathplot.h:2364
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:3500
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:696
mpScaleX * m_XAxis
Pointer to the optional X axis layer of this mpWindow.
Definition: mathplot.h:2997
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:1904
Plot (function) type layer.
Definition: mathplot.h:416
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:662
Plot layer implementing a text string.
Definition: mathplot.h:3099
int GetBarWidth(void) const
return the width of the bar
Definition: mathplot.h:1414
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:3262
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:3126
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:3048
Chart type layer.
Definition: mathplot.h:417
double m_posY
Current view's Y position.
Definition: mathplot.h:3013
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:3037