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" 80 #include <wx/scrolwin.h> 82 #include <wx/dynarray.h> 84 #include <wx/dcmemory.h> 85 #include <wx/string.h> 95 #ifdef ENABLE_MP_CONFIG 96 #include "MathPlotConfig.h" 97 #endif // ENABLE_MP_CONFIG 104 #ifdef ENABLE_MP_NAMESPACE 106 #endif // ENABLE_MP_NAMESPACE 108 #ifdef ENABLE_MP_DEBUG 113 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) 115 #define DEBUG_NEW new 118 #endif // ENABLE_MP_DEBUG 121 #define X_BORDER_SEPARATION 40 122 #define Y_BORDER_SEPARATION 60 125 #define mpX_LOCALTIME 0x10 127 #define mpX_UTCTIME 0x20 128 #define mpX_RAWTIME mpX_UTCTIME 132 #define ISNOTNULL(x) (fabs(x) > EPSILON) 135 #define EXTRA_MARGIN 8 137 #define ZOOM_AROUND_CENTER -1 143 class WXDLLIMPEXP_MATHPLOT
mpLayer;
145 class WXDLLIMPEXP_MATHPLOT
mpLine;
148 class WXDLLIMPEXP_MATHPLOT
mpFX;
149 class WXDLLIMPEXP_MATHPLOT
mpFY;
150 class WXDLLIMPEXP_MATHPLOT
mpFXY;
153 class WXDLLIMPEXP_MATHPLOT
mpChart;
155 class WXDLLIMPEXP_MATHPLOT
mpScale;
156 class WXDLLIMPEXP_MATHPLOT
mpScaleX;
157 class WXDLLIMPEXP_MATHPLOT
mpScaleY;
161 class WXDLLIMPEXP_MATHPLOT
mpWindow;
162 class WXDLLIMPEXP_MATHPLOT
mpText;
163 class WXDLLIMPEXP_MATHPLOT
mpTitle;
170 #ifdef ENABLE_MP_CONFIG 172 #endif // ENABLE_MP_CONFIG 219 mpRange(
double value1,
double value2)
234 void Set(
double _min,
double _max)
241 void Assign(
double value1,
double value2)
259 void Update(
double value)
271 void Update(
double _min,
double _max)
302 double Length(
void)
const 308 double GetCenter(
void)
const 310 return (min + max) / 2;
316 min = (min > 0) ? log10(min) : 0;
317 max = (max > 0) ? log10(max) : 0;
321 bool PointIsInside(
double point)
const 323 return ((point >= min) && (point <= max));
326 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer 327 bool operator==(
const mpRange&)
const =
default;
329 bool operator==(
const mpRange &other)
const 331 return (min == other.min) && (max == other.max);
341 struct [[
deprecated("No more used, X and Y are now separated")]] mpFloatRect
344 std::vector<mpRange> y;
355 mpFloatRect() =
delete;
358 bool PointIsInside(
double px,
double py,
size_t yAxisID = 0)
const {
359 if (yAxisID < y.size())
361 if( (px < x.min || px > x.max) ||
362 (py < y[yAxisID].min || py > y[yAxisID].max))
375 void UpdateBoundingBoxToInclude(
double px,
double py,
size_t yAxisID = 0) {
376 assert(yAxisID < y.size());
377 if (yAxisID < y.size())
379 if (px < x.min ) x.min = px;
380 else if (px > x.max ) x.max = px;
381 if (py < y[yAxisID].min ) y[yAxisID].min = py;
382 else if (py > y[yAxisID].max ) y[yAxisID].max = py;
386 void InitializeBoundingBox(
double px,
double py,
size_t yAxisID = 0) {
387 assert(yAxisID < y.size());
388 if (yAxisID < y.size())
391 y[yAxisID].min = y[yAxisID].max = py;
395 bool IsNotSet(
mpWindow& w)
const {
const mpFloatRect def(w);
return *
this==def; }
397 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions> 398 bool operator==(
const mpFloatRect&)
const =
default;
402 bool operator==(
const mpFloatRect& rect)
const 404 auto Same = [](
double a,
double b) {
405 return std::fabs(a - b) < EPSILON;
409 if (!Same(x.min, rect.x.min) || !Same(x.max, rect.x.max))
415 if (y.size() != rect.y.size())
421 for (
size_t i = 0; i < y.size(); ++i)
423 if (!Same(y[i].min, rect.y[i].min) ||
424 !Same(y[i].max, rect.y[i].max) )
449 return x.PointIsInside(px) && y.PointIsInside(py);
457 void UpdateBoundingBoxToInclude(
double px,
double py)
467 void InitializeBoundingBox(
double px,
double py)
487 #ifdef ENABLE_MP_CONFIG 489 #endif // ENABLE_MP_CONFIG 504 mpMarginBottomCenter,
513 mpALIGN_BORDER_BOTTOM = 10,
523 mpALIGN_BORDER_LEFT = 20,
554 typedef enum __Symbol_Type
586 typedef enum __Function_Type
598 typedef enum __Scale_Type
606 typedef enum __Chart_Type
614 enum mpMouseButtonAction
676 class WXDLLIMPEXP_MATHPLOT
mpLayer:
public wxObject
679 mpLayer(mpLayerType layerType);
727 virtual bool IsLayerType(mpLayerType typeOfInterest,
int *subtype)
729 *subtype = m_subtype;
730 return (m_type == typeOfInterest);
845 m_fontcolour = colour;
876 if (brush == wxNullBrush)
877 m_brush = *wxTRANSPARENT_BRUSH;
907 m_drawOutsideMargins = drawModeOutside;
914 return m_drawOutsideMargins;
921 wxBitmap GetColourSquare(
int side = 16);
969 m_CanDelete = canDelete;
1006 void UpdateContext(wxDC &dc)
const;
1012 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
1029 void CheckLog(
double *x,
double *y,
int yAxisID);
1035 wxDECLARE_DYNAMIC_CLASS(
mpLayer);
1057 mpInfoLayer(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
1064 virtual void SetVisible(
bool show);
1070 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
1082 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
1087 virtual bool Inside(
const wxPoint &point);
1091 virtual void Move(wxPoint delta);
1094 virtual void UpdateReference();
1100 return m_dim.GetPosition();
1107 return m_dim.GetSize();
1121 m_location = location;
1143 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1147 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
1169 mpInfoCoords(wxRect rect,
const wxBrush &brush = *wxTRANSPARENT_BRUSH, mpLocation location = mpMarginNone);
1180 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
1182 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
1189 m_timeConv = time_conv;
1196 m_series_coord = show;
1203 return m_series_coord;
1211 virtual wxString GetInfoCoordsText(
mpWindow &w,
double xVal, std::vector<double> yValList);
1222 unsigned int m_labelType;
1223 unsigned int m_timeConv;
1226 bool m_series_coord;
1233 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1253 mpInfoLegend(wxRect rect,
const wxBrush &brush = *wxWHITE_BRUSH, mpLocation location = mpMarginNone);
1263 m_needs_update =
true;
1266 mpLegendStyle GetItemMode()
const 1275 m_item_direction = mode;
1276 m_needs_update =
true;
1279 mpLegendDirection GetItemDirection()
const 1281 return m_item_direction;
1284 void SetNeedUpdate()
1286 m_needs_update =
true;
1290 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1293 mpLegendStyle m_item_mode;
1294 mpLegendDirection m_item_direction;
1300 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1306 unsigned int layerIdx;
1310 std::vector<LegendDetail> m_LegendDetailList;
1311 bool m_needs_update;
1322 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1343 mpFunction(mpLayerType layerType =
mpLAYER_PLOT,
const wxString &name = wxEmptyString,
unsigned int yAxisID = 0);
1350 m_continuous = continuity;
1358 return m_continuous;
1393 m_symbolSize = size;
1394 m_symbolSize2 = size / 2;
1401 return m_symbolSize;
1407 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1422 m_yAxisID = yAxisID;
1441 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1469 return m_IsHorizontal;
1474 bool m_IsHorizontal;
1476 wxDECLARE_DYNAMIC_CLASS(
mpLine);
1484 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN,
unsigned int yAxisID = 0);
1496 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1518 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1544 mpFX(
const wxString &name = wxEmptyString,
int flags = mpALIGN_RIGHT,
unsigned int yAxisID = 0);
1551 virtual double GetY(
double x) = 0;
1557 double DoGetY(
double x);
1563 void DefineDoGetY(
void);
1568 double (
mpFX::*pDoGetY)(
double x);
1574 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1579 double NormalDoGetY(
double x);
1580 double LogDoGetY(
double x);
1582 wxDECLARE_DYNAMIC_CLASS(
mpFX);
1597 mpFY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP,
unsigned int yAxisID = 0);
1604 virtual double GetX(
double y) = 0;
1610 double DoGetX(
double y);
1616 void DefineDoGetX(
void);
1621 double (
mpFY::*pDoGetX)(
double y);
1627 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1632 double NormalDoGetX(
double y);
1633 double LogDoGetX(
double y);
1635 wxDECLARE_DYNAMIC_CLASS(
mpFY);
1653 mpFXY(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
unsigned int yAxisID = 0);
1658 virtual void Rewind() = 0;
1682 virtual bool GetNextXY(
double *x,
double *y) = 0;
1687 bool DoGetNextXY(
double *x,
double *y);
1692 void SetViewMode(
bool asBar);
1713 wxCoord maxDrawX, minDrawX, maxDrawY, minDrawY;
1716 double m_deltaX, m_deltaY;
1722 bool m_ViewAsBar =
false;
1728 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1734 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1736 wxDECLARE_DYNAMIC_CLASS(
mpFXY);
1768 mpFXYVector(
const wxString &name = wxEmptyString,
int flags = mpALIGN_NE,
bool viewAsBar =
false,
unsigned int yAxisID = 0);
1781 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
1804 bool AddData(
const double x,
const double y,
bool updatePlot);
1813 m_reserveXY = reserve;
1814 m_xs.reserve(m_reserveXY);
1815 m_ys.reserve(m_reserveXY);
1840 double m_minX, m_maxX, m_minY, m_maxY, m_lastX, m_lastY;
1855 virtual bool GetNextXY(
double *x,
double *y);
1859 void DrawAddedPoint(
double x,
double y);
1868 return m_minX - (m_deltaX / 2);
1890 return m_maxX + (m_deltaX / 2);
1908 void First_Point(
double x,
double y);
1912 void Check_Limit(
double val,
double *min,
double *max,
double *last,
double *delta);
1931 mpProfile(
const wxString &name = wxEmptyString,
int flags = mpALIGN_TOP);
1938 virtual double GetY(
double x) = 0;
1946 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1960 mpChart(
const wxString &name = wxEmptyString);
1970 void SetChartValues(
const std::vector<double> &data);
1974 void SetChartLabels(
const std::vector<std::string> &labelArray);
1980 void AddData(
const double &data,
const std::string &label);
1985 virtual void Clear();
1989 return (values.size() > 0);
1993 std::vector<double> values;
1994 std::vector<std::string> labels;
1997 double m_total_value;
1999 wxDECLARE_DYNAMIC_CLASS(
mpChart);
2006 #define mpBAR_NONE 0 2007 #define mpBAR_AXIS_H 1 2008 #define mpBAR_AXIS_V 2 2009 #define mpBAR_INSIDE 3 2018 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
2026 void SetBarColour(
const wxColour &colour);
2028 void SetColumnWidth(
const double colWidth)
2034 void SetBarLabelPosition(
int position);
2039 virtual double GetMinX();
2044 virtual double GetMaxX();
2049 virtual double GetMinY();
2054 virtual double GetMaxY();
2059 wxColour m_barColour;
2061 double m_labelAngle;
2067 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2079 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
2106 void SetPieColours(
const std::vector<wxColour> &colourArray);
2113 return m_center.x - m_radius;
2121 return m_center.x + m_radius;
2129 return m_center.y - m_radius;
2137 return m_center.y + m_radius;
2144 std::vector<wxColour> colours;
2150 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2152 const wxColour& GetColour(
unsigned int id);
2175 mpScale(
const wxString &name,
int flags,
bool grids, std::optional<unsigned int> axisID = std::nullopt);
2234 m_labelFormat = format;
2241 return m_labelFormat;
2265 m_auto = automaticScalingIsEnabled;
2276 void SetMinScale(
double min)
2281 double GetMinScale()
const 2286 void SetMaxScale(
double max)
2291 double GetMaxScale()
const 2296 void SetScale(
double min,
double max)
2302 void GetScale(
double *min,
double *max)
const 2330 virtual void SetLogAxis(
bool log)
2336 static const wxCoord kTickSize = 4;
2337 static const wxCoord kAxisExtraSpace = 6;
2348 virtual int GetOrigin(
mpWindow &w) = 0;
2356 double GetStep(
double scale,
int minLabelSpacing);
2357 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
2359 wxString FormatLogValue(
double n);
2361 wxDECLARE_DYNAMIC_CLASS(
mpScale);
2365 #define mpX_NORMAL 0x00 2368 #define mpX_TIME 0x01 2370 #define mpX_HOURS 0x02 2372 #define mpX_DATE 0x03 2374 #define mpX_DATETIME 0x04 2376 #define mpX_USER 0x05 2378 #define mpX_NONE 0x06 2393 mpScaleX(
const wxString &name = _T(
"X"),
int flags = mpALIGN_CENTERX,
bool grids =
false,
unsigned int type =
mpX_NORMAL) :
2396 m_subtype = mpsScaleX;
2398 m_timeConv = mpX_RAWTIME;
2419 m_timeConv = time_conv;
2424 return ((GetAlign() == mpALIGN_BORDER_TOP) || (GetAlign() == mpALIGN_TOP));
2429 return ((GetAlign() == mpALIGN_BORDER_BOTTOM) || (GetAlign() == mpALIGN_BOTTOM));
2438 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2445 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
2447 virtual int GetOrigin(
mpWindow &w);
2448 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2449 wxString FormatValue(
const wxString &fmt,
double n);
2467 mpScaleY(
const wxString &name = _T(
"Y"),
int flags = mpALIGN_CENTERY,
bool grids =
false, std::optional<unsigned int> yAxisID = std::nullopt) :
2468 mpScale(name, flags, grids, yAxisID)
2470 m_subtype = mpsScaleY;
2471 m_axisWidth = Y_BORDER_SEPARATION;
2486 return ((GetAlign() == mpALIGN_BORDER_LEFT) || (GetAlign() == mpALIGN_LEFT));
2491 return ((GetAlign() == mpALIGN_BORDER_RIGHT) || (GetAlign() == mpALIGN_RIGHT));
2494 bool IsInside(wxCoord xPixel)
2496 if ( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
2509 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2511 virtual int GetOrigin(
mpWindow &w);
2512 wxString GetLabelFormat(
mpWindow &w);
2513 int GetLabelWidth(
double value, wxDC &dc, wxString fmt);
2514 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2527 #define mpMOUSEMODE_DRAG 0 2529 #define mpMOUSEMODE_ZOOMBOX 1 2554 bool operator==(
const mpAxisData& other)
const 2556 return (scale == other.
scale) && (pos == other.
pos) &&
2582 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)>
mpOnDeleteLayer;
2602 m_rightClick =
false;
2603 m_IsWasDrawn =
false;
2609 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2611 m_domain = wxRect(left, top, width, height);
2612 m_plot_size = wxRect(left, top, width + left, height + top);
2614 void UpdateBox(
const wxRect &size)
2617 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2618 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2620 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2621 void ClearPlot(wxClientDC &dc);
2622 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2623 void SaveDrawState(
void)
2625 m_IsWasDrawn = m_IsDrawn;
2630 void SetRightClick(
void)
2632 m_rightClick =
true;
2638 wxPoint m_mousePosition;
2642 void DrawCross(wxClientDC &dc)
const;
2674 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2695 bool AddLayer(
mpLayer *layer,
bool refreshDisplay =
true,
bool refreshConfig =
true);
2709 bool DelLayer(
mpLayer *layer, mpDeleteAction alsoDeleteObject,
bool refreshDisplay =
true,
bool refreshConfig =
true);
2716 void DelAllLayers(mpDeleteAction alsoDeleteObject,
bool refreshDisplay =
true);
2724 void DelAllPlot(mpDeleteAction alsoDeleteObject, mpFunctionType func = mpfAllType,
bool refreshDisplay =
true);
2732 void DelAllYAxisAfterID(mpDeleteAction alsoDeleteObject,
int yAxisID = 0,
bool refreshDisplay =
true);
2739 mpLayer* GetLayer(
int position);
2745 int GetLayerPosition(
mpLayer* layer);
2753 mpLayer* GetLayersType(
int position, mpLayerType type);
2760 mpLayer* GetLayerPlot(
int position, mpFunctionType func = mpfAllType);
2764 mpLayer* GetLayerAxis(
int position, mpScaleType scale = mpsAllType);
2770 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
2775 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear);
2781 mpLayer* GetLayerByName(
const wxString &name);
2787 mpLayer* GetLayerByClassName(
const wxString &name);
2792 void RefreshLegend(
void);
2798 bool IsYAxisUsed(
int yAxisID);
2808 mpScaleY* GetLayerYAxis(
int yAxisID);
2815 if (ISNOTNULL(scaleX))
2817 m_AxisDataX.scale = scaleX;
2818 UpdateDesiredBoundingBox(uXAxis);
2829 return m_AxisDataX.scale;
2838 assert(m_AxisDataYList.count(yAxisID) != 0);
2839 if (ISNOTNULL(scaleY))
2841 m_AxisDataYList[yAxisID].scale = scaleY;
2842 UpdateDesiredBoundingBox(uYAxis);
2854 assert(m_AxisDataYList.count(yAxisID) != 0);
2855 return m_AxisDataYList[yAxisID].scale;
2858 [[
deprecated(
"Incomplete, use UpdateBBox instead")]]
2866 return m_AxisDataX.bound;
2874 assert(m_AxisDataYList.count(yAxisID) != 0);
2875 return m_AxisDataYList[yAxisID].bound;
2883 m_AxisDataX.pos = posX;
2884 UpdateDesiredBoundingBox(uXAxis);
2894 return m_AxisDataX.pos;
2904 for (
auto& axisDataY : m_AxisDataYList)
2906 axisDataY.second.pos = posYList[i];
2909 UpdateDesiredBoundingBox(uYAxis);
2920 assert(m_AxisDataYList.count(yAxisID) != 0);
2921 return m_AxisDataYList[yAxisID].pos;
2929 return (
int)m_AxisDataYList.size();
2932 mpAxisList GetAxisDataYList(
void)
const 2934 return m_AxisDataYList;
2946 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
2947 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
2949 m_plotBoundaries.endPx = m_scrX;
2950 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
2951 m_plotBoundaries.endPy = m_scrY;
2952 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
2954 m_PlotArea = wxRect(m_margin.left - m_extraMargin, m_margin.top - m_extraMargin,
2955 m_plotWidth + 2*m_extraMargin, m_plotHeight + 2*m_extraMargin);
2957 m_magnet.UpdateBox(m_PlotArea);
2987 void SetPos(
const double posX,
const std::vector<double>& posYList)
2989 m_AxisDataX.pos = posX;
2996 inline double p2x(
const wxCoord pixelCoordX)
const 2998 return m_AxisDataX.pos + (pixelCoordX / m_AxisDataX.scale);
3004 inline double p2y(
const wxCoord pixelCoordY,
int yAxisID = 0)
3006 assert(m_AxisDataYList.count(yAxisID) != 0);
3007 if (m_AxisDataYList.count(yAxisID) == 0)
3009 return m_AxisDataYList[yAxisID].pos - (pixelCoordY / m_AxisDataYList[yAxisID].scale);
3015 inline wxCoord
x2p(
const double x)
const 3017 return (wxCoord)((x - m_AxisDataX.pos) * m_AxisDataX.scale);
3023 inline wxCoord
y2p(
const double y,
int yAxisID = 0)
3025 assert(m_AxisDataYList.count(yAxisID) != 0);
3026 if (m_AxisDataYList.count(yAxisID) == 0)
3028 return (wxCoord)((m_AxisDataYList[yAxisID].pos - y) * m_AxisDataYList[yAxisID].scale);
3035 m_enableDoubleBuffer = enabled;
3042 m_enableMouseNavigation = enabled;
3050 void LockAspect(
bool enable =
true);
3058 return m_lockaspect;
3067 return m_repainting;
3082 void Fit(
const mpRange &rangeX,
const std::vector<mpRange> &rangeY, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
3093 void FitY(
int yAxisID);
3099 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
3105 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
3115 void ZoomInY(std::optional<int> yAxisID = std::nullopt);
3119 void ZoomOutY(std::optional<int> yAxisID = std::nullopt);
3122 void ZoomRect(wxPoint p0, wxPoint p1);
3132 unsigned int CountLayers();
3138 return (
unsigned int)m_layers.size();
3144 unsigned int CountLayersType(mpLayerType type);
3145 unsigned int CountLayersFXYPlot();
3161 if ((update & uXAxis) == uXAxis)
3163 if (!m_desiredChanged)
3164 lastRange = m_AxisDataX.desired;
3165 m_AxisDataX.desired.Assign(m_AxisDataX.pos + (m_margin.left / m_AxisDataX.scale),
3166 m_AxisDataX.pos + ((m_margin.left + m_plotWidth) / m_AxisDataX.scale));
3167 m_desiredChanged = !(lastRange == m_AxisDataX.desired);
3171 if ((update & uYAxis) == uYAxis)
3173 for (
auto& axisDataY : m_AxisDataYList)
3176 if (!m_desiredChanged)
3179 yAxis->
pos - ((m_margin.top + m_plotHeight) / yAxis->
scale));
3180 if (!m_desiredChanged)
3181 m_desiredChanged = !(lastRange == yAxis->
desired);
3193 assert(m_AxisDataYList.count(yAxisID) != 0);
3195 return mpFloatRectSimple(m_AxisDataX.desired, m_AxisDataYList[yAxisID].desired);
3205 return m_AxisDataX.desired.min;
3214 return m_AxisDataX.desired.max;
3224 assert(m_AxisDataYList.count(yAxisID) != 0);
3225 return m_AxisDataYList[yAxisID].desired.min;
3235 assert(m_AxisDataYList.count(yAxisID) != 0);
3236 return m_AxisDataYList[yAxisID].desired.max;
3242 if (m_AxisDataYList.count(yAxisID) == 0)
3244 *boundX = m_AxisDataX.bound;
3245 *boundY = m_AxisDataYList[yAxisID].bound;
3250 bool PointIsInsideBound(
double px,
double py,
int yAxisID)
3252 if (m_AxisDataYList.count(yAxisID) == 0)
3255 return m_AxisDataX.bound.PointIsInside(px) && Get_BoundY(yAxisID).PointIsInside(py);
3264 void UpdateBoundingBoxToInclude(
double px,
double py,
int yAxisID)
3266 if (m_AxisDataYList.count(yAxisID) == 0)
3269 m_AxisDataX.bound.Update(px);
3270 m_AxisDataYList[yAxisID].bound.Update(py);
3278 void InitializeBoundingBox(
double px,
double py,
int yAxisID)
3280 if (m_AxisDataYList.count(yAxisID) == 0)
3283 m_AxisDataX.bound.Set(px, px);
3284 m_AxisDataYList[yAxisID].bound.Set(py, py);
3289 void SetMPScrollbars(
bool status);
3295 return m_enableScrollBars;
3303 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
3308 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
3313 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
3319 bool LoadFile(
const wxString &filename);
3331 void SetMargins(
int top,
int right,
int bottom,
int left);
3336 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3342 SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3351 return m_margin.top - m_extraMargin;
3353 return m_margin.top;
3359 SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
3368 return m_margin.right - m_extraMargin;
3370 return m_margin.right;
3376 return m_marginOuter.right;
3382 SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
3391 return m_margin.bottom - m_extraMargin;
3393 return m_margin.bottom;
3399 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
3408 return m_margin.left - m_extraMargin;
3410 return m_margin.left;
3416 m_extraMargin = extra;
3417 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3423 return m_extraMargin;
3429 return m_marginOuter.left;
3441 return m_plotHeight;
3452 bond = m_plotBoundariesMargin;
3454 bond = m_plotBoundaries;
3455 bond.startPx -= m_extraMargin;
3456 bond.endPx += m_extraMargin;
3457 bond.startPy -= m_extraMargin;
3458 bond.endPy += m_extraMargin;
3465 int GetLeftYAxesWidth(std::optional<int> yAxisID = std::nullopt);
3470 int GetRightYAxesWidth(std::optional<int> yAxisID = std::nullopt);
3475 m_drawBox = drawbox;
3487 std::optional<int> IsInsideYAxis(
const wxPoint &point);
3492 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
3497 void SetLayerVisible(
const wxString &name,
bool viewable);
3502 bool IsLayerVisible(
const wxString &name);
3507 bool IsLayerVisible(
const unsigned int position);
3512 void SetLayerVisible(
const unsigned int position,
bool viewable);
3518 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
3527 const wxColour& GetbgColour()
const 3532 void SetbgColour(
const wxColour &colour)
3534 m_bgColour = colour;
3543 m_OnDeleteLayer = event;
3549 m_OnDeleteLayer = NULL;
3558 m_OnUserMouseAction = userMouseEventHandler;
3564 m_OnUserMouseAction = NULL;
3574 if (m_AxisDataX.axis)
3575 return ((
mpScaleX *)m_AxisDataX.axis)->IsLogAxis();
3585 assert(m_AxisDataYList.count(yAxisID) != 0);
3586 mpScaleY* yAxis = GetLayerYAxis(yAxisID);
3588 return yAxis->IsLogAxis();
3593 void SetLogXaxis(
bool log)
3595 if (m_AxisDataX.axis)
3596 ((
mpScaleX *)m_AxisDataX.axis)->SetLogAxis(log);
3604 mpScaleY* yAxis = GetLayerYAxis(yAxisID);
3606 yAxis->SetLogAxis(log);
3619 void SetMagnetize(
bool mag)
3630 m_mouseLeftDownAction = action;
3639 return m_mouseLeftDownAction;
3642 #ifdef ENABLE_MP_CONFIG 3643 void RefreshConfigWindow();
3649 #endif // ENABLE_MP_CONFIG 3652 virtual void OnPaint(wxPaintEvent &event);
3653 virtual void OnSize(wxSizeEvent &event);
3654 virtual void OnShowPopupMenu(wxMouseEvent &event);
3655 virtual void OnCenter(wxCommandEvent &event);
3656 virtual void OnFit(wxCommandEvent &event);
3657 virtual void OnToggleGrids(wxCommandEvent &event);
3658 virtual void OnToggleCoords(wxCommandEvent &event);
3659 virtual void OnScreenShot(wxCommandEvent &event);
3660 virtual void OnFullScreen(wxCommandEvent &event);
3661 #ifdef ENABLE_MP_CONFIG 3662 virtual void OnConfiguration(wxCommandEvent &event);
3663 #endif // ENABLE_MP_CONFIG 3664 virtual void OnLoadFile(wxCommandEvent &event);
3665 virtual void OnZoomIn(wxCommandEvent &event);
3666 virtual void OnZoomOut(wxCommandEvent &event);
3667 virtual void OnLockAspect(wxCommandEvent &event);
3668 virtual void OnMouseHelp(wxCommandEvent &event);
3669 virtual void OnMouseLeftDown(wxMouseEvent &event);
3670 virtual void OnMouseRightDown(wxMouseEvent &event);
3671 virtual void OnMouseMove(wxMouseEvent &event);
3672 virtual void OnMouseLeftRelease(wxMouseEvent &event);
3673 virtual void OnMouseWheel(wxMouseEvent &event);
3674 virtual void OnMouseLeave(wxMouseEvent &event);
3675 bool CheckUserMouseAction(wxMouseEvent &event);
3676 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
3677 virtual void OnScrollPageUp(wxScrollWinEvent &event);
3678 virtual void OnScrollPageDown(wxScrollWinEvent &event);
3679 virtual void OnScrollLineUp(wxScrollWinEvent &event);
3680 virtual void OnScrollLineDown(wxScrollWinEvent &event);
3681 virtual void OnScrollTop(wxScrollWinEvent &event);
3682 virtual void OnScrollBottom(wxScrollWinEvent &event);
3684 void DoScrollCalc(
const int position,
const int orientation);
3690 void DoZoomXCalc(
bool zoomIn, wxCoord staticXpixel = ZOOM_AROUND_CENTER);
3698 void DoZoomYCalc(
bool zoomIn, wxCoord staticYpixel = ZOOM_AROUND_CENTER, std::optional<int> = std::nullopt);
3704 void SetScaleXAndCenter(
double scaleX);
3711 void SetScaleYAndCenter(
double scaleY,
int yAxisID);
3713 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
3717 virtual bool UpdateBBox();
3719 void InitParameters();
3721 wxTopLevelWindow* m_parent;
3727 bool m_desiredChanged =
false;
3757 bool m_mouseMovedAfterRightClick;
3763 bool m_enableScrollBars;
3764 int m_scrollX, m_scrollY;
3768 bool m_InInfoLegend;
3772 wxRect m_zoom_oldDim;
3779 #ifdef ENABLE_MP_CONFIG 3781 #endif // ENABLE_MP_CONFIG 3783 mpOnDeleteLayer m_OnDeleteLayer = NULL;
3784 mpOnUserMouseAction m_OnUserMouseAction = NULL;
3792 void FillI18NString();
3793 unsigned int GetNewAxisDataID(
void)
3795 while (m_AxisDataYList.count(m_LastAxisDataID) != 0)
3799 return m_LastAxisDataID;
3802 unsigned int m_LastAxisDataID = 0;
3805 wxDECLARE_EVENT_TABLE();
3829 m_subtype = mptText;
3833 m_location = mpMarginNone;
3840 mpText(
const wxString &name,
int offsetx,
int offsety);
3845 mpText(
const wxString &name, mpLocation marginLocation);
3858 m_location = location;
3886 mpLocation m_location;
3890 virtual void DoPlot(wxDC &dc,
mpWindow &w);
3892 wxDECLARE_DYNAMIC_CLASS(
mpText);
3908 mpText(name, mpMarginTopCenter)
3910 m_subtype = mptTitle;
3911 SetPen(*wxWHITE_PEN);
3912 SetBrush(*wxWHITE_BRUSH);
3917 wxDECLARE_DYNAMIC_CLASS(
mpTitle);
3938 mpPrintout(
mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
3944 void SetDrawState(
bool drawState)
3949 bool OnPrintPage(
int page);
3950 bool HasPage(
int page);
3956 stretch_factor = factor;
3985 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
3988 m_subtype = mpfMovable;
3989 m_bbox_min_x = m_bbox_max_x = 0;
3990 m_bbox_min_y = m_bbox_max_y = 0;
4001 phi = m_reference_phi;
4010 m_reference_phi = phi;
4011 m_flags = mpALIGN_NE;
4017 return m_trans_shape_xs.size() != 0;
4024 return m_bbox_min_x;
4031 return m_bbox_max_x;
4038 return m_bbox_min_y;
4045 return m_bbox_max_y;
4054 virtual void DoPlot(wxDC &dc,
mpWindow &w);
4058 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
4077 void ShapeUpdated();
4102 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
4104 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
4106 m_continuous =
true;
4116 double GetQuantiles()
const 4129 void SetSegments(
int segments)
4131 m_segments = segments;
4134 int GetSegments()
const 4170 void RecalculateShape();
4189 m_continuous =
true;
4203 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
4224 m_min_x = m_max_x = 0;
4225 m_min_y = m_max_y = 0;
4227 m_bitmapChanged =
false;
4228 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
4238 void GetBitmapCopy(wxImage &outBmp)
const;
4247 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
4282 wxBitmap m_scaledBitmap;
4283 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
4285 bool m_bitmapChanged;
4291 virtual void DoPlot(wxDC &dc,
mpWindow &w);
4299 typedef enum __mp_Colour
4324 this->Set(0, 0, 255);
4327 this->Set(255, 0, 0);
4330 this->Set(0, 128, 0);
4333 this->Set(128, 0, 128);
4336 this->Set(255, 255, 0);
4339 this->Set(255, 0, 255);
4342 this->Set(0, 255, 0);
4345 this->Set(0, 255, 255);
4348 this->Set(128, 128, 0);
4351 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
4352 (ChannelType)((rand() * 255) / RAND_MAX));
4360 #ifdef ENABLE_MP_NAMESPACE 4363 #endif // ENABLE_MP_NAMESPACE 4365 #endif // MATHPLOT_H_INCLUDED int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:3885
const wxString & GetLabelFormat() const
Get axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2239
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:2582
bool IsHorizontal(void) const
Get if is horizontal line.
Definition: mathplot.h:1467
__mp_Location_Type
Location for the Info layer.
Definition: mathplot.h:496
int GetAxisID(void)
Return the ID of the Axis.
Definition: mathplot.h:2188
void SetValue(const double value)
Set x or y.
Definition: mathplot.h:1460
mpInfoLegend * m_InfoLegend
pointer to the optional info legend layer
Definition: mathplot.h:3767
enum __YAxis_Align_Type mpYAxis_Align
Alignment for Y axis.
Show legend items with small square with the same color of referred mpLayer.
Definition: mathplot.h:543
double m_min_x
The shape of the bitmap:
Definition: mathplot.h:4289
mpRect m_marginOuter
Margin around the plot exluding Y-axis. Default 50.
Definition: mathplot.h:3742
bool m_isLog
Is the axis a log axis ?
Definition: mathplot.h:2346
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:3033
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:874
bool IsLogYaxis(int yAxisID)
Get the log property (true or false) Y layer (Y axis) with a specific Y ID or false if not found...
Definition: mathplot.h:3583
Bitmap type layer.
Definition: mathplot.h:643
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:995
Plot type layer.
Definition: mathplot.h:628
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:2966
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:4272
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:3547
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1511
void SetYAxisID(unsigned int yAxisID)
Set the ID of the Y axis used by the function.
Definition: mathplot.h:1420
std::map< int, mpAxisData > mpAxisList
Define the type for the list of axis.
Definition: mathplot.h:2562
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:4182
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:2813
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:752
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:175
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1762
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:3738
Show legend items with line with the same pen of referred mpLayer.
Definition: mathplot.h:542
__mp_Layer_Type
Definition: mathplot.h:624
Show/Hide grids.
Definition: mathplot.h:484
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:4217
int m_axisID
Unique ID that identify this axis. Default -1 mean that axis is not used.
Definition: mathplot.h:2339
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:3774
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:2127
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:3758
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:2111
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:4187
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:2225
wxCoord y2p(const double y, int yAxisID=0)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition: mathplot.h:3023
enum __Plot_Align_Name_Type mpPlot_Align
Plot alignment (which corner should plot be placed)
Layer type undefined; SHOULD NOT BE USED.
Definition: mathplot.h:626
enum __mp_Direction_Type mpLegendDirection
Direction for the Legend layer.
__mp_Delete_Action
Action to do with the object associated to the layer when we delete it.
Definition: mathplot.h:659
wxString m_name
Layer's name.
Definition: mathplot.h:994
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:987
mpRange bound
Range min and max.
Definition: mathplot.h:2550
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1444
Lock x/y scaling aspect.
Definition: mathplot.h:483
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:1260
Info box type layer.
Definition: mathplot.h:648
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:3884
Abstract class providing a line.
Definition: mathplot.h:1438
Abstract class providing an vertical line.
Definition: mathplot.h:1503
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:2211
void SetCenter(const wxPoint center)
Set the center of the pie chart.
Definition: mathplot.h:2091
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2666
enum __Info_Type mpInfoType
sub_type values for mpLAYER_INFO
wxPen m_gridpen
Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition: mathplot.h:2340
int GetNOfYAxis(void) const
Get the number of Y axis.
Definition: mathplot.h:2927
double p2y(const wxCoord pixelCoordY, int yAxisID=0)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:3004
void SetExtraMargin(int extra)
Set the extra margin.
Definition: mathplot.h:3414
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:1134
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:4006
Chart type layer (bar chart)
Definition: mathplot.h:633
double GetPosY(int yAxisID)
Get current view's Y position.
Definition: mathplot.h:2918
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:851
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:3056
int m_winY
Holds the mpWindow size. Used to rescale position when window is resized.
Definition: mathplot.h:1136
std::optional< int > m_mouseYAxisID
Indicate which ID of Y-axis the mouse was on during zoom/pan.
Definition: mathplot.h:3762
~mpBarChart()
Destructor.
Definition: mathplot.h:2021
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:2996
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:1002
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:2416
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:3759
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:3789
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:859
int m_flags
Holds label alignment. Default : mpALIGN_NE.
Definition: mathplot.h:999
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:3849
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:736
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:1098
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:1215
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:905
unsigned int GetLabelMode() const
Get X axis label view mode.
Definition: mathplot.h:2409
~mpPieChart()
Destructor.
Definition: mathplot.h:2082
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1428
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:3433
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:989
Just the end of ZOrder.
Definition: mathplot.h:650
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:4036
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
Definition: mathplot.h:641
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:3357
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:3323
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1348
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition: mathplot.h:3427
void SetMouseLeftDownAction(mpMouseButtonAction action)
Set the type of action for the left mouse button.
Definition: mathplot.h:3628
wxMenu m_popmenu
Canvas' context menu.
Definition: mathplot.h:3729
double m_mouseScaleX
Store current X-scale, used as reference during drag zooming.
Definition: mathplot.h:3760
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1591
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1647
enum __mp_Style_Type mpLegendStyle
Style for the Legend layer.
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:3733
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:997
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:3747
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:3997
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:2590
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1242
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2385
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:998
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:3856
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:1987
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2401
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:3040
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:3734
Plot (function) type layer.
Definition: mathplot.h:646
void UpdateDesiredBoundingBox(mpAxisUpdate update)
Draws the mpWindow on a page for printing.
Definition: mathplot.h:3157
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:2255
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:1001
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1384
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:688
wxFont m_font
Layer's font.
Definition: mathplot.h:990
bool GetCanDelete(void) const
Get CanDelete for plot.
Definition: mathplot.h:974
Axis type layer.
Definition: mathplot.h:644
Definition: MathPlotConfig.h:75
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:2135
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:2343
Axis type layer.
Definition: mathplot.h:627
void SetCanDelete(bool canDelete)
Set CanDelete for plot.
Definition: mathplot.h:967
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:4251
bool GetMagnetize() const
Magnetize the position of the mouse in the plot ie draw a vertical and horizontal line...
Definition: mathplot.h:3614
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:3765
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:1172
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:2218
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:3522
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:884
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition: mathplot.h:2534
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:1900
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:3827
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:4281
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:3556
each visible plot is described on its own line, one above the other
Definition: mathplot.h:550
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:2881
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:981
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:3439
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:1201
__Info_Type
sub_type values for mpLAYER_INFO
Definition: mathplot.h:570
#define mpX_NORMAL
Set label for X axis in normal mode.
Definition: mathplot.h:2365
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:1836
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:4258
Show/Hide info coord.
Definition: mathplot.h:485
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:898
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:4150
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:3928
int m_last_ly
For double buffering.
Definition: mathplot.h:3752
struct deprecated("No more used, X and Y are now separated")]] mpFloatRect
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer t...
Definition: mathplot.h:341
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:3775
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:1105
Chart type layer.
Definition: mathplot.h:647
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:2342
enum __mp_Location_Type mpLocation
Location for the Info layer.
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:1132
Copy a screen shot to the clipboard.
Definition: mathplot.h:486
Fit view to match bounding box of all layers.
Definition: mathplot.h:479
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:3863
mpRange Get_BoundY(int yAxisID)
Get bounding box for Y axis of ID yAxisID.
Definition: mathplot.h:2872
bool PointIsInside(double px, double py) const
Is point inside this bounding box?
Definition: mathplot.h:448
Toggle fullscreen only if parent is a frame windows.
Definition: mathplot.h:492
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:3753
Center view on click position.
Definition: mathplot.h:482
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1430
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1772
__XAxis_Align_Type
Alignment for X axis.
Definition: mathplot.h:511
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:3979
__Text_Type
sub_type values for mpLAYER_TEXT
Definition: mathplot.h:579
mpRange desired
Desired range min and max.
Definition: mathplot.h:2551
mpAxisList m_AxisDataYList
List of axis data for the Y direction.
Definition: mathplot.h:3726
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1671
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
Definition: mathplot.h:4062
virtual bool IsLogAxis()
Logarithmic axis.
Definition: mathplot.h:2325
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1391
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:4316
int m_yAxisID
The ID of the Y axis used by the function. Equal 0 if no axis.
Definition: mathplot.h:1431
unsigned int m_labelType
Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
Definition: mathplot.h:2433
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1356
int m_extraMargin
Extra margin around the plot. Default 8.
Definition: mathplot.h:3743
Layer for bar chart.
Definition: mathplot.h:2014
#define mpX_USER
Set label user defined.
Definition: mathplot.h:2376
mpFloatRectSimple GetBoundingBox(bool desired, unsigned int yAxisID=0)
Return a bounding box for an y-axis ID.
Definition: mathplot.h:3191
double m_max
Min and max axis values when autosize is false.
Definition: mathplot.h:2344
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:992
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:1221
abstract Layer for chart (bar and pie).
Definition: mathplot.h:1956
Show legend items with symbol used with the referred mpLayer.
Definition: mathplot.h:544
Define a simple rectangular box X refer to X axis Y refer to Y axis.
Definition: mathplot.h:440
bool GetBoundingBox(mpRange *boundX, mpRange *boundY, int yAxisID)
Return the bounding box coordinates for the Y axis of ID yAxisID.
Definition: mathplot.h:3240
void SetPosY(const std::vector< double > &posYList)
Set current view's Y position and refresh display.
Definition: mathplot.h:2901
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:867
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:1112
double m_bbox_min_x
The precomputed bounding box:
Definition: mathplot.h:4072
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:3203
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition: mathplot.h:531
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1427
double GetDesiredYmin(int yAxisID)
Return the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exa...
Definition: mathplot.h:3222
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:3380
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:1792
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1429
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:4265
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:2271
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:1863
int GetMarginRight(bool minusExtra=false) const
Get the right margin.
Definition: mathplot.h:3365
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1489
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:1811
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:1820
double GetDesiredYmax(int yAxisID)
Return the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactl...
Definition: mathplot.h:3233
Text box type layer.
Definition: mathplot.h:630
mpMouseButtonAction GetMouseLeftDownAction()
Returns the type of action for the left mouse button.
Definition: mathplot.h:3637
double pos
Position.
Definition: mathplot.h:2549
void UpdateMargins()
Update margins if e.g.
Definition: mathplot.h:3334
__YAxis_Align_Type
Alignment for Y axis.
Definition: mathplot.h:521
wxRect m_PlotArea
The full size of the plot with m_extraMargin.
Definition: mathplot.h:3749
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:1047
Load a file.
Definition: mathplot.h:490
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:700
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:3877
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:3744
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:1074
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:709
Line (horizontal or vertical) type layer.
Definition: mathplot.h:645
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:3770
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:1156
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:3293
mpRange Get_BoundX(void) const
Get bounding box for X axis.
Definition: mathplot.h:2864
int m_scrY
Current view's Y dimension.
Definition: mathplot.h:3737
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:3015
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1363
mpAxisData m_AxisDataX
Axis data for the X direction.
Definition: mathplot.h:3725
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1256
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:1133
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:3731
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:3572
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:2942
int GetBarWidth(void) const
return the width of the bar
Definition: mathplot.h:1697
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:3541
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:1194
void SetAxisID(unsigned int yAxisID)
Set an ID to the axis.
Definition: mathplot.h:2197
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:1885
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:3473
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:3754
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1338
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1538
wxPoint GetCenter(void) const
Get the center of the pie chart.
Definition: mathplot.h:2098
mpTitle(const wxString &name)
Definition: mathplot.h:3907
void SetLabelMode(unsigned int mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:1186
Plot layer implementing a simple title.
Definition: mathplot.h:3898
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2460
enum __mp_Layer_ZOrder mpLayerZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:4015
bool ViewAsBar(void) const
return true if XY series is plotted with bar
Definition: mathplot.h:1705
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:1137
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:932
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:3448
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:2892
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:960
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:996
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:4067
int GetExtraMargin() const
Get the extra margin.
Definition: mathplot.h:3421
virtual void SetLabelFormat(const wxString &format)
Set axis Label format (used for mpX_NORMAL draw mode).
Definition: mathplot.h:2232
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:2263
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1663
enum __XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1426
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:3562
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:1828
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
Full constructor.
Definition: mathplot.h:2393
~mpChart()
Destructor.
Definition: mathplot.h:1963
Abstract class providing an horizontal line.
Definition: mathplot.h:1481
std::vector< double > m_mouseScaleYList
Store current Y-scales, used as reference during drag zooming.
Definition: mathplot.h:3761
Zoom into view at clickposition / window center.
Definition: mathplot.h:480
int GetMarginLeft(bool minusExtra=false) const
Get the left margin.
Definition: mathplot.h:3405
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:3730
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:4166
double scale
Scale.
Definition: mathplot.h:2548
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:1845
void SetPos(const double posX, const std::vector< double > &posYList)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:2987
Zoom out.
Definition: mathplot.h:481
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2168
enum __mp_Layer_Type mpLayerType
Major type of an mpLayer (detail is in subtype)
void SetFont(const wxFont &font)
Set layer font.
Definition: mathplot.h:827
Class for drawing mouse magnetization Draw an horizontal and a vertical line at the mouse position...
Definition: mathplot.h:2596
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:1832
__mp_Direction_Type
Direction for the Legend layer.
Definition: mathplot.h:548
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:4096
int GetMarginTop(bool minusExtra=false) const
Get the top margin.
Definition: mathplot.h:3348
double m_minX
Loaded at SetData.
Definition: mathplot.h:1840
mpInfoCoords * m_InfoCoords
pointer to the optional info coords layer
Definition: mathplot.h:3766
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:3212
Represents all the informations needed for plotting a layer in one direction (X or Y) This struct hol...
Definition: mathplot.h:2545
__mp_Style_Type
Style for the Legend layer.
Definition: mathplot.h:540
Layer for pie chart.
Definition: mathplot.h:2075
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:843
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:4102
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:835
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:3755
wxColour m_fontcolour
Layer's font foreground colour.
Definition: mathplot.h:991
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:4141
mpRange GetScale() const
Return m_min and m_max scale as a mpRange.
Definition: mathplot.h:2317
Bitmap type layer.
Definition: mathplot.h:631
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:1119
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:925
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:2204
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:717
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:946
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1399
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:3984
enum __mp_Delete_Action mpDeleteAction
Action to do with the object associated to the layer when we delete it.
Info box type layer.
Definition: mathplot.h:629
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:2977
virtual bool DoBeforePlot()
This is the only case where we don't need and Y axis So no need to test m_yAxisID.
Definition: mathplot.h:1524
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:760
Plot layer implementing a text string.
Definition: mathplot.h:3822
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:727
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:3745
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:4043
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:3479
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:912
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:993
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition: mathplot.h:3374
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:744
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:1135
int GetMarginBottom(bool minusExtra=false) const
Get the bottom margin.
Definition: mathplot.h:3388
Shows information about the mouse commands.
Definition: mathplot.h:491
void SetLogYaxis(int yAxisID, bool log)
Set the log property (true or false) for a Y layer (Y axis) given by is ID.
Definition: mathplot.h:3602
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:3340
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:2827
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:3732
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:3777
legend components follow each other horizontally on a single line
Definition: mathplot.h:551
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1273
enum __Text_Type mpTextType
sub_type values for mpLAYER_TEXT
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see above)...
Definition: mathplot.h:4123
int GetYAxisID() const
Get the ID of the Y axis used by the function.
Definition: mathplot.h:1412
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:3739
Represents a numeric range with minimum and maximum values.
Definition: mathplot.h:206
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:4052
double GetScaleY(int yAxisID)
Get current view's Y scale.
Definition: mathplot.h:2852
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:2119
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1370
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:4022
Plot layer, abstract base class.
Definition: mathplot.h:676
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:1000
double GetValue() const
Set x or y.
Definition: mathplot.h:1452
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:3870
void SetFactor(int factor)
Definition: mathplot.h:3954
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:811
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:988
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:2345
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition: mathplot.h:3736
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:891
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, std::optional< unsigned int > yAxisID=std::nullopt)
Full constructor.
Definition: mathplot.h:2467
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:819
virtual bool DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:1018
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:4161
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:3397
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:3724
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:2341
mpRect m_margin
Margin around the plot including Y-axis.
Definition: mathplot.h:3741
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1925
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:1126
mpMouseButtonAction m_mouseLeftDownAction
Type of action for left mouse button.
Definition: mathplot.h:3756
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:3748
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:939
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:2180
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:4029
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:3065
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:3136
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:2247
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2434
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1377
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:4222
void SetScaleY(const double scaleY, int yAxisID)
Set current view's Y scale and refresh display.
Definition: mathplot.h:2836
mpAxisUpdate
Define the axis we want to update.
Definition: mathplot.h:2570
Text box type layer.
Definition: mathplot.h:649
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2682
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:953
Line (horizontal or vertical) type layer.
Definition: mathplot.h:632
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:1878