14 #ifndef MATHPLOT_H_INCLUDED 15 #define MATHPLOT_H_INCLUDED 59 #ifdef mathplot_EXPORTS 60 #define WXDLLIMPEXP_MATHPLOT WXEXPORT 62 #define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type 64 #else // not making DLL 65 #define WXDLLIMPEXP_MATHPLOT 67 #define WXDLLIMPEXP_DATA_MATHPLOT(type) type 71 #if defined(__GNUG__) && !defined(__APPLE__) && !defined(__INTEL_CLANG_COMPILER) 72 #pragma interface "mathplot.h" 78 #include <unordered_map> 83 #if (defined(__cplusplus) && (__cplusplus > 201402L)) // C++17 or newer 86 typedef std::optional<unsigned int> mpOptional_uint;
87 typedef std::optional<int> mpOptional_int;
88 #define MP_OPTNULL_INT std::nullopt 89 #define MP_OPTTEST(opt) (opt) 90 #define MP_OPTGET(opt) (*opt) 92 #define MP_LOOP_ITER auto& [m_yID, m_yData] 96 typedef unsigned int mpOptional_uint;
97 typedef int mpOptional_int;
98 #define MP_OPTNULL_INT -1 99 #define MP_OPTTEST(opt) ((opt) != -1) 100 #define MP_OPTGET(opt) (opt) 102 #define MP_LOOP_ITER auto& elem 103 #define m_yID elem.first 104 #define m_yData elem.second 110 #include <wx/scrolwin.h> 111 #include <wx/event.h> 112 #include <wx/dynarray.h> 114 #include <wx/dcmemory.h> 115 #include <wx/string.h> 116 #include <wx/print.h> 117 #include <wx/image.h> 129 #if defined(MP_USER_INCLUDE) 130 #define header MP_USER_INCLUDE.h 132 #define str(x) xstr(x) 138 #ifdef ENABLE_MP_CONFIG 139 #include "MathPlotConfig.h" 140 #endif // ENABLE_MP_CONFIG 147 #ifdef ENABLE_MP_NAMESPACE 149 #endif // ENABLE_MP_NAMESPACE 151 #ifdef ENABLE_MP_DEBUG 156 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) 158 #define DEBUG_NEW new 161 #endif // ENABLE_MP_DEBUG 164 #define X_BORDER_SEPARATION 40 165 #define Y_BORDER_SEPARATION 60 168 #define mpX_LOCALTIME 0x10 170 #define mpX_UTCTIME 0x20 171 #define mpX_RAWTIME mpX_UTCTIME 176 #define ISNOTNULL(x) (fabs(x) > EPSILON) 180 #define EXTRA_MARGIN 8 183 #define ZOOM_AROUND_CENTER -1 216 #ifdef ENABLE_MP_CONFIG 218 #endif // ENABLE_MP_CONFIG 328 return ((min != 0) || (max != 0));
386 return (min + max) / 2;
392 return std::max(fabs(min), fabs(max));
398 min = (min > 0) ? log10(min) : 0;
399 max = (max > 0) ? log10(max) : 0;
405 return ((point >= min) && (point <= max));
408 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++20 or newer 409 bool operator==(
const mpRange&)
const =
default;
411 bool operator==(
const mpRange &other)
const 413 return (min == other.
min) && (max == other.
max);
415 bool operator!=(
const mpRange& other)
const 417 return !(*
this == other);
427 struct [[
deprecated("No more used, X and Y are now separated")]] mpFloatRect
430 std::vector<mpRange<double>> y;
441 mpFloatRect() =
delete;
449 bool PointIsInside(
double px,
double py,
size_t yAxisID = 0)
const {
450 if (yAxisID < y.size())
452 if( (px < x.min || px > x.max) ||
453 (py < y[yAxisID].min || py > y[yAxisID].max))
472 void UpdateBoundingBoxToInclude(
double px,
double py,
size_t yAxisID = 0) {
473 assert(yAxisID < y.size());
474 if (yAxisID < y.size())
476 if (px < x.min ) x.min = px;
477 else if (px > x.max ) x.max = px;
478 if (py < y[yAxisID].min ) y[yAxisID].min = py;
479 else if (py > y[yAxisID].max ) y[yAxisID].max = py;
489 void InitializeBoundingBox(
double px,
double py,
size_t yAxisID = 0) {
490 assert(yAxisID < y.size());
491 if (yAxisID < y.size())
494 y[yAxisID].min = y[yAxisID].max = py;
498 bool IsNotSet(
mpWindow& w)
const {
const mpFloatRect def(w);
return *
this==def; }
500 #if (defined(__cplusplus) && (__cplusplus > 201703L)) // C++ > C++17 (MSVC requires <AdditionalOptions>/Zc:__cplusplus</AdditionalOptions> 501 bool operator==(
const mpFloatRect&)
const =
default;
505 bool operator==(
const mpFloatRect& rect)
const 507 auto Same = [](
double a,
double b) {
508 return std::fabs(a - b) <
EPSILON;
512 if (!Same(x.min, rect.x.min) || !Same(x.max, rect.x.max))
518 if (y.size() != rect.y.size())
524 for (
size_t i = 0; i < y.size(); ++i)
526 if (!Same(y[i].min, rect.y[i].min) ||
527 !Same(y[i].max, rect.y[i].max) )
599 #ifdef ENABLE_MP_CONFIG 601 #endif // ENABLE_MP_CONFIG 825 mpLayer(mpLayerType layerType);
873 virtual bool IsLayerType(mpLayerType typeOfInterest,
int *subtype)
875 *subtype = m_subtype;
876 return (m_type == typeOfInterest);
991 m_fontcolour = colour;
1022 if (brush == wxNullBrush)
1023 m_brush = *wxTRANSPARENT_BRUSH;
1053 m_drawOutsideMargins = drawModeOutside;
1060 return m_drawOutsideMargins;
1067 wxBitmap GetColourSquare(
int side = 16);
1094 m_tractable = track;
1115 m_CanDelete = canDelete;
1152 void UpdateContext(wxDC &dc)
const;
1158 virtual void DoPlot(wxDC &dc,
mpWindow &w) = 0;
1175 void CheckLog(
double *x,
double *y,
int yAxisID);
1181 wxDECLARE_DYNAMIC_CLASS(
mpLayer);
1210 virtual void SetVisible(
bool show);
1216 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
1228 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
1233 virtual bool Inside(
const wxPoint &point);
1237 virtual void Move(wxPoint delta);
1240 virtual void UpdateReference();
1246 return m_dim.GetPosition();
1253 return m_dim.GetSize();
1267 m_location = location;
1289 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1293 void SetInfoRectangle(
mpWindow &w,
int width = 0,
int height = 0);
1326 virtual void UpdateInfo(
mpWindow &w, wxEvent &event);
1328 virtual void ErasePlot(wxDC &dc,
mpWindow &w);
1336 m_timeConv = time_conv;
1343 m_series_coord = show;
1350 return m_series_coord;
1358 virtual wxString GetInfoCoordsText(
mpWindow &w,
double xVal, std::unordered_map<int, double> yValList);
1370 unsigned int m_timeConv;
1373 bool m_series_coord;
1380 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1410 m_needs_update =
true;
1413 mpLegendStyle GetItemMode()
const 1422 m_item_direction = mode;
1423 m_needs_update =
true;
1426 mpLegendDirection GetItemDirection()
const 1428 return m_item_direction;
1431 void SetNeedUpdate()
1433 m_needs_update =
true;
1437 int GetPointed(
mpWindow &w, wxPoint eventPoint);
1440 mpLegendStyle m_item_mode;
1441 mpLegendDirection m_item_direction;
1447 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1453 unsigned int layerIdx;
1457 std::vector<LegendDetail> m_LegendDetailList;
1458 bool m_needs_update;
1469 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1493 mpFunction(mpLayerType layerType =
mpLAYER_PLOT,
const wxString &name = wxEmptyString,
unsigned int yAxisID = 0);
1500 m_continuous = continuity;
1508 return m_continuous;
1543 m_symbolSize = size;
1544 m_symbolSize2 = size / 2;
1551 return m_symbolSize;
1557 virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y);
1572 m_yAxisID = yAxisID;
1597 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1626 return m_IsHorizontal;
1633 wxDECLARE_DYNAMIC_CLASS(
mpLine);
1647 mpHorizontalLine(
double yvalue,
const wxPen &pen = *wxGREEN_PEN,
unsigned int yAxisID = 0);
1659 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1686 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1713 mpFX(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_RIGHT,
unsigned int yAxisID = 0);
1720 virtual double GetY(
double x) = 0;
1728 double DoGetY(
double x);
1734 void DefineDoGetY(
void);
1739 double (
mpFX::*pDoGetY)(
double x);
1745 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1751 double NormalDoGetY(
double x);
1757 double LogDoGetY(
double x);
1759 wxDECLARE_DYNAMIC_CLASS(
mpFX);
1775 mpFY(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_TOP,
unsigned int yAxisID = 0);
1782 virtual double GetX(
double y) = 0;
1790 double DoGetX(
double y);
1796 void DefineDoGetX(
void);
1801 double (
mpFY::*pDoGetX)(
double y);
1807 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1813 double NormalDoGetX(
double y);
1819 double LogDoGetX(
double y);
1821 wxDECLARE_DYNAMIC_CLASS(
mpFY);
1841 mpFXY(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_SW,
bool viewAsBar =
false,
unsigned int yAxisID = 0);
1846 virtual void Rewind() = 0;
1870 virtual bool GetNextXY(
double *x,
double *y) = 0;
1878 bool DoGetNextXY(
double *x,
double *y);
1884 void SetViewMode(
bool asBar);
1918 bool m_ViewAsBar =
false;
1926 virtual void DoPlot(wxDC &dc,
mpWindow &w);
1932 void UpdateViewBoundary(wxCoord xnew, wxCoord ynew);
1934 wxDECLARE_DYNAMIC_CLASS(
mpFXY);
1968 mpFXYVector(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_SW,
bool viewAsBar =
false,
unsigned int yAxisID = 0);
1981 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
2004 bool AddData(
const double x,
const double y,
bool updatePlot);
2014 m_reserveXY = reserve;
2015 m_xs.reserve(m_reserveXY);
2016 m_ys.reserve(m_reserveXY);
2060 virtual bool GetNextXY(
double *x,
double *y);
2066 void DrawAddedPoint(
double x,
double y);
2075 return m_rangeX.
min - (m_deltaX / 2);
2079 return m_rangeX.
min;
2087 return m_rangeY.
min;
2097 return m_rangeX.
max + (m_deltaX / 2);
2101 return m_rangeX.
max;
2109 return m_rangeY.
max;
2115 void First_Point(
double x,
double y);
2119 void Check_Limit(
double val,
mpRange<double> *range,
double *last,
double *delta);
2145 virtual double GetY(
double x) = 0;
2153 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2167 mpChart(
const wxString &name = wxEmptyString);
2177 void SetChartValues(
const std::vector<double> &data);
2181 void SetChartLabels(
const std::vector<std::string> &labelArray);
2187 void AddData(
const double &data,
const std::string &label);
2192 virtual void Clear();
2196 return (values.size() > 0);
2206 wxDECLARE_DYNAMIC_CLASS(
mpChart);
2213 #define mpBAR_NONE 0 2214 #define mpBAR_AXIS_H 1 2215 #define mpBAR_AXIS_V 2 2216 #define mpBAR_INSIDE 3 2225 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
2233 void SetBarColour(
const wxColour &colour);
2235 void SetColumnWidth(
const double colWidth)
2241 void SetBarLabelPosition(
int position);
2246 virtual double GetMinX();
2251 virtual double GetMaxX();
2256 virtual double GetMinY();
2261 virtual double GetMaxY();
2266 wxColour m_barColour;
2268 double m_labelAngle;
2274 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2288 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
2316 void SetPieColours(
const std::vector<wxColour> &colourArray);
2323 return m_center.x - m_radius;
2331 return m_center.x + m_radius;
2339 return m_center.y - m_radius;
2347 return m_center.y + m_radius;
2354 std::vector<wxColour> colours;
2360 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2362 const wxColour& GetColour(
unsigned int id);
2449 m_labelFormat = format;
2450 if (updateLabelMode)
2467 m_timeConv = time_conv;
2474 return m_labelFormat;
2498 m_auto = automaticScalingIsEnabled;
2514 m_axisRange.SetMin(min);
2522 return m_axisRange.min;
2530 m_axisRange.SetMax(max);
2538 return m_axisRange.max;
2547 m_axisRange.Set(min, max);
2556 *min = m_axisRange.min;
2557 *max = m_axisRange.max;
2565 m_axisRange = range;
2593 static const wxCoord kTickSize = 4;
2594 static const wxCoord kAxisExtraSpace = 6;
2609 virtual int GetOrigin(
mpWindow &w) = 0;
2617 double GetStep(
double scale,
int minLabelSpacing);
2626 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize) = 0;
2634 wxString FormatLabelValue(
double value,
double maxAxisValue,
double step);
2640 wxString FormatLogValue(
double n);
2649 int GetLabelWidth(
double value, wxDC &dc,
double maxAxisValue,
double step);
2655 bool UseScientific(
double maxAxisValue);
2662 int GetSignificantDigits(
double step,
double maxAxisValue);
2668 int GetDecimalDigits(
double step);
2670 wxDECLARE_DYNAMIC_CLASS(
mpScale);
2688 mpScale(name, flags, grids, type)
2707 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2709 virtual int GetOrigin(
mpWindow &w);
2710 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2732 mpScale(name, flags, grids, labelType, yAxisID)
2735 m_axisWidth = Y_BORDER_SEPARATION;
2758 bool IsInside(wxCoord xPixel)
2760 if ( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
2773 virtual void DoPlot(wxDC &dc,
mpWindow &w);
2775 virtual int GetOrigin(
mpWindow &w);
2776 virtual void DrawScaleName(wxDC &dc,
mpWindow &w,
int origin,
int labelSize);
2789 #define mpMOUSEMODE_DRAG 0 2791 #define mpMOUSEMODE_ZOOMBOX 1 2817 bool operator==(
const mpAxisData& other)
const 2819 return (scale == other.
scale) && (pos == other.
pos) &&
2848 typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)>
mpOnDeleteLayer;
2868 m_rightClick =
false;
2869 m_IsWasDrawn =
false;
2875 void UpdateBox(wxCoord left, wxCoord top, wxCoord width, wxCoord height)
2877 m_domain = wxRect(left, top, width, height);
2878 m_plot_size = wxRect(left, top, width + left, height + top);
2880 void UpdateBox(
const wxRect &size)
2883 m_plot_size = wxRect(size.GetLeft(), size.GetTop(),
2884 size.GetWidth() + size.GetLeft(), size.GetHeight() + size.GetTop());
2886 void Plot(wxClientDC &dc,
const wxPoint &mousePos);
2887 void ClearPlot(wxClientDC &dc);
2888 void UpdatePlot(wxClientDC &dc,
const wxPoint &mousePos);
2889 void SaveDrawState(
void)
2891 m_IsWasDrawn = m_IsDrawn;
2896 void SetRightClick(
void)
2898 m_rightClick =
true;
2904 wxPoint m_mousePosition;
2908 void DrawCross(wxClientDC &dc)
const;
2940 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
2961 bool AddLayer(
mpLayer *layer,
bool refreshDisplay =
true,
bool refreshConfig =
true);
2975 bool DelLayer(
mpLayer *layer, mpDeleteAction alsoDeleteObject,
bool refreshDisplay =
true,
bool refreshConfig =
true);
2982 void DelAllLayers(mpDeleteAction alsoDeleteObject,
bool refreshDisplay =
true);
2990 void DelAllPlot(mpDeleteAction alsoDeleteObject, mpFunctionType func =
mpfAllType,
bool refreshDisplay =
true);
2998 void DelAllYAxisAfterID(mpDeleteAction alsoDeleteObject,
int yAxisID = 0,
bool refreshDisplay =
true);
3005 mpLayer* GetLayer(
int position);
3011 int GetLayerPosition(
mpLayer* layer);
3019 mpLayer* GetLayersType(
int position, mpLayerType type);
3044 mpFXYVector* GetXYSeries(
unsigned int n,
const wxString &name = _T(
"Serie "),
bool create =
true);
3054 mpLayer* GetClosestPlot(wxCoord ix, wxCoord iy,
double *xnear,
double *ynear);
3060 mpLayer* GetLayerByName(
const wxString &name);
3066 mpLayer* GetLayerByClassName(
const wxString &name);
3071 void RefreshLegend(
void);
3077 bool IsYAxisUsed(
int yAxisID);
3087 mpScaleY* GetLayerYAxis(
int yAxisID);
3096 m_AxisDataX.scale = scaleX;
3097 UpdateDesiredBoundingBox(uXAxis);
3108 return m_AxisDataX.scale;
3117 assert(m_AxisDataYList.count(yAxisID) != 0);
3120 m_AxisDataYList[yAxisID].scale = scaleY;
3121 UpdateDesiredBoundingBox(uYAxis);
3133 assert(m_AxisDataYList.count(yAxisID) != 0);
3134 return m_AxisDataYList[yAxisID].scale;
3137 [[
deprecated(
"Incomplete, use UpdateBBox instead")]]
3145 return m_AxisDataX.bound;
3151 return m_AxisDataX.desired;
3159 assert(m_AxisDataYList.count(yAxisID) != 0);
3160 return m_AxisDataYList[yAxisID].bound;
3168 assert(m_AxisDataYList.count(yAxisID) != 0);
3169 return m_AxisDataYList[yAxisID].desired;
3178 std::unordered_map<int, mpRange<double>> yRange;
3179 for (
const MP_LOOP_ITER : m_AxisDataYList)
3181 yRange[m_yID] = m_yData.bound;
3192 std::unordered_map<int, mpRange<double>> yRange;
3193 for (
const MP_LOOP_ITER : m_AxisDataYList)
3195 yRange[m_yID] = m_yData.desired;
3205 m_AxisDataX.pos = posX;
3206 UpdateDesiredBoundingBox(uXAxis);
3216 return m_AxisDataX.pos;
3223 void SetPosY(std::unordered_map<int, double>& posYList)
3225 for (MP_LOOP_ITER : m_AxisDataYList)
3227 m_yData.pos = posYList[m_yID];
3229 UpdateDesiredBoundingBox(uYAxis);
3240 assert(m_AxisDataYList.count(yAxisID) != 0);
3241 return m_AxisDataYList[yAxisID].pos;
3249 return (
int)m_AxisDataYList.size();
3257 return m_AxisDataYList;
3265 return std::map<int, mpAxisData>(m_AxisDataYList.begin(), m_AxisDataYList.end());
3277 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
3278 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
3280 m_plotBoundaries.endPx = m_scrX;
3281 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
3282 m_plotBoundaries.endPy = m_scrY;
3283 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
3285 m_PlotArea = wxRect(m_margin.left - m_extraMargin, m_margin.top - m_extraMargin,
3286 m_plotWidth + 2*m_extraMargin, m_plotHeight + 2*m_extraMargin);
3288 m_magnet.UpdateBox(m_PlotArea);
3318 void SetPos(
const double posX, std::unordered_map<int, double>& posYList)
3320 m_AxisDataX.pos = posX;
3327 inline double p2x(
const wxCoord pixelCoordX)
const 3329 return m_AxisDataX.pos + (pixelCoordX / m_AxisDataX.scale);
3335 inline double p2y(
const wxCoord pixelCoordY,
int yAxisID = 0)
3337 assert(m_AxisDataYList.count(yAxisID) != 0);
3338 if (m_AxisDataYList.count(yAxisID) == 0)
3340 return m_AxisDataYList[yAxisID].pos - (pixelCoordY / m_AxisDataYList[yAxisID].scale);
3346 inline wxCoord
x2p(
const double x)
const 3348 return (wxCoord)((x - m_AxisDataX.pos) * m_AxisDataX.scale);
3354 inline wxCoord
y2p(
const double y,
int yAxisID = 0)
3356 assert(m_AxisDataYList.count(yAxisID) != 0);
3357 if (m_AxisDataYList.count(yAxisID) == 0)
3359 return (wxCoord)((m_AxisDataYList[yAxisID].pos - y) * m_AxisDataYList[yAxisID].scale);
3366 m_enableDoubleBuffer = enabled;
3373 m_enableMouseNavigation = enabled;
3381 void LockAspect(
bool enable =
true);
3389 return m_lockaspect;
3398 return m_repainting;
3413 void Fit(
const mpRange<double> &rangeX, std::unordered_map<
int,
mpRange<double>> rangeY, wxCoord *printSizeX = NULL, wxCoord *printSizeY = NULL);
3424 void FitY(
int yAxisID);
3430 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
3436 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
3446 void ZoomInY(mpOptional_int yAxisID = MP_OPTNULL_INT);
3450 void ZoomOutY(mpOptional_int yAxisID = MP_OPTNULL_INT);
3456 void ZoomRect(wxPoint p0, wxPoint p1);
3466 unsigned int CountLayers();
3472 return (
unsigned int)m_layers.size();
3478 unsigned int CountLayersType(mpLayerType type);
3483 unsigned int CountLayersFXYPlot();
3495 if (update & uXAxis)
3497 m_AxisDataX.desired.Set(m_AxisDataX.pos + (m_margin.left / m_AxisDataX.scale),
3498 m_AxisDataX.pos + ((m_margin.left + m_plotWidth) / m_AxisDataX.scale));
3502 if (update & uYAxis)
3504 for (MP_LOOP_ITER : m_AxisDataYList)
3506 m_yData.desired.Set(m_yData.pos - ((m_margin.top + m_plotHeight) / m_yData.scale),
3507 m_yData.pos - (m_margin.top / m_yData.scale));
3519 assert(m_AxisDataYList.count(yAxisID) != 0);
3521 return mpFloatRectSimple(m_AxisDataX.desired, m_AxisDataYList[yAxisID].desired);
3531 return m_AxisDataX.desired.min;
3540 return m_AxisDataX.desired.max;
3550 assert(m_AxisDataYList.count(yAxisID) != 0);
3551 return m_AxisDataYList[yAxisID].desired.min;
3561 assert(m_AxisDataYList.count(yAxisID) != 0);
3562 return m_AxisDataYList[yAxisID].desired.max;
3568 if (m_AxisDataYList.count(yAxisID) == 0)
3570 *boundX = m_AxisDataX.bound;
3571 *boundY = m_AxisDataYList[yAxisID].bound;
3576 bool PointIsInsideBound(
double px,
double py,
int yAxisID)
3578 if (m_AxisDataYList.count(yAxisID) == 0)
3581 return m_AxisDataX.bound.
PointIsInside(px) && GetBoundY(yAxisID).PointIsInside(py);
3590 void UpdateBoundingBoxToInclude(
double px,
double py,
int yAxisID)
3592 if (m_AxisDataYList.count(yAxisID) == 0)
3595 m_AxisDataX.bound.Update(px);
3596 m_AxisDataYList[yAxisID].bound.Update(py);
3604 void InitializeBoundingBox(
double px,
double py,
int yAxisID)
3606 if (m_AxisDataYList.count(yAxisID) == 0)
3609 m_AxisDataX.bound.Set(px, px);
3610 m_AxisDataYList[yAxisID].bound.Set(py, py);
3615 void SetMPScrollbars(
bool status);
3621 return m_enableScrollBars;
3629 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
3634 wxBitmap* BitmapScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
3639 void ClipboardScreenshot(wxSize imageSize = wxDefaultSize,
bool fit =
false);
3646 m_wildcard = wildcard;
3664 bool LoadFile(
const wxString &filename = wxEmptyString);
3672 m_DefaultDir = dirname;
3685 void SetMargins(
int top,
int right,
int bottom,
int left);
3690 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3696 SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3705 return m_margin.top - m_extraMargin;
3707 return m_margin.top;
3713 SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
3722 return m_margin.right - m_extraMargin;
3724 return m_margin.right;
3730 return m_marginOuter.right;
3736 SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
3745 return m_margin.bottom - m_extraMargin;
3747 return m_margin.bottom;
3753 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
3762 return m_margin.left - m_extraMargin;
3764 return m_margin.left;
3770 m_extraMargin = extra;
3771 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
3777 return m_extraMargin;
3783 return m_marginOuter.left;
3795 return m_plotHeight;
3806 bond = m_plotBoundariesMargin;
3808 bond = m_plotBoundaries;
3809 bond.startPx -= m_extraMargin;
3810 bond.endPx += m_extraMargin;
3811 bond.startPy -= m_extraMargin;
3812 bond.endPy += m_extraMargin;
3819 int GetLeftYAxesWidth(mpOptional_int yAxisID = MP_OPTNULL_INT);
3824 int GetRightYAxesWidth(mpOptional_int yAxisID = MP_OPTNULL_INT);
3829 m_drawBox = drawbox;
3841 mpOptional_int IsInsideYAxis(
const wxPoint &point);
3846 mpInfoLayer* IsInsideInfoLayer(
const wxPoint &point);
3851 void SetLayerVisible(
const wxString &name,
bool viewable);
3856 bool IsLayerVisible(
const wxString &name);
3861 bool IsLayerVisible(
const unsigned int position);
3866 void SetLayerVisible(
const unsigned int position,
bool viewable);
3872 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
3881 const wxColour& GetbgColour()
const 3886 void SetbgColour(
const wxColour &colour)
3888 m_bgColour = colour;
3898 m_OnDeleteLayer = event;
3904 m_OnDeleteLayer = NULL;
3913 m_OnUserMouseAction = userMouseEventHandler;
3919 m_OnUserMouseAction = NULL;
3929 if (m_AxisDataX.axis)
3930 return ((
mpScaleX *)m_AxisDataX.axis)->IsLogAxis();
3940 assert(m_AxisDataYList.count(yAxisID) != 0);
3941 mpScaleY* yAxis = GetLayerYAxis(yAxisID);
3943 return yAxis->IsLogAxis();
3948 void SetLogXaxis(
bool log)
3950 if (m_AxisDataX.axis)
3951 ((
mpScaleX *)m_AxisDataX.axis)->SetLogAxis(log);
3959 mpScaleY* yAxis = GetLayerYAxis(yAxisID);
3974 void SetMagnetize(
bool mag)
3985 m_mouseLeftDownAction = action;
3994 return m_mouseLeftDownAction;
3997 #ifdef ENABLE_MP_CONFIG 3998 void RefreshConfigWindow();
4004 void DeleteConfigWindow(
void);
4005 #endif // ENABLE_MP_CONFIG 4008 virtual void BindEvents(
void);
4009 virtual void OnPaint(wxPaintEvent &event);
4010 virtual void OnSize(wxSizeEvent &event);
4011 virtual void OnShowPopupMenu(wxMouseEvent &event);
4012 virtual void OnCenter(wxCommandEvent &event);
4013 virtual void OnFit(wxCommandEvent &event);
4014 virtual void OnToggleGrids(wxCommandEvent &event);
4015 virtual void OnToggleCoords(wxCommandEvent &event);
4016 virtual void OnScreenShot(wxCommandEvent &event);
4017 virtual void OnFullScreen(wxCommandEvent &event);
4018 #ifdef ENABLE_MP_CONFIG 4019 virtual void OnConfiguration(wxCommandEvent &event);
4020 #endif // ENABLE_MP_CONFIG 4021 virtual void OnLoadFile(wxCommandEvent &event);
4022 virtual void OnZoomIn(wxCommandEvent &event);
4023 virtual void OnZoomOut(wxCommandEvent &event);
4024 virtual void OnLockAspect(wxCommandEvent &event);
4025 virtual void OnMouseHelp(wxCommandEvent &event);
4026 virtual void OnMouseLeftDown(wxMouseEvent &event);
4027 virtual void OnMouseRightDown(wxMouseEvent &event);
4028 virtual void OnMouseMove(wxMouseEvent &event);
4029 virtual void OnMouseLeftRelease(wxMouseEvent &event);
4030 virtual void OnMouseWheel(wxMouseEvent &event);
4031 virtual void OnMouseLeave(wxMouseEvent &event);
4032 bool CheckUserMouseAction(wxMouseEvent &event);
4033 virtual void OnScrollThumbTrack(wxScrollWinEvent &event);
4034 virtual void OnScrollPageUp(wxScrollWinEvent &event);
4035 virtual void OnScrollPageDown(wxScrollWinEvent &event);
4036 virtual void OnScrollLineUp(wxScrollWinEvent &event);
4037 virtual void OnScrollLineDown(wxScrollWinEvent &event);
4038 virtual void OnScrollTop(wxScrollWinEvent &event);
4039 virtual void OnScrollBottom(wxScrollWinEvent &event);
4041 void DoScrollCalc(
const int position,
const int orientation);
4055 void DoZoomYCalc(
bool zoomIn, wxCoord staticYpixel =
ZOOM_AROUND_CENTER, mpOptional_int yAxisID = MP_OPTNULL_INT);
4061 void SetScaleXAndCenter(
double scaleX);
4068 void SetScaleYAndCenter(
double scaleY,
int yAxisID);
4074 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
4078 virtual bool UpdateBBox();
4083 void InitParameters();
4143 #ifdef ENABLE_MP_CONFIG 4145 #endif // ENABLE_MP_CONFIG 4147 mpOnDeleteLayer m_OnDeleteLayer = NULL;
4148 mpOnUserMouseAction m_OnUserMouseAction = NULL;
4157 void CheckAndReportDesiredBoundsChanges();
4163 unsigned int GetNewAxisDataID(
void)
4166 for (
const MP_LOOP_ITER : m_AxisDataYList)
4171 newID = std::max(newID, m_yID + 1);
4212 mpText(
const wxString &name,
int offsetx,
int offsety);
4217 mpText(
const wxString &name, mpLocation marginLocation);
4230 m_location = location;
4262 virtual void DoPlot(wxDC &dc,
mpWindow &w);
4264 wxDECLARE_DYNAMIC_CLASS(
mpText);
4283 SetPen(*wxWHITE_PEN);
4284 SetBrush(*wxWHITE_BRUSH);
4289 wxDECLARE_DYNAMIC_CLASS(
mpTitle);
4310 mpPrintout(
mpWindow *drawWindow,
const wxString &title = _T(
"wxMathPlot print output"),
int factor = 2);
4316 void SetDrawState(
bool drawState)
4321 bool OnPrintPage(
int page);
4322 bool HasPage(
int page);
4328 stretch_factor = factor;
4357 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
4371 phi = m_reference_phi;
4380 m_reference_phi = phi;
4387 return m_trans_shape_xs.size() != 0;
4394 return m_bbox_x.min;
4401 return m_bbox_x.max;
4408 return m_bbox_y.min;
4415 return m_bbox_y.max;
4424 virtual void DoPlot(wxDC &dc,
mpWindow &w);
4428 void TranslatePoint(
double x,
double y,
double &out_x,
double &out_y)
const;
4448 void ShapeUpdated();
4473 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
4475 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
4477 m_continuous =
true;
4487 double GetQuantiles()
const 4500 void SetSegments(
int segments)
4502 m_segments = segments;
4505 int GetSegments()
const 4541 void RecalculateShape();
4560 m_continuous =
true;
4574 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
4596 m_bitmapChanged =
false;
4597 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
4607 void GetBitmapCopy(wxImage &outBmp)
const;
4616 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
4622 return m_bitmapX.min;
4629 return m_bitmapX.max;
4636 return m_bitmapY.min;
4643 return m_bitmapY.max;
4651 wxBitmap m_scaledBitmap;
4652 wxCoord m_scaledBitmap_offset_x, m_scaledBitmap_offset_y;
4654 bool m_bitmapChanged;
4661 virtual void DoPlot(wxDC &dc,
mpWindow &w);
4698 this->Set(0, 0, 255);
4701 this->Set(255, 0, 0);
4704 this->Set(0, 128, 0);
4707 this->Set(128, 0, 128);
4710 this->Set(255, 255, 0);
4713 this->Set(255, 0, 255);
4716 this->Set(0, 255, 0);
4719 this->Set(0, 255, 255);
4722 this->Set(128, 128, 0);
4725 this->Set((ChannelType)((rand() * 255) / RAND_MAX), (ChannelType)((rand() * 255) / RAND_MAX),
4726 (ChannelType)((rand() * 255) / RAND_MAX));
4734 #ifdef ENABLE_MP_NAMESPACE 4737 #endif // ENABLE_MP_NAMESPACE 4739 #endif // MATHPLOT_H_INCLUDED sub type for mpFXYVector function
Definition: mathplot.h:706
int m_offsety
Holds offset for Y in percentage.
Definition: mathplot.h:4257
const wxString & GetLabelFormat() const
Get axis Label format (used for mpLabel_AUTO draw mode).
Definition: mathplot.h:2472
std::function< void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer
Define an event for when we delete a layer.
Definition: mathplot.h:2848
bool IsHorizontal(void) const
Is it a horizontal line?
Definition: mathplot.h:1624
__mp_Location_Type
Location for the Info layer.
Definition: mathplot.h:608
int GetAxisID(void)
Return the ID of the Axis.
Definition: mathplot.h:2401
sub type for mpText layer
Definition: mathplot.h:695
Align the plot label towards the southeast.
Definition: mathplot.h:647
void SetValue(const double value)
Set x or y value.
Definition: mathplot.h:1616
mpInfoLegend * m_InfoLegend
Pointer to the optional info legend layer.
Definition: mathplot.h:4129
Draw a circle.
Definition: mathplot.h:670
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:655
mpRect m_marginOuter
Margin around the plot exluding Y-axis. Default 50.
Definition: mathplot.h:4105
bool m_isLog
Is the axis a log axis ?
Definition: mathplot.h:2605
void EnableDoubleBuffer(const bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled).
Definition: mathplot.h:3364
wxIndexColour(unsigned int id)
Constructor.
Definition: mathplot.h:4693
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition: mathplot.h:1020
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:3938
std::vector< std::string > labels
Labels of the Values.
Definition: mathplot.h:2201
enum __mp_Colour mpColour
Enumeration of classic colour.
Bitmap type layer.
Definition: mathplot.h:785
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition: mathplot.h:1141
__Scale_Type
sub_type values for mpLAYER_AXIS
Definition: mathplot.h:713
Plot type layer.
Definition: mathplot.h:770
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:3297
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:4641
void SetLabelMode(mpLabelType mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition: mathplot.h:1333
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition: mathplot.h:3902
void SetXValue(const double xvalue)
Set x.
Definition: mathplot.h:1679
void SetYAxisID(unsigned int yAxisID)
Set the ID of the Y axis used by the function.
Definition: mathplot.h:1570
An arbitrary polygon, descendant of mpMovableObject.
Definition: mathplot.h:4553
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition: mathplot.h:3092
mpFloatRectSimple(mpRange< double > _x, mpRange< double > _y)
Construct a simple rectangular box.
Definition: mathplot.h:553
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:898
__Symbol_Type
Displaying a symbol instead of a point in the plot function.
Definition: mathplot.h:667
double m_deltaY
Min delta between 2 consecutive coordinate on y direction.
Definition: mathplot.h:1912
A rectangle structure in several (integer) flavors.
Definition: mathplot.h:221
A class providing graphs functionality for a 2D plot (either continuous or a set of points)...
Definition: mathplot.h:1960
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition: mathplot.h:4101
Show legend items with line with the same pen of referred mpLayer.
Definition: mathplot.h:654
__mp_Layer_Type
< Major type of an mpLayer (detail is in subtype)
Definition: mathplot.h:766
Show/Hide grids.
Definition: mathplot.h:596
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition: mathplot.h:4588
int m_axisID
Unique ID that identify this axis. Default -1 mean that axis is not used.
Definition: mathplot.h:2596
bool m_magnetize
For mouse magnetization.
Definition: mathplot.h:4135
mpLabelType
enum for label for grid
Definition: mathplot.h:738
void Update(T value)
Update range according new value: Expand the range to include the value.
Definition: mathplot.h:335
bool m_mouseMovedAfterRightClick
If the mouse does not move after a right click, then the context menu is displayed.
Definition: mathplot.h:4120
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:2337
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition: mathplot.h:4121
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:2321
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition: mathplot.h:4558
double m_lastX
Last x-coordinate point added.
Definition: mathplot.h:2042
bool GetShowGrids() const
Get axis grids.
Definition: mathplot.h:2438
std::unordered_map< int, mpAxisData > mpAxisList
Define the type for the list of axis.
Definition: mathplot.h:2825
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:3354
enum __Plot_Align_Name_Type mpPlot_Align
Plot alignment (which corner should plot be placed)
mpRange< double > m_bitmapX
The shape of the bitmap:
Definition: mathplot.h:4658
Layer type undefined; SHOULD NOT BE USED.
Definition: mathplot.h:768
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:801
sub type not defined (should be never used)
Definition: mathplot.h:715
wxString m_name
Layer's name.
Definition: mathplot.h:1140
const mpLayerType m_type
Layer type mpLAYER_*.
Definition: mathplot.h:1133
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition: mathplot.h:1600
Lock x/y scaling aspect.
Definition: mathplot.h:595
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:1407
wxString m_wildcard
For loadfile() function when we use wxFileDialog.
Definition: mathplot.h:4140
Align the info in margin center-bottom.
Definition: mathplot.h:616
Info box type layer.
Definition: mathplot.h:790
int m_offsetx
Holds offset for X in percentage.
Definition: mathplot.h:4256
void SetLabelMode(mpLabelType mode, unsigned int time_conv=0x20)
Set axis label view mode.
Definition: mathplot.h:2464
Abstract class providing a line.
Definition: mathplot.h:1588
mpRange< double > m_rangeX
Range min and max on x axis.
Definition: mathplot.h:2041
Abstract class providing an vertical line.
Definition: mathplot.h:1666
bool GetShowTicks() const
Get axis ticks.
Definition: mathplot.h:2424
void SetCenter(const wxPoint center)
Set the center of the pie chart.
Definition: mathplot.h:2300
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:2932
mpRange< int > m_drawY
Range min and max on y axis.
Definition: mathplot.h:1908
wxString m_DefaultDir
The default directory for wxFileDialog.
Definition: mathplot.h:4141
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:2597
int GetNOfYAxis(void) const
Get the number of Y axis.
Definition: mathplot.h:3247
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:3335
std::vector< double > m_ys
internal copy of the set of data on y direction
Definition: mathplot.h:2031
void SetExtraMargin(int extra)
Set the extra margin.
Definition: mathplot.h:3768
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, mpOptional_uint yAxisID=-1, mpLabelType labelType=mpLabel_AUTO)
Full constructor.
Definition: mathplot.h:2731
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition: mathplot.h:1280
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition: mathplot.h:4376
Chart type layer (bar chart)
Definition: mathplot.h:775
mpRange< double > x
range over x direction
Definition: mathplot.h:545
double GetPosY(int yAxisID)
Get current view's Y position.
Definition: mathplot.h:3238
virtual void SetLogAxis(bool log)
Set Logarithmic mode.
Definition: mathplot.h:2587
sub type for mpLine function
Definition: mathplot.h:708
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition: mathplot.h:997
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition: mathplot.h:3387
int m_winY
Holds the mpWindow size. Used to rescale position when window is resized.
Definition: mathplot.h:1282
~mpBarChart()
Destructor.
Definition: mathplot.h:2228
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:3327
T GetMaxAbs(void) const
Returns max absolute value of the range.
Definition: mathplot.h:390
Draw a cross X.
Definition: mathplot.h:674
void Update(mpRange range)
Update range with new range values if this expand the range.
Definition: mathplot.h:357
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition: mathplot.h:1148
Draw a triangle up oriented.
Definition: mathplot.h:672
wxTopLevelWindow * m_parent
Pointer to the top-level window containing the plot (used for fullscreen)
Definition: mathplot.h:4085
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition: mathplot.h:4122
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition: mathplot.h:4153
T min
The min value of the range.
Definition: mathplot.h:255
bool m_InInfoLegend
Boolean value indicating that the mouse is moving over the legend area.
Definition: mathplot.h:4130
void SetPen(const wxPen &pen)
Set layer pen.
Definition: mathplot.h:1005
No alignment.
Definition: mathplot.h:618
int m_flags
Holds label alignment. Default : mpALIGN_SW for series and mpALIGN_CENTER for scale.
Definition: mathplot.h:1145
mpRange< double > m_bbox_x
The precomputed bounding box:
Definition: mathplot.h:4442
virtual bool HasBBox()
Text Layer has not bounding box.
Definition: mathplot.h:4221
Mouse action drag the plot.
Definition: mathplot.h:734
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:882
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
Definition: mathplot.h:1244
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition: mathplot.h:1362
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:1051
~mpPieChart()
Destructor.
Definition: mathplot.h:2291
mpRange()
Default constructor.
Definition: mathplot.h:259
T max
The max value of the range.
Definition: mathplot.h:256
sub type not defined (should be never used)
Definition: mathplot.h:724
int m_symbolSize
Size of the symbol. Default 6.
Definition: mathplot.h:1578
void SetDefaultDir(const wxString &dirname)
Set the default directory for wxFileDialog.
Definition: mathplot.h:3670
enum __Function_Type mpFunctionType
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
sub type not defined (should be never used)
Definition: mathplot.h:702
void Check(void)
Check to always have a range. If min = max then introduce the 0 to make a range.
Definition: mathplot.h:366
int GetPlotWidth() const
Get the width of the plot.
Definition: mathplot.h:3787
sub type not defined (should be never used)
Definition: mathplot.h:694
double m_lastY
Last y-coordinate point added.
Definition: mathplot.h:2044
int m_subtype
Layer sub type, set in constructors.
Definition: mathplot.h:1135
T GetCenter(void) const
Center of the range.
Definition: mathplot.h:384
Just the end of ZOrder.
Definition: mathplot.h:792
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:4406
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
Definition: mathplot.h:783
void Set(T _value)
Initialize min and max.
Definition: mathplot.h:281
mpRange< double > m_axisRange
Range axis values when autosize is false.
Definition: mathplot.h:2601
void SetMarginRight(int right)
Set the right margin.
Definition: mathplot.h:3711
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:3677
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition: mathplot.h:1498
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition: mathplot.h:3781
Draw a plus +.
Definition: mathplot.h:675
void SetMouseLeftDownAction(mpMouseButtonAction action)
Set the type of action for the left mouse button.
Definition: mathplot.h:3983
wxMenu m_popmenu
Canvas' context menu.
Definition: mathplot.h:4092
Keep the object, just remove the layer from the layer list.
Definition: mathplot.h:803
double m_mouseScaleX
Store current X-scale, used as reference during drag zooming.
Definition: mathplot.h:4123
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:1768
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.
Definition: mathplot.h:1833
enum __mp_Style_Type mpLegendStyle
Style for the Legend layer.
wxColour m_axColour
Axes Colour.
Definition: mathplot.h:4096
Delete the object regardless of the CanDelete value and remove it from the layer list.
Definition: mathplot.h:805
bool m_visible
Toggles layer visibility. Default : true.
Definition: mathplot.h:1143
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition: mathplot.h:4110
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition: mathplot.h:4367
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:2856
Align the plot label towards the southwest.
Definition: mathplot.h:648
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:1389
Plot layer implementing a x-scale ruler.
Definition: mathplot.h:2679
Align the y-axis towards left border.
Definition: mathplot.h:635
bool m_tractable
Is the layer tractable.
Definition: mathplot.h:1144
#define ISNOTNULL(x)
Nullity test according small epsilon.
Definition: mathplot.h:177
void SetLocation(mpLocation location)
Set the location of the box.
Definition: mathplot.h:4228
Align the x-axis towards bottom border.
Definition: mathplot.h:625
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:2194
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition: mathplot.h:3371
void Assign(T value1, T value2)
Assign values to min and max.
Definition: mathplot.h:311
bool m_drawBox
Draw box of the plot bound. Default true.
Definition: mathplot.h:4097
Plot (function) type layer.
Definition: mathplot.h:788
void UpdateDesiredBoundingBox(mpAxisUpdate update)
Update m_desired bounds.
Definition: mathplot.h:3492
void UpdateBoundingBoxToInclude(double px, double py)
Update bounding box (X and Y axis) to include this point.
Definition: mathplot.h:569
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition: mathplot.h:2488
bool m_IsHorizontal
Is the line horizontal? Default false.
Definition: mathplot.h:1631
bool m_CanDelete
Is the layer can be deleted.
Definition: mathplot.h:1147
mpSymbol GetSymbol() const
Get symbol.
Definition: mathplot.h:1534
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition: mathplot.h:834
wxFont m_font
Layer's font.
Definition: mathplot.h:1136
bool GetCanDelete(void) const
Retreive what we do with the object associated with the layer when we delete the layer.
Definition: mathplot.h:1120
Axis type layer.
Definition: mathplot.h:786
Dialog box for configuring the plot's layer objects In this dialog, you can configure: ...
Definition: MathPlotConfig.h:112
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:2345
bool m_auto
Flag to autosize grids. Default true.
Definition: mathplot.h:2600
Draw a triangle down oriented.
Definition: mathplot.h:673
Axis type layer.
Definition: mathplot.h:769
void SetCanDelete(bool canDelete)
Define what we do with the object associated with the layer when we delete the layer.
Definition: mathplot.h:1113
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:4620
bool GetMagnetize() const
Magnetize the position of the mouse in the plot ie draw a vertical and horizontal line...
Definition: mathplot.h:3969
double m_value
The x or y coordinates of the line.
Definition: mathplot.h:1630
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition: mathplot.h:4127
mpLabelType m_labelType
Select labels mode: mpLabel_AUTO for normal labels, mpLabel_TIME for time axis in hours...
Definition: mathplot.h:2602
~mpInfoCoords()
Default destructor.
Definition: mathplot.h:1318
void ShowGrids(bool grids)
Set axis grids.
Definition: mathplot.h:2431
Align the info in margin center-right.
Definition: mathplot.h:614
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition: mathplot.h:3876
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition: mathplot.h:1030
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition: mathplot.h:2796
virtual double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
Definition: mathplot.h:2107
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition: mathplot.h:4199
mpRange< double > lastDesired
Last desired ranged, used for check if desired has changed.
Definition: mathplot.h:2814
std::unordered_map< int, mpRange< double > > GetAllBoundY()
Returns the bounds for all Y-axes.
Definition: mathplot.h:3176
wxImage m_bitmap
The internal copy of the Bitmap:
Definition: mathplot.h:4650
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing...
Definition: mathplot.h:3911
each visible plot is described on its own line, one above the other
Definition: mathplot.h:662
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:3203
Align the x-axis towards top plot.
Definition: mathplot.h:628
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition: mathplot.h:1127
mpRange< double > bound
Range min and max.
Definition: mathplot.h:2812
Set label for axis in auto mode, automatically switch between decimal and scientific notation...
Definition: mathplot.h:741
int GetPlotHeight() const
Get the height of the plot.
Definition: mathplot.h:3793
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition: mathplot.h:1348
#define EPSILON
An epsilon for float comparison to 0.
Definition: mathplot.h:175
Align the y-axis towards right border.
Definition: mathplot.h:639
__Info_Type
sub_type values for mpLAYER_INFO
Definition: mathplot.h:683
std::unordered_map< int, mpRange< double > > GetAllDesiredY()
Returns the desired bounds for all Y-axes.
Definition: mathplot.h:3190
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:2039
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:4627
Show/Hide info coord.
Definition: mathplot.h:597
Align the x-axis towards top border.
Definition: mathplot.h:629
bool GetShowName() const
Get Name visibility.
Definition: mathplot.h:1044
Mouse action draw a box to zoom inside.
Definition: mathplot.h:733
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition: mathplot.h:4521
__Function_Type
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
Definition: mathplot.h:700
#define WXDLLIMPEXP_MATHPLOT
Definition uses windows dll to export function.
Definition: mathplot.h:66
Printout class used by mpWindow to draw in the objects to be printed.
Definition: mathplot.h:4300
Align the y-axis towards left plot.
Definition: mathplot.h:636
int m_last_ly
For double buffering.
Definition: mathplot.h:4115
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:427
mpMagnet m_magnet
For mouse magnetization.
Definition: mathplot.h:4136
wxSize GetSize() const
Returns the size of the box (in pixels)
Definition: mathplot.h:1251
Chart type layer.
Definition: mathplot.h:789
bool m_grids
Flag to show grids. Default false.
Definition: mathplot.h:2599
Set label for axis in scientific notation.
Definition: mathplot.h:745
enum __mp_Location_Type mpLocation
Location for the Info layer.
void Update(T _min, T _max)
Update range with new min and max values if this expand the range If _min < min then min = _min and i...
Definition: mathplot.h:347
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method)...
Definition: mathplot.h:1278
Copy a screen shot to the clipboard.
Definition: mathplot.h:598
Fit view to match bounding box of all layers.
Definition: mathplot.h:591
mpLocation GetLocation() const
Returns the location of the box.
Definition: mathplot.h:4235
bool PointIsInside(double px, double py) const
Is point inside this bounding box?
Definition: mathplot.h:560
Toggle fullscreen only if parent is a frame windows.
Definition: mathplot.h:604
wxBitmap * m_buff_bmp
For double buffering.
Definition: mathplot.h:4116
Center view on click position.
Definition: mathplot.h:594
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition: mathplot.h:1580
virtual ~mpFXYVector()
destrutor
Definition: mathplot.h:1972
__XAxis_Align_Type
Alignment for X axis.
Definition: mathplot.h:623
sub type for all layers who are function.
Definition: mathplot.h:709
Draw a square.
Definition: mathplot.h:671
mpRange< double > GetBoundX(void) const
Get bounding box for X axis.
Definition: mathplot.h:3143
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition: mathplot.h:4351
Align the x-axis center plot.
Definition: mathplot.h:627
__Text_Type
sub_type values for mpLAYER_TEXT
Definition: mathplot.h:692
double m_deltaX
Min delta between 2 consecutive coordinate on x direction.
Definition: mathplot.h:1911
__mp_Colour
Enumeration of classic colour.
Definition: mathplot.h:4669
mpRange< double > GetDesiredBoundY(int yAxisID)
Get desired bounding box for Y axis of ID yAxisID.
Definition: mathplot.h:3166
Align the plot label towards the northwest.
Definition: mathplot.h:645
double m_total_value
Total of the values vector.
Definition: mathplot.h:2204
mpAxisList m_AxisDataYList
List of axis data for the Y direction.
Definition: mathplot.h:4090
void SetMinScale(double min)
Set the minimum of the scale range when we are in automatic mode.
Definition: mathplot.h:2512
virtual int GetSize()
Return the number of points in the series.
Definition: mathplot.h:1859
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
Definition: mathplot.h:4432
virtual bool IsLogAxis()
Get if we are in Logarithmic mode.
Definition: mathplot.h:2579
void SetSymbolSize(int size)
Set symbol size.
Definition: mathplot.h:1541
mpRange< double > desired
Desired range min and max.
Definition: mathplot.h:2813
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, mpLabelType type=mpLabel_AUTO)
Full constructor.
Definition: mathplot.h:2687
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition: mathplot.h:4686
int m_yAxisID
The ID of the Y axis used by the function. Equal 0 if no axis.
Definition: mathplot.h:1581
mpRange(T value1, T value2)
Create range with the 2 values.
Definition: mathplot.h:266
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition: mathplot.h:1506
int m_extraMargin
Extra margin around the plot. Default 8.
Definition: mathplot.h:4106
No symbol is drawing.
Definition: mathplot.h:669
Layer for bar chart.
Definition: mathplot.h:2221
mpFloatRectSimple GetBoundingBox(bool desired, unsigned int yAxisID=0)
Return a bounding box for an y-axis ID.
Definition: mathplot.h:3517
__Chart_Type
sub_type values for mpLAYER_CHART
Definition: mathplot.h:722
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition: mathplot.h:1138
wxString m_content
string holding the coordinates to be drawn.
Definition: mathplot.h:1368
abstract Layer for chart (bar and pie).
Definition: mathplot.h:2163
Show legend items with symbol used with the referred mpLayer.
Definition: mathplot.h:656
Define a simple rectangular box X refer to X axis Y refer to Y axis.
Definition: mathplot.h:543
sub type for all layers who are chart.
Definition: mathplot.h:727
const wxPen & GetPen() const
Get pen set for this layer.
Definition: mathplot.h:1013
Align the info in margin center-left.
Definition: mathplot.h:610
void SetLabelFormat(const wxString &format, bool updateLabelMode=false)
Set axis Label format (used for mpLabel_AUTO draw mode).
Definition: mathplot.h:2447
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:1258
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:3529
Set label for axis in decimal notation, with number of decimals automatically calculated based on zoo...
Definition: mathplot.h:743
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition: mathplot.h:643
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition: mathplot.h:1577
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:3548
void ToLog(void)
Convert to log range.
Definition: mathplot.h:396
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition: mathplot.h:3734
mpRange< double > m_rangeY
Range min and max on y axis.
Definition: mathplot.h:2043
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:1992
int m_symbolSize2
Size of the symbol div 2.
Definition: mathplot.h:1579
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:4634
sub type for mpInfoLegend layer
Definition: mathplot.h:688
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition: mathplot.h:2504
virtual double GetMinX()
Returns the actual minimum X data (loaded in SetData).
Definition: mathplot.h:2070
int GetMarginRight(bool minusExtra=false) const
Get the right margin.
Definition: mathplot.h:3719
mpRange< int > m_drawX
Range min and max on x axis.
Definition: mathplot.h:1907
void SetYValue(const double yvalue)
Set y.
Definition: mathplot.h:1652
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:2012
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition: mathplot.h:2022
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:3559
Text box type layer.
Definition: mathplot.h:772
mpMouseButtonAction GetMouseLeftDownAction()
Returns the type of action for the left mouse button.
Definition: mathplot.h:3992
double pos
Position.
Definition: mathplot.h:2811
void UpdateMargins()
Update margins if e.g.
Definition: mathplot.h:3688
__YAxis_Align_Type
Alignment for Y axis.
Definition: mathplot.h:633
sub type for mpBarChart
Definition: mathplot.h:725
wxRect m_PlotArea
The full size of the plot with m_extraMargin.
Definition: mathplot.h:4112
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:1193
Load a file.
Definition: mathplot.h:602
enum __Symbol_Type mpSymbol
Displaying a symbol instead of a point in the plot function.
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:846
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition: mathplot.h:4249
bool m_fullscreen
Boolean value indicating that we are in fullscreen mode (default false)
Definition: mathplot.h:4086
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition: mathplot.h:4107
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition: mathplot.h:1220
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc...
Definition: mathplot.h:855
Line (horizontal or vertical) type layer.
Definition: mathplot.h:787
wxBitmap * m_zoom_bmp
For zoom selection.
Definition: mathplot.h:4132
Implements an overlay box which shows the mouse coordinates in plot units.
Definition: mathplot.h:1302
mpRange< double > y
range over y direction
Definition: mathplot.h:546
mpLocation m_location
The location of the text.
Definition: mathplot.h:4258
Delete the object if CanDelete is true and remove it from the layer list.
Definition: mathplot.h:804
bool GetMPScrollbars() const
Get scrollbars status.
Definition: mathplot.h:3619
int m_scrY
Current view's Y dimension.
Definition: mathplot.h:4100
sub type for mpTitle layer
Definition: mathplot.h:696
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:3346
void SetStep(unsigned int step)
Set step for plot.
Definition: mathplot.h:1513
mpAxisData m_AxisDataX
Axis data for the X direction.
Definition: mathplot.h:4089
~mpInfoLegend()
Default destructor.
Definition: mathplot.h:1403
wxRect m_oldDim
Keep the old values of m_dim.
Definition: mathplot.h:1279
double GetMaxScale() const
Get the maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2536
Align the info in margin center-top.
Definition: mathplot.h:612
Set label for axis in date mode: the value is always represented as yyyy-mm-dd.
Definition: mathplot.h:752
wxColour m_bgColour
Background Colour.
Definition: mathplot.h:4094
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:3927
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:3273
int GetBarWidth(void) const
Get the width of the bar when we plot in bar mode.
Definition: mathplot.h:1890
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer...
Definition: mathplot.h:3896
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition: mathplot.h:1341
void SetAxisID(unsigned int yAxisID)
Set an ID to the axis.
Definition: mathplot.h:2410
virtual double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
Definition: mathplot.h:2092
void SetMin(T _min)
Set min function, correct max.
Definition: mathplot.h:295
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition: mathplot.h:3827
bool m_enableDoubleBuffer
For double buffering. Default enabled.
Definition: mathplot.h:4117
double m_max_value
Max value of the values vector.
Definition: mathplot.h:2203
Plot layer implementing an abstract function plot class.
Definition: mathplot.h:1485
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition: mathplot.h:1706
wxPoint GetCenter(void) const
Get the center of the pie chart.
Definition: mathplot.h:2308
mpTitle(const wxString &name)
Definition: mathplot.h:4279
Plot layer implementing a simple title.
Definition: mathplot.h:4270
Set no label for axis (useful for bar)
Definition: mathplot.h:758
Plot layer implementing a y-scale ruler.
Definition: mathplot.h:2721
enum __mp_Layer_ZOrder mpLayerZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer...
mpMouseButtonAction
enum for left button mouse action: box zoom or drag
Definition: mathplot.h:731
sub type for mpPieChart
Definition: mathplot.h:726
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:4385
bool ViewAsBar(void) const
Get if we are in bar mode.
Definition: mathplot.h:1899
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition: mathplot.h:1283
mpRange< double > GetBoundY(int yAxisID)
Get bounding box for Y axis of ID yAxisID.
Definition: mathplot.h:3157
virtual void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:1078
Align the plot label towards the northeast.
Definition: mathplot.h:646
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition: mathplot.h:3802
double GetPosX(void) const
Get current view's X position.
Definition: mathplot.h:3214
only for mpInfoCoords
Definition: mathplot.h:619
int GetAlign() const
Get X/Y alignment.
Definition: mathplot.h:1106
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition: mathplot.h:1142
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:4437
int GetExtraMargin() const
Get the extra margin.
Definition: mathplot.h:3775
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition: mathplot.h:2496
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition: mathplot.h:1851
sub type for mpFXY function
Definition: mathplot.h:705
enum __XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
#define ZOOM_AROUND_CENTER
Default value for zoom around a point (default -1 is no zoom)
Definition: mathplot.h:183
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false...
Definition: mathplot.h:1576
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition: mathplot.h:3917
enum __Chart_Type mpChartType
sub_type values for mpLAYER_CHART
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:2030
void SetScale(mpRange< double > range)
Set the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2563
mpRange< double > GetDesiredBoundX(void) const
Get desired bounding box for X axis.
Definition: mathplot.h:3149
~mpChart()
Destructor.
Definition: mathplot.h:2170
bool GetBoundingBox(mpRange< double > *boundX, mpRange< double > *boundY, int yAxisID)
Return the bounding box coordinates for the Y axis of ID yAxisID.
Definition: mathplot.h:3566
Abstract class providing an horizontal line.
Definition: mathplot.h:1638
Zoom into view at clickposition / window center.
Definition: mathplot.h:592
int GetMarginLeft(bool minusExtra=false) const
Get the left margin.
Definition: mathplot.h:3759
bool m_lockaspect
Scale aspect is locked or not.
Definition: mathplot.h:4093
int m_segments
The number of line segments that build up the ellipse.
Definition: mathplot.h:4537
bool m_enableScrollBars
Enable scrollbar in plot window (default false)
Definition: mathplot.h:4126
double scale
Scale.
Definition: mathplot.h:2810
Align the info in margin top-left.
Definition: mathplot.h:611
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
Definition: mathplot.h:2049
bool IsSet()
Check if this mpRange has been assigned any values.
Definition: mathplot.h:326
Zoom out.
Definition: mathplot.h:593
Plot layer implementing an abstract scale ruler.
Definition: mathplot.h:2378
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:973
Class for drawing mouse magnetization Draw an horizontal and a vertical line at the mouse position...
Definition: mathplot.h:2862
double GetMinScale() const
Get the minimum of the scale range when we are in automatic mode.
Definition: mathplot.h:2520
int m_reserveXY
Memory reserved for m_xs and m_ys.
Definition: mathplot.h:2035
bool PointIsInside(T point) const
Return true if the point is inside the range (min and max included)
Definition: mathplot.h:403
__mp_Direction_Type
Direction for the Legend layer.
Definition: mathplot.h:660
sub type for mpInfoLayer layer
Definition: mathplot.h:686
Align the x-axis towards bottom plot.
Definition: mathplot.h:626
A 2D ellipse, described by a 2x2 covariance matrix.
Definition: mathplot.h:4467
mpLabelType GetLabelMode() const
Get axis label view mode.
Definition: mathplot.h:2456
int GetMarginTop(bool minusExtra=false) const
Get the top margin.
Definition: mathplot.h:3702
mpInfoCoords * m_InfoCoords
Pointer to the optional info coords layer.
Definition: mathplot.h:4128
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:3538
Set label for axis in hours mode: the value is always represented as hours:minutes:seconds.
Definition: mathplot.h:750
Represents all the informations needed for plotting a layer in one direction (X or Y) This struct hol...
Definition: mathplot.h:2807
__mp_Style_Type
Style for the Legend layer.
Definition: mathplot.h:652
Layer for pie chart.
Definition: mathplot.h:2282
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition: mathplot.h:989
Align the y-axis towards right plot.
Definition: mathplot.h:638
void GetScale(double *min, double *max) const
Get the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2554
T Length(void) const
Length of the range.
Definition: mathplot.h:378
sub type for mpScaleX
Definition: mathplot.h:716
sub type for mpInfoCoords layer
Definition: mathplot.h:687
Set label user defined.
Definition: mathplot.h:756
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:4473
const wxFont & GetFont() const
Get font set for this layer.
Definition: mathplot.h:981
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition: mathplot.h:4118
wxColour m_fontcolour
Layer's font foreground colour.
Definition: mathplot.h:1137
void SetPosY(std::unordered_map< int, double > &posYList)
Set current view's Y position and refresh display.
Definition: mathplot.h:3223
Set label for axis in time mode: the value is represented as minutes:seconds.milliseconds if time is ...
Definition: mathplot.h:748
sub type not defined (should be never used)
Definition: mathplot.h:685
Set label for axis in datetime mode: the value is always represented as yyyy-mm-ddThh:mm:ss.
Definition: mathplot.h:754
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition: mathplot.h:4512
void SetMax(T _max)
Set max function, correct min.
Definition: mathplot.h:303
Bitmap type layer.
Definition: mathplot.h:773
wxRect m_zoom_Dim
Rectangular area selected for zoom.
Definition: mathplot.h:4133
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition: mathplot.h:1265
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:1071
void ShowTicks(bool ticks)
Set axis ticks.
Definition: mathplot.h:2417
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition: mathplot.h:863
virtual void SetTractable(bool track)
Sets layer tractability.
Definition: mathplot.h:1092
int GetSymbolSize() const
Get symbol size.
Definition: mathplot.h:1549
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition: mathplot.h:2603
Align the info in margin bottom-left.
Definition: mathplot.h:615
const wxString & GetWildcard(void) const
Get wildcard.
Definition: mathplot.h:3652
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition: mathplot.h:4356
enum __mp_Delete_Action mpDeleteAction
Action to do with the object associated to the layer when we delete it.
sub type for mpFY function
Definition: mathplot.h:704
Info box type layer.
Definition: mathplot.h:771
void SetPos(const double posX, std::unordered_map< int, double > &posYList)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:3318
mpOptional_int m_mouseYAxisID
Indicate which ID of Y-axis the mouse was on during zoom/pan.
Definition: mathplot.h:4125
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:3308
mpAxisList GetAxisDataYList(void) const
Get the Y-axis data map.
Definition: mathplot.h:3255
Align the y-axis center plot.
Definition: mathplot.h:637
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:1692
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:906
Plot layer implementing a text string.
Definition: mathplot.h:4194
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:873
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition: mathplot.h:4108
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:4413
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition: mathplot.h:3833
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition: mathplot.h:1058
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition: mathplot.h:1139
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition: mathplot.h:3728
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:890
wxPoint m_reference
Holds the reference point for movements.
Definition: mathplot.h:1281
int GetMarginBottom(bool minusExtra=false) const
Get the bottom margin.
Definition: mathplot.h:3742
Shows information about the mouse commands.
Definition: mathplot.h:603
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:3957
void SetMarginTop(int top)
Set the top margin.
Definition: mathplot.h:3694
double GetScaleX(void) const
Get current view's X scale.
Definition: mathplot.h:3106
wxColour m_fgColour
Foreground Colour.
Definition: mathplot.h:4095
mpRange< double > m_bbox_y
Range of bounding box on y direction.
Definition: mathplot.h:4443
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition: mathplot.h:4138
legend components follow each other horizontally on a single line
Definition: mathplot.h:663
Align the info in margin top-right.
Definition: mathplot.h:613
void InitializeBoundingBox(double px, double py)
Initialize bounding box with an initial point.
Definition: mathplot.h:579
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition: mathplot.h:1420
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:4494
bool m_repainting
Boolean value indicating that we are in repaint step.
Definition: mathplot.h:4114
int GetYAxisID() const
Get the ID of the Y axis used by the function.
Definition: mathplot.h:1562
sub type for all layers who are scale.
Definition: mathplot.h:718
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition: mathplot.h:4102
Represents a numeric range with minimum and maximum values.
Definition: mathplot.h:253
void Set(T _min, T _max)
Set min, max function.
Definition: mathplot.h:288
Align the info in margin bottom-right.
Definition: mathplot.h:617
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition: mathplot.h:4422
double GetScaleY(int yAxisID)
Get current view's Y scale.
Definition: mathplot.h:3131
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:2329
unsigned int GetStep() const
Get step for plot.
Definition: mathplot.h:1520
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:4392
sub type for mpMovableObject function
Definition: mathplot.h:707
Plot layer, abstract base class.
Definition: mathplot.h:818
std::vector< double > values
Values of the chart.
Definition: mathplot.h:2200
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition: mathplot.h:1146
mpRange< double > GetScale() const
Get the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2571
double GetValue() const
Get the x or y coordinates of the line.
Definition: mathplot.h:1608
enum __Scale_Type mpScaleType
sub_type values for mpLAYER_AXIS
void SetOffset(int offX, int offY)
Set offset.
Definition: mathplot.h:4242
void SetFactor(int factor)
Definition: mathplot.h:4326
sub type for mpFX function
Definition: mathplot.h:703
void SetName(const wxString &name)
Set layer name.
Definition: mathplot.h:957
mpWindow * m_win
The wxWindow handle.
Definition: mathplot.h:1134
wxString m_labelFormat
Format string used to print labels.
Definition: mathplot.h:2604
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition: mathplot.h:4099
std::unordered_map< int, double > m_mouseScaleYList
Store current Y-scales, used as reference during drag zooming.
Definition: mathplot.h:4124
void SetShowName(bool show)
Set Name visibility.
Definition: mathplot.h:1037
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:965
void SetScale(double min, double max)
Set the minimum and maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2545
virtual bool DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ...
Definition: mathplot.h:1164
#define mpX_RAWTIME
Shortcut for mpX_UTCTIME.
Definition: mathplot.h:172
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:4532
void SetMarginLeft(int left)
Set the left margin.
Definition: mathplot.h:3751
mpLayerList m_layers
List of attached plot layers.
Definition: mathplot.h:4088
bool m_ticks
Flag to show ticks. Default true.
Definition: mathplot.h:2598
std::map< int, mpAxisData > GetSortedAxisDataYList(void) const
Get a sorted version of the Y-axis data map.
Definition: mathplot.h:3263
mpRect m_margin
Margin around the plot including Y-axis.
Definition: mathplot.h:4104
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition: mathplot.h:2132
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition: mathplot.h:1272
void SetWildcard(const wxString &wildcard)
Set wildcard for LoadFile() function when we use wxFileDialog.
Definition: mathplot.h:3644
mpMouseButtonAction m_mouseLeftDownAction
Type of action for left mouse button.
Definition: mathplot.h:4119
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition: mathplot.h:4111
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition: mathplot.h:1085
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:2393
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:4399
bool IsRepainting() const
Checks if we are repainting.
Definition: mathplot.h:3396
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition: mathplot.h:3470
void SetMaxScale(double max)
Set the maximum of the scale range when we are in automatic mode.
Definition: mathplot.h:2528
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition: mathplot.h:2480
sub type for mpScaleY
Definition: mathplot.h:717
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition: mathplot.h:1527
mpBitmapLayer()
Default constructor.
Definition: mathplot.h:4593
void SetScaleY(const double scaleY, int yAxisID)
Set current view's Y scale and refresh display.
Definition: mathplot.h:3115
mpAxisUpdate
Define the axis we want to update.
Definition: mathplot.h:2833
Text box type layer.
Definition: mathplot.h:791
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition: mathplot.h:2948
void SetAlign(int align)
Set X/Y alignment.
Definition: mathplot.h:1099
Line (horizontal or vertical) type layer.
Definition: mathplot.h:774
virtual double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
Definition: mathplot.h:2085