14 #ifndef MATHPLOT_H_INCLUDED 15 #define MATHPLOT_H_INCLUDED 17 #define MATHPLOT_MANY_YAXIS 61 #ifdef mathplot_EXPORTS 62 #define WXDLLIMPEXP_MATHPLOT WXEXPORT 63 #define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type 64 #else // not making DLL 65 #define WXDLLIMPEXP_MATHPLOT 66 #define WXDLLIMPEXP_DATA_MATHPLOT(type) type 69 #if defined(__GNUG__) && !defined(__APPLE__) && !defined(__INTEL_CLANG_COMPILER) 70 #pragma interface "mathplot.h" 79 #include <wx/scrolwin.h> 81 #include <wx/dynarray.h> 83 #include <wx/dcmemory.h> 84 #include <wx/string.h> 94 #ifdef ENABLE_MP_CONFIG 95 #include "MathPlotConfig.h" 96 #endif // ENABLE_MP_CONFIG 103 #ifdef ENABLE_MP_NAMESPACE 105 #endif // ENABLE_MP_NAMESPACE 107 #ifdef ENABLE_MP_DEBUG 112 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) 114 #define DEBUG_NEW new 117 #endif // ENABLE_MP_DEBUG 120 #define X_BORDER_SEPARATION 40 121 #define Y_BORDER_SEPARATION 60 124 #define mpX_LOCALTIME 0x10 126 #define mpX_UTCTIME 0x20 127 #define mpX_RAWTIME mpX_UTCTIME 131 #define ISNOTNULL(x) (fabs(x) > EPSILON) 134 #define EXTRA_MARGIN 8 136 #define ZOOM_AROUND_CENTER -1 142 class WXDLLIMPEXP_MATHPLOT
mpLayer;
144 class WXDLLIMPEXP_MATHPLOT
mpLine;
147 class WXDLLIMPEXP_MATHPLOT
mpFX;
148 class WXDLLIMPEXP_MATHPLOT
mpFY;
149 class WXDLLIMPEXP_MATHPLOT
mpFXY;
152 class WXDLLIMPEXP_MATHPLOT
mpChart;
154 class WXDLLIMPEXP_MATHPLOT
mpScale;
155 class WXDLLIMPEXP_MATHPLOT
mpScaleX;
156 class WXDLLIMPEXP_MATHPLOT
mpScaleY;
160 class WXDLLIMPEXP_MATHPLOT
mpWindow;
161 class WXDLLIMPEXP_MATHPLOT
mpText;
162 class WXDLLIMPEXP_MATHPLOT
mpTitle;
169 #ifdef ENABLE_MP_CONFIG 171 #endif // ENABLE_MP_CONFIG 210 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer 211 bool operator==(
const mpRange&)
const =
default;
213 bool operator==(
const mpRange& other)
const 215 return min == other.min && max == other.max;
228 std::vector<mpRange> y;
243 if(yIndex < y.size())
245 if( (px < x.min || px > x.max) ||
246 (py < y[yIndex].min || py > y[yIndex].max))
260 assert(yIndex < y.size());
261 if(yIndex < y.size())
263 if (px < x.min ) x.min = px;
264 else if (px > x.max ) x.max = px;
265 if (py < y[yIndex].min ) y[yIndex].min = py;
266 else if (py > y[yIndex].max ) y[yIndex].max = py;
271 assert(yIndex < y.size());
272 if(yIndex < y.size())
275 y[yIndex].min = y[yIndex].max = py;
281 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions> 282 bool operator==(
const mpFloatRect&)
const =
default;
288 auto Same = [](
double a,
double b) {
289 return std::fabs(a - b) < EPSILON;
293 if (!Same(x.min, rect.x.min) || !Same(x.max, rect.x.max))
299 if (y.size() != rect.y.size())
305 for (
size_t i = 0; i < y.size(); ++i)
307 if (!Same(y[i].min, rect.y[i].min) ||
308 !Same(y[i].max, rect.y[i].max) )
332 #ifdef ENABLE_MP_CONFIG 334 #endif // ENABLE_MP_CONFIG 341 typedef enum __mp_Location_Type
349 mpMarginBottomCenter,
356 typedef enum __XAxis_Align_Type
358 mpALIGN_BORDER_BOTTOM = 10,
366 typedef enum __YAxis_Align_Type
368 mpALIGN_BORDER_LEFT = 20,
376 typedef enum __Plot_Align_Name_Type
385 typedef enum __mp_Style_Type
393 typedef enum __mp_Direction_Type
399 typedef enum __Symbol_Type
415 typedef enum __Info_Type
424 typedef enum __Text_Type
431 typedef enum __Function_Type
443 typedef enum __Scale_Type
451 typedef enum __Chart_Type
459 enum mpMouseButtonAction
469 typedef enum __mp_Layer_Type
486 typedef enum __mp_Layer_ZOrder
508 class WXDLLIMPEXP_MATHPLOT
mpLayer:
public wxObject
511 mpLayer(mpLayerType layerType);
559 virtual bool IsLayerType(mpLayerType typeOfInterest,
int *subtype)
561 *subtype = m_subtype;
562 return (m_type == typeOfInterest);
677 m_fontcolour = colour;
708 if (brush == wxNullBrush)
709 m_brush = *wxTRANSPARENT_BRUSH;
739 m_drawOutsideMargins = drawModeOutside;
746 return m_drawOutsideMargins;
753 wxBitmap GetColourSquare(
int side = 16);
801 m_CanDelete = canDelete;
838 void UpdateContext(wxDC &dc)
const;
844 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
857 void CheckLog(
double *x,
double *y,
size_t id = 0);
863 wxDECLARE_DYNAMIC_CLASS(
mpLayer);
885 mpInfoLayer(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
892 virtual void SetVisible(
bool show);
898 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
910 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
915 virtual bool Inside(
const wxPoint &point);
919 virtual void Move(wxPoint delta);
922 virtual void UpdateReference();
928 return m_dim.GetPosition();
935 return m_dim.GetSize();
949 m_location = location;
971 virtual void DoPlot(wxDC &dc,
mpWindow &w);
975 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
997 mpInfoCoords(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
1008 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
1010 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
1017 m_timeConv = time_conv;
1024 m_series_coord = show;
1031 return m_series_coord;
1039 virtual wxString GetInfoCoordsText(
mpWindow &w,
double xVal, std::vector<double> yValList);
1050 unsigned int m_labelType;
1051 unsigned int m_timeConv;
1054 bool m_series_coord;
1061 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1081 mpInfoLegend(wxRect rect,
const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1091 m_needs_update =
true;
1094 mpLegendStyle GetItemMode()
const 1103 m_item_direction = mode;
1104 m_needs_update =
true;
1107 mpLegendDirection GetItemDirection()
const 1109 return m_item_direction;
1112 void SetNeedUpdate()
1114 m_needs_update =
true;
1118 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1121 mpLegendStyle m_item_mode;
1122 mpLegendDirection m_item_direction;
1128 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1134 unsigned int layerIdx;
1138 std::vector<LegendDetail> m_LegendDetailList;
1139 bool m_needs_update;
1150 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1171 mpFunction(mpLayerType layerType = mpLAYER_PLOT,
const wxString &name = wxEmptyString,
size_t yAxisIndex = 0);
1178 m_continuous = continuity;
1186 return m_continuous;
1221 m_symbolSize = size;
1222 m_symbolSize2 = size / 2;
1229 return m_symbolSize;
1235 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1242 return m_yAxisIndex;
1250 m_yAxisIndex = index;
1269 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1297 return m_IsHorizontal;
1302 bool m_IsHorizontal;
1304 wxDECLARE_DYNAMIC_CLASS(
mpLine);
1312 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN,
size_t yAxisIndex = 0);
1324 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1346 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1363 mpFX(
const wxString &name = wxEmptyString,
int flags = mpALIGN_RIGHT,
size_t yAxisIndex = 0);
1370 virtual double GetY(
double x) = 0;
1376 double DoGetY(
double x);
1382 void DefineDoGetY(
void);
1387 double (
mpFX::*pDoGetY)(
double x);
1393 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1398 double NormalDoGetY(
double x);
1399 double LogDoGetY(
double x);
1401 wxDECLARE_DYNAMIC_CLASS(
mpFX);
1416 mpFY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP,
size_t yAxisIndex = 0);
1423 virtual double GetX(
double y) = 0;
1429 double DoGetX(
double y);
1435 void DefineDoGetX(
void);
1440 double (
mpFY::*pDoGetX)(
double y);
1446 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1451 double NormalDoGetX(
double y);
1452 double LogDoGetX(
double y);
1454 wxDECLARE_DYNAMIC_CLASS(
mpFY);
1472 mpFXY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
size_t yAxisIndex = 0);
1477 virtual void Rewind() = 0;
1501 virtual bool GetNextXY(
double *x,
double *y) = 0;
1506 bool DoGetNextXY(
double *x,
double *y);
1511 void SetViewMode(
bool asBar);
1532 wxCoord maxDrawX, minDrawX, maxDrawY, minDrawY;
1535 double m_deltaX, m_deltaY;
1541 bool m_ViewAsBar =
false;
1544 bool m_CanDelete =
true;
1550 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1556 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1558 wxDECLARE_DYNAMIC_CLASS(
mpFXY);
1590 mpFXYVector(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
size_t yAxisIndex = 0);
1603 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
1626 bool AddData(
const double x,
const double y,
bool updatePlot);
1635 m_reserveXY = reserve;
1636 m_xs.reserve(m_reserveXY);
1637 m_ys.reserve(m_reserveXY);
1662 double m_minX, m_maxX, m_minY, m_maxY, m_lastX, m_lastY;
1677 virtual bool GetNextXY(
double *x,
double *y);
1681 void DrawAddedPoint(
double x,
double y);
1690 return m_minX - (m_deltaX / 2);
1712 return m_maxX + (m_deltaX / 2);
1730 void First_Point(
double x,
double y);
1734 void Check_Limit(
double val,
double *min,
double *max,
double *last,
double *delta);
1753 mpProfile(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP);
1760 virtual double GetY(
double x) = 0;
1768 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1782 mpChart(
const wxString &name = wxEmptyString);
1792 void SetChartValues(
const std::vector<double> &data);
1796 void SetChartLabels(
const std::vector<std::string> &labelArray);
1802 void AddData(
const double &data,
const std::string &label);
1807 virtual void Clear();
1811 return (values.size() > 0);
1815 std::vector<double> values;
1816 std::vector<std::string> labels;
1819 double m_total_value;
1821 wxDECLARE_DYNAMIC_CLASS(
mpChart);
1828 #define mpBAR_NONE 0 1829 #define mpBAR_AXIS_H 1 1830 #define mpBAR_AXIS_V 2 1831 #define mpBAR_INSIDE 3 1840 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
1848 void SetBarColour(
const wxColour &colour);
1850 void SetColumnWidth(
const double colWidth)
1856 void SetBarLabelPosition(
int position);
1861 virtual double GetMinX();
1866 virtual double GetMaxX();
1871 virtual double GetMinY();
1876 virtual double GetMaxY();
1881 wxColour m_barColour;
1883 double m_labelAngle;
1889 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1902 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
1914 void SetPieColours(
const std::vector<wxColour> &colourArray);
1951 std::vector<wxColour> colours;
1957 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1959 const wxColour& GetColour(
unsigned int id);
1982 mpScale(
const wxString &name,
int flags,
bool grids);
2024 m_labelFormat = format;
2031 return m_labelFormat;
2055 m_auto = automaticScalingIsEnabled;
2066 void SetMinScale(
double min)
2071 double GetMinScale()
const 2076 void SetMaxScale(
double max)
2081 double GetMaxScale()
const 2093 virtual void SetLogAxis(
bool log)
2099 static const wxCoord kTickSize = 4;
2100 static const wxCoord kAxisExtraSpace = 6;
2110 virtual int GetOrigin(
mpWindow &w) = 0;
2118 double GetStep(
double scale,
int minLabelSpacing);
2119 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
2121 wxString FormatLogValue(
double n);
2123 wxDECLARE_DYNAMIC_CLASS(
mpScale);
2127 #define mpX_NORMAL 0x00 2130 #define mpX_TIME 0x01 2132 #define mpX_HOURS 0x02 2134 #define mpX_DATE 0x03 2136 #define mpX_DATETIME 0x04 2138 #define mpX_USER 0x05 2140 #define mpX_NONE 0x06 2155 mpScaleX(
const wxString &name = _T(
"X"),
int flags = mpALIGN_CENTERX,
bool grids =
false,
unsigned int type = mpX_NORMAL) :
2158 m_subtype = mpsScaleX;
2160 m_timeConv = mpX_RAWTIME;
2166 m_labelType = mpX_USER;
2181 m_timeConv = time_conv;
2190 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2197 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
2199 virtual int GetOrigin(
mpWindow &w);
2200 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2201 wxString FormatValue(
const wxString &fmt,
double n);
2219 mpScaleY(
const wxString &name = _T(
"Y"),
int flags = mpALIGN_CENTERY,
bool grids =
false,
size_t axisIndex = 0) :
2222 m_subtype = mpsScaleY;
2223 m_axisWidth = Y_BORDER_SEPARATION;
2224 m_axisIndex = axisIndex;
2232 size_t GetAxisIndex(
void)
2244 return ((GetAlign() == mpALIGN_BORDER_LEFT) || (GetAlign() == mpALIGN_LEFT));
2249 return ((GetAlign() == mpALIGN_BORDER_RIGHT) || (GetAlign() == mpALIGN_RIGHT));
2252 bool IsInside(wxCoord xPixel)
2254 if( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
2268 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2270 virtual int GetOrigin(
mpWindow &w);
2271 wxString GetLabelFormat(
mpWindow &w);
2272 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
2273 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2286 #define mpMOUSEMODE_DRAG 0 2288 #define mpMOUSEMODE_ZOOMBOX 1 2293 typedef std::deque<mpLayer*> mpLayerList;
2301 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer;
2309 typedef std::function<void(void *Sender, wxMouseEvent &event, bool &cancel)> mpOnUserMouseAction;
2320 m_rightClick =
false;
2321 m_IsWasDrawn =
false;
2327 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2329 m_domain = wxRect(left, top, width, height);
2330 m_plot_size = wxRect(left, top, width + left, height + top);
2332 void UpdateBox(
const wxRect &size)
2335 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2336 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2338 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2339 void ClearPlot(wxClientDC &dc);
2340 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2341 void SaveDrawState(
void)
2343 m_IsWasDrawn = m_IsDrawn;
2348 void SetRightClick(
void)
2350 m_rightClick =
true;
2356 wxPoint m_mousePosition;
2360 void DrawCross(wxClientDC &dc)
const;
2387 mpWindow() : m_yAxisDataList(1), m_bound(*
this), m_desired(*
this), m_lastDesiredReportedBounds(*
this)
2392 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2412 bool AddLayer(
mpLayer *layer,
bool refreshDisplay =
true);
2423 bool DelLayer(
mpLayer *layer,
bool alsoDeleteObject,
bool refreshDisplay =
true);
2429 void DelAllLayers(
bool alsoDeleteObject,
bool refreshDisplay =
true);
2436 void DelAllPlot(
bool alsoDeleteObject, mpFunctionType func = mpfAllType,
bool refreshDisplay =
true);
2443 mpLayer* GetLayer(
int position);
2451 mpLayer* GetLayersType(
int position, mpLayerType type);
2458 mpLayer* GetLayerPlot(
int position, mpFunctionType func = mpfAllType);
2462 mpLayer* GetLayerAxis(
int position, mpScaleType scale = mpsAllType);
2468 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
2473 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear);
2479 mpLayer* GetLayerByName(
const wxString &name);
2485 mpLayer* GetLayerByClassName(
const wxString &name);
2490 void RefreshLegend(
void);
2496 bool IsYAxisUsed(
size_t yIndex);
2506 mpScaleY* GetLayerYAxis(
size_t yIndex);
2513 if (ISNOTNULL(scaleX))
2516 UpdateDesiredBoundingBox();
2535 if (ISNOTNULL(scaleY))
2537 m_yAxisDataList[yIndex].m_scaleY = scaleY;
2538 UpdateDesiredBoundingBox();
2549 return m_yAxisDataList[yIndex].m_scaleY;
2552 [[deprecated(
"Incomplete, use UpdateBBox instead")]]
2569 UpdateDesiredBoundingBox();
2587 for(
size_t i = 0; i < m_yAxisDataList.size(); i++)
2589 m_yAxisDataList[i].m_posY = posYList[i];
2591 UpdateDesiredBoundingBox();
2601 return m_yAxisDataList[yIndex].m_posY;
2604 size_t GetNOfYScales(
void)
const 2607 assert(m_yAxisDataList.size() != 0);
2608 return m_yAxisDataList.size();
2611 std::vector<mpScaleY*> GetYAxisList(
void)
const 2625 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
2626 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
2628 m_plotBoundaries.endPx = m_scrX;
2629 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
2630 m_plotBoundaries.endPy = m_scrY;
2631 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
2633 m_PlotArea = wxRect(m_margin.left - EXTRA_MARGIN, m_margin.top - EXTRA_MARGIN,
2634 m_plotWidth + 2*EXTRA_MARGIN, m_plotHeight + 2*EXTRA_MARGIN);
2636 m_magnet.UpdateBox(m_PlotArea);
2665 void SetPos(
const double posX,
const std::vector<double>& posYList)
2668 for(
size_t i = 0; i < m_yAxisDataList.size(); i++)
2670 m_yAxisDataList[i].m_posY = posYList[i];
2673 UpdateDesiredBoundingBox();
2680 inline double p2x(
const wxCoord pixelCoordX)
const 2682 return m_posX + (pixelCoordX / m_scaleX);
2688 inline double p2y(
const wxCoord pixelCoordY,
size_t yIndex = 0)
const 2690 return m_yAxisDataList[yIndex].m_posY - (pixelCoordY / m_yAxisDataList[yIndex].m_scaleY);
2696 inline wxCoord
x2p(
const double x)
const 2698 return (wxCoord)((x - m_posX) * m_scaleX);
2704 inline wxCoord
y2p(
const double y,
size_t yIndex = 0)
const 2706 return (wxCoord)((m_yAxisDataList[yIndex].m_posY - y) * m_yAxisDataList[yIndex].m_scaleY);
2713 m_enableDoubleBuffer = enabled;
2720 m_enableMouseNavigation = enabled;
2728 void LockAspect(
bool enable =
true);
2736 return m_lockaspect;
2745 return m_repainting;
2760 void Fit(
const mpFloatRect &rect, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
2771 void FitY(
size_t yIndex);
2777 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
2783 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
2793 void ZoomInY(std::optional<size_t> yIndex = std::nullopt);
2797 void ZoomOutY(std::optional<size_t> yIndex = std::nullopt);
2800 void ZoomRect(wxPoint p0, wxPoint p1);
2810 unsigned int CountLayers();
2816 return (
unsigned int)m_layers.size();
2822 unsigned int CountLayersType(mpLayerType type);
2823 unsigned int CountLayersFXYPlot();
2836 m_desired.x.min = m_posX + (m_margin.left / m_scaleX);
2837 m_desired.x.max = m_posX + ((m_margin.left + m_plotWidth) / m_scaleX);
2839 for(
size_t i = 0; i < m_desired.y.size(); i++)
2841 m_desired.y[i].max = m_yAxisDataList[i].m_posY - (m_margin.top / m_yAxisDataList[i].m_scaleY);
2842 m_desired.y[i].min = m_yAxisDataList[i].m_posY - ((m_margin.top + m_plotHeight) / m_yAxisDataList[i].m_scaleY);
2845 CheckAndReportDesiredBoundsChanges();
2857 return m_desired.x.min;
2866 return m_desired.x.max;
2875 return m_desired.y[yIndex].min;
2884 return m_desired.y[yIndex].max;
2889 void GetBoundingBox(
double *bbox)
const;
2897 void SetMPScrollbars(
bool status);
2903 return m_enableScrollBars;
2911 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
2916 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2921 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
2927 bool LoadFile(
const wxString &filename);
2939 void SetMargins(
int top,
int right,
int bottom,
int left);
2944 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
2950 SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
2956 return m_margin.top;
2962 SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
2968 return m_margin.right;
2974 return m_marginOuter.right;
2980 SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
2986 return m_margin.bottom;
2992 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
2998 return m_margin.left;
3004 return m_marginOuter.left;
3016 return m_plotHeight;
3024 bond = m_plotBoundariesMargin;
3026 bond = m_plotBoundaries;
3027 bond.startPx -= EXTRA_MARGIN;
3028 bond.endPx += EXTRA_MARGIN;
3029 bond.startPy -= EXTRA_MARGIN;
3030 bond.endPy += EXTRA_MARGIN;
3037 int GetLeftYAxesWidth(std::optional<size_t> yIndex = std::nullopt);
3042 int GetRightYAxesWidth(std::optional<size_t> yIndex = std::nullopt);
3047 m_drawBox = drawbox;
3059 std::optional<size_t> IsInsideYAxis(
const wxPoint &point);
3064 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
3069 void SetLayerVisible(
const wxString &name,
bool viewable);
3074 bool IsLayerVisible(
const wxString &name);
3079 bool IsLayerVisible(
const unsigned int position);
3084 void SetLayerVisible(
const unsigned int position,
bool viewable);
3090 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
3099 const wxColour& GetbgColour()
const 3104 void SetbgColour(
const wxColour &colour)
3106 m_bgColour = colour;
3115 m_OnDeleteLayer = event;
3121 m_OnDeleteLayer = NULL;
3130 m_OnUserMouseAction = userMouseEventHandler;
3136 m_OnUserMouseAction = NULL;
3147 return m_XAxis->IsLogAxis();
3157 mpScaleY* yAxis = GetLayerYAxis(yAxisIndex);
3164 void SetLogXaxis(
bool log)
3167 m_XAxis->SetLogAxis(log);
3175 mpScaleY* yAxis = GetLayerYAxis(yIndex);
3177 yAxis->SetLogAxis(log);
3190 void SetMagnetize(
bool mag)
3201 m_mouseLeftDownAction = action;
3210 return m_mouseLeftDownAction;
3213 #ifdef ENABLE_MP_CONFIG 3214 void RefreshConfigWindow();
3220 #endif // ENABLE_MP_CONFIG 3223 virtual void OnPaint(wxPaintEvent &event);
3224 virtual void OnSize(wxSizeEvent &event);
3225 virtual void OnShowPopupMenu(wxMouseEvent &event);
3226 virtual void OnCenter(wxCommandEvent &event);
3227 virtual void OnFit(wxCommandEvent &event);
3228 virtual void OnToggleGrids(wxCommandEvent &event);
3229 virtual void OnToggleCoords(wxCommandEvent &event);
3230 virtual void OnScreenShot(wxCommandEvent &event);
3231 virtual void OnFullScreen(wxCommandEvent &event);
3232 #ifdef ENABLE_MP_CONFIG 3233 virtual void OnConfiguration(wxCommandEvent &event);
3234 #endif // ENABLE_MP_CONFIG 3235 virtual void OnLoadFile(wxCommandEvent &event);
3236 virtual void OnZoomIn(wxCommandEvent &event);
3237 virtual void OnZoomOut(wxCommandEvent &event);
3238 virtual void OnLockAspect(wxCommandEvent &event);
3239 virtual void OnMouseHelp(wxCommandEvent &event);
3240 virtual void OnMouseLeftDown(wxMouseEvent &event);
3241 virtual void OnMouseRightDown(wxMouseEvent &event);
3242 virtual void OnMouseMove(wxMouseEvent &event);
3243 virtual void OnMouseLeftRelease(wxMouseEvent &event);
3244 virtual void OnMouseWheel(wxMouseEvent &event);
3245 virtual void OnMouseLeave(wxMouseEvent &event);
3246 bool CheckUserMouseAction(wxMouseEvent &event);
3247 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
3248 virtual void OnScrollPageUp(wxScrollWinEvent &event);
3249 virtual void OnScrollPageDown(wxScrollWinEvent &event);
3250 virtual void OnScrollLineUp(wxScrollWinEvent &event);
3251 virtual void OnScrollLineDown(wxScrollWinEvent &event);
3252 virtual void OnScrollTop(wxScrollWinEvent &event);
3253 virtual void OnScrollBottom(wxScrollWinEvent &event);
3255 void DoScrollCalc(
const int position,
const int orientation);
3261 void DoZoomXCalc(
bool zoomIn, wxCoord staticXpixel = ZOOM_AROUND_CENTER);
3269 void DoZoomYCalc(
bool zoomIn, wxCoord staticYpixel = ZOOM_AROUND_CENTER, std::optional<size_t> = std::nullopt);
3275 void SetScaleXAndCenter(
double scaleX);
3282 void SetScaleYAndCenter(
double scaleYList,
size_t yIndex);
3284 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
3288 virtual bool UpdateBBox();
3290 void InitParameters();
3296 void UpdateNOfYAxes(
size_t nOfYAxes);
3298 wxTopLevelWindow* m_parent;
3316 double m_scaleY = 1.0;
3344 bool m_mouseMovedAfterRightClick;
3350 bool m_enableScrollBars;
3351 int m_scrollX, m_scrollY;
3355 bool m_InInfoLegend;
3359 wxRect m_zoom_oldDim;
3366 #ifdef ENABLE_MP_CONFIG 3368 #endif // ENABLE_MP_CONFIG 3370 mpOnDeleteLayer m_OnDeleteLayer = NULL;
3371 mpOnUserMouseAction m_OnUserMouseAction = NULL;
3379 void FillI18NString();
3381 void CheckAndReportDesiredBoundsChanges();
3382 bool m_initialDesiredBoundsRecorded =
false;
3386 wxDECLARE_EVENT_TABLE();
3410 m_subtype = mptText;
3414 m_location = mpMarginNone;
3415 m_ZIndex = mpZIndex_TEXT;
3421 mpText(
const wxString &name,
int offsetx,
int offsety);
3426 mpText(
const wxString &name, mpLocation marginLocation);
3439 m_location = location;
3467 mpLocation m_location;
3471 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3473 wxDECLARE_DYNAMIC_CLASS(
mpText);
3489 mpText(name, mpMarginTopCenter)
3491 m_subtype = mptTitle;
3492 SetPen(*wxWHITE_PEN);
3493 SetBrush(*wxWHITE_BRUSH);
3498 wxDECLARE_DYNAMIC_CLASS(
mpTitle);
3519 mpPrintout(
mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
3525 void SetDrawState(
bool drawState)
3530 bool OnPrintPage(
int page);
3531 bool HasPage(
int page);
3537 stretch_factor = factor;
3566 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
3568 assert(m_type == mpLAYER_PLOT);
3569 m_subtype = mpfMovable;
3570 m_bbox_min_x = m_bbox_max_x = 0;
3571 m_bbox_min_y = m_bbox_max_y = 0;
3582 phi = m_reference_phi;
3591 m_reference_phi = phi;
3592 m_flags = mpALIGN_NE;
3598 return m_trans_shape_xs.size() != 0;
3605 return m_bbox_min_x;
3612 return m_bbox_max_x;
3619 return m_bbox_min_y;
3626 return m_bbox_max_y;
3635 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3639 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
3658 void ShapeUpdated();
3683 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
3685 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
3687 m_continuous =
true;
3697 double GetQuantiles()
const 3710 void SetSegments(
int segments)
3712 m_segments = segments;
3715 int GetSegments()
const 3751 void RecalculateShape();
3770 m_continuous =
true;
3784 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
3805 m_min_x = m_max_x = 0;
3806 m_min_y = m_max_y = 0;
3808 m_bitmapChanged =
false;
3809 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
3819 void GetBitmapCopy(wxImage &outBmp)
const;
3828 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
3863 wxBitmap m_scaledBitmap;
3864 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
3866 bool m_bitmapChanged;
3872 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3880 typedef enum __mp_Colour
3905 this->Set(0, 0, 255);
3908 this->Set(255, 0, 0);
3911 this->Set(0, 128, 0);
3914 this->Set(128, 0, 128);
3917 this->Set(255, 255, 0);
3920 this->Set(255, 0, 255);
3923 this->Set(0, 255, 0);
3926 this->Set(0, 255, 255);
3929 this->Set(128, 128, 0);
3932 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
3933 (ChannelType)((rand() * 255) / RAND_MAX));
3941 #ifdef ENABLE_MP_NAMESPACE 3944 #endif // ENABLE_MP_NAMESPACE 3946 #endif // MATHPLOT_H_INCLUDED int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:3466
const wxString & GetLabelFormat() const
Get axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2029
bool IsHorizontal(void) const
Get if is horizontal line.
Definition: mathplot.h:1295
void SetValue(const double value)
Set x or y.
Definition: mathplot.h:1288
double m_min_x
The shape of the bitmap:
Definition: mathplot.h:3870
mpRect m_marginOuter
Margin around the plot exluding Y-axis. Default 50.
Definition: mathplot.h:3330
bool m_isLog
Is the axis a log axis ?
Definition: mathplot.h:2108
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:2711
mpFloatRect m_bound
Global layer bounding box in user coordinates. Does NOT include borders.
Definition: mathplot.h:3326
double GetDesiredYmin(size_t yIndex) const
Return the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exa...
Definition: mathplot.h:2873
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:706
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:827
std::vector< m_yAxisData > m_yAxisDataList
Current view's Y scales and Y positions.
Definition: mathplot.h:3319
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:2645
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3853
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:3119
bool operator==(const mpFloatRect &rect) const
Equal operator.
Definition: mathplot.h:286
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1339
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:3763
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:2511
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:584
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:174
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1584
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:3323
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:3798
void InitializeBoundingBox(double px, double py, size_t yIndex=0)
Initialize bounding box with an initial point.
Definition: mathplot.h:270
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:3361
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:1935
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:3345
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:1919
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:3768
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:2015
wxString m_name
Layer's name.
Definition: mathplot.h:826
void UpdateDesiredBoundingBox()
Draws the mpWindow on a page for printing.
Definition: mathplot.h:2834
std::vector< double > m_mouseScaleYList
Store current Y-scales, used as reference during drag zooming.
Definition: mathplot.h:3348
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:819
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1272
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:1088
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:3465
Abstract class providing a line.
Definition: mathplot.h:1266
Abstract class providing an vertical line.
Definition: mathplot.h:1331
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:2001
mpFloatRect m_desired
Stores current plot view min/max boundaries. Used primarily during frame resizing via OnSize...
Definition: mathplot.h:3327
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2384
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:820
wxPen m_gridpen
Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition: mathplot.h:2102
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:3587
std::optional< size_t > m_mouseYAxisIndex
Indicate which Y-axis the mouse was on during zoom/pan.
Definition: mathplot.h:3349
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:683
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:2734
int m_winY
Holds the mpWindow size. Used to rescale position when window is resized.
Definition: mathplot.h:964
~mpBarChart()
Destructor.
Definition: mathplot.h:1843
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:2680
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:834
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:2178
double p2y(const wxCoord pixelCoordY, size_t yIndex=0) const
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2688
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:3346
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:3376
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:691
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:3364
int m_flags
Holds label alignment. Default : mpALIGN_NE.
Definition: mathplot.h:831
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:3430
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:568
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:926
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:1043
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:737
unsigned int GetLabelMode() const
Get X axis label view mode.
Definition: mathplot.h:2171
~mpPieChart()
Destructor.
Definition: mathplot.h:1905
bool PointIsInside(double px, double py, size_t yIndex=0) const
Is point inside this bounding box?
Definition: mathplot.h:242
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1256
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:3008
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:821
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3617
mpInfoCoords * m_InfoCoords
pointer to the optional info coords layer
Definition: mathplot.h:3353
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:2960
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1176
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition: mathplot.h:3002
void SetMouseLeftDownAction(mpMouseButtonAction action)
Set the type of action for the left mouse button.
Definition: mathplot.h:3199
wxMenu m_popmenu
Canvas' context menu.
Definition: mathplot.h:3305
double m_mouseScaleX
Store current X-scale, used as reference during drag zooming.
Definition: mathplot.h:3347
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1410
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1466
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
Definition: mathplot.h:3643
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:3309
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:829
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:3334
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:3578
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1070
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2147
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:830
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:3437
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1809
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2163
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:2718
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:3310
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:2045
int GetMarginRight() const
Get the right margin.
Definition: mathplot.h:2966
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:833
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1212
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:520
wxFont m_font
Layer's font.
Definition: mathplot.h:822
bool GetCanDelete(void) const
Get CanDelete for plot.
Definition: mathplot.h:806
Definition: MathPlotConfig.h:44
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:1943
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:2105
void SetCanDelete(bool canDelete)
Set CanDelete for plot.
Definition: mathplot.h:799
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3832
bool GetMagnetize() const
Magnetize the position of the mouse in the plot ie draw a vertical and horizontal line...
Definition: mathplot.h:3185
mpFloatRect Get_Bound(void) const
Get bounding box encompassing all visible plots on this mpWindow.
Definition: mathplot.h:2558
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:1000
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:2008
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:3094
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:716
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:1722
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:3408
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:3862
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:3128
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:3340
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:2566
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:813
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:3014
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:1029
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:1658
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3839
mpInfoLegend * m_InfoLegend
pointer to the optional info legend layer
Definition: mathplot.h:3354
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:730
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:3731
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:3509
int m_last_ly
For double buffering.
Definition: mathplot.h:3339
void SetLogYaxis(size_t yIndex, bool log)
Set the log property (true or false) Y layer (Y axis) with a specific Y-index.
Definition: mathplot.h:3173
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:3362
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:933
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:2104
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, size_t axisIndex=0)
Full constructor.
Definition: mathplot.h:2219
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:960
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:3444
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1258
wxCoord y2p(const double y, size_t yIndex=0) const
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:2704
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1594
mpFloatRect GetDesiredBoundingBox() const
Get the 'desired' user-coordinate bounding box for the currently displayed view (set by Fit...
Definition: mathplot.h:2850
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:3560
double m_scaleX
Current view's X scale.
Definition: mathplot.h:3312
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:3352
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1490
virtual bool IsLogAxis()
Logarithmic axis.
Definition: mathplot.h:2089
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1219
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:3897
unsigned int m_labelType
Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
Definition: mathplot.h:2185
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1184
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer t...
Definition: mathplot.h:225
Layer for bar chart.
Definition: mathplot.h:1836
double m_max
Min and max axis values when autosize is false.
Definition: mathplot.h:2106
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:824
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:1049
abstract Layer for chart (bar and pie).
Definition: mathplot.h:1778
void SetPosY(const std::vector< double > &posYList)
Set current view's Y position and refresh display.
Definition: mathplot.h:2585
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:699
std::vector< mpScaleY * > m_YAxisList
Pointer to the optional Y axes layer of this mpWindow.
Definition: mathplot.h:3303
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:940
double m_bbox_min_x
The precomputed bounding box:
Definition: mathplot.h:3653
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:2855
virtual void DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:849
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1255
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:2978
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:1614
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1257
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:3846
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:2061
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:962
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:1685
void SetYAxisIndex(size_t index)
Set the index of the Y axis associated to the function.
Definition: mathplot.h:1248
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1317
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:1633
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:1642
mpMouseButtonAction GetMouseLeftDownAction()
Returns the type of action for the left mouse button.
Definition: mathplot.h:3208
void UpdateMargins()
Update margins if e.g.
Definition: mathplot.h:2942
< Y scale and position structure
Definition: mathplot.h:3314
int GetMarginTop() const
Get the top margin.
Definition: mathplot.h:2954
wxRect m_PlotArea
The full size of the plot with EXTRA_MARGIN.
Definition: mathplot.h:3336
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:875
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:3648
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:532
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:3458
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:3331
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:902
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:541
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:984
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:2901
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:3357
int m_scrY
Current view's Y dimension.
Definition: mathplot.h:3322
double GetDesiredYmax(size_t yIndex) const
Return the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactl...
Definition: mathplot.h:2882
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:2696
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1191
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1084
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:961
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:3307
bool IsLogXaxis()
Is this an X axis to be displayed with log scale? It is really an axis property but as we need to con...
Definition: mathplot.h:3144
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:2621
int GetBarWidth(void) const
return the width of the bar
Definition: mathplot.h:1516
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:3113
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:1022
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:1707
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:3045
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:3341
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1166
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1357
mpTitle(const wxString &name)
Definition: mathplot.h:3488
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:1014
Plot layer implementing a simple title.
Definition: mathplot.h:3479
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2212
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:3596
bool ViewAsBar(void) const
return true if XY series is plotted with bar
Definition: mathplot.h:1524
double GetScaleY(size_t yIndex=0) const
Get current view's Y scale.
Definition: mathplot.h:2547
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:965
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:764
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:3020
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:2577
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:792
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:828
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2022
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:2053
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1482
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1254
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:3134
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
Full constructor.
Definition: mathplot.h:2155
~mpChart()
Destructor.
Definition: mathplot.h:1785
Abstract class providing an horizontal line.
Definition: mathplot.h:1309
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:1650
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:3306
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:3747
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:1667
void SetPos(const double posX, const std::vector< double > &posYList)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:2665
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:1975
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:659
Class for drawing mouse magnetization.
Definition: mathplot.h:2314
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:1654
void UpdateBoundingBoxToInclude(double px, double py, size_t yIndex=0)
Update bounding box to include this point.
Definition: mathplot.h:259
double GetPosY(size_t yIndex=0) const
Get current view's Y position.
Definition: mathplot.h:2599
size_t GetYAxisIndex() const
Get the index of the Y axis associated to the function.
Definition: mathplot.h:1240
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:3677
double m_minX
Loaded at SetData.
Definition: mathplot.h:1662
double GetDesiredXmax() const
Return the right-border layer coordinate that the user wants the mpWindow to show (it may be not exac...
Definition: mathplot.h:2864
Layer for pie chart.
Definition: mathplot.h:1898
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:675
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:3683
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:667
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:3342
int GetMarginLeft() const
Get the left margin.
Definition: mathplot.h:2996
wxColour m_fontcolour
Layer's font foreground colour.
Definition: mathplot.h:823
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:3722
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:947
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:757
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:1994
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:549
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:778
int GetMarginBottom() const
Get the bottom margin.
Definition: mathplot.h:2984
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1227
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:3565
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:2656
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:592
Plot layer implementing a text string.
Definition: mathplot.h:3403
virtual bool IsLayerType(mpLayerType typeOfInterest, int *subtype)
Set the layer's subtype in caller variable, and return true if the layer is of type "typeOfInterest"...
Definition: mathplot.h:559
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:3332
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:3624
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:3051
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:744
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:825
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition: mathplot.h:2972
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:576
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:963
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:2948
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:2525
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:3308
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1101
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see above)...
Definition: mathplot.h:3704
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:3324
Represents a numeric range with minimum and maximum values.
Definition: mathplot.h:205
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:2931
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:3633
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:1927
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1198
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:3603
Plot layer, abstract base class.
Definition: mathplot.h:508
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:832
bool IsNotSet(mpWindow &w) const
Is mpFloatRect set ?
Definition: mathplot.h:279
double GetValue() const
Set x or y.
Definition: mathplot.h:1280
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:3451
void SetFactor(int factor)
Definition: mathplot.h:3535
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:643
size_t m_yAxisIndex
The index of the Y axis, 0 is the first axis (default)
Definition: mathplot.h:1259
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:2107
double m_posX
Current view's X position.
Definition: mathplot.h:3313
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition: mathplot.h:3321
mpScaleX * m_XAxis
Pointer to the optional X axis layer of this mpWindow.
Definition: mathplot.h:3302
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:723
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:651
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:3742
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:2990
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:3301
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:2103
mpRect m_margin
Margin around the plot including Y-axis.
Definition: mathplot.h:3329
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1747
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:954
mpMouseButtonAction m_mouseLeftDownAction
Type of action for left mouse button.
Definition: mathplot.h:3343
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:3335
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:771
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1987
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:3610
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:2743
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:2814
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:2037
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2186
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1205
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:3803
bool IsLogYaxis(size_t yAxisIndex)
Get the log property (true or false) Y layer (Y axis) with a specific Y-index or false if not found...
Definition: mathplot.h:3155
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2400
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:785
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:1700
void SetScaleY(const double scaleY, size_t yIndex)
Set current view's Y scale and refresh display.
Definition: mathplot.h:2533