14#ifndef MATHPLOT_H_INCLUDED
15#define MATHPLOT_H_INCLUDED
83#ifdef mathplot_EXPORTS
85 #define WXDLLIMPEXP_MATHPLOT WXEXPORT
87 #define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type
90 #define WXDLLIMPEXP_MATHPLOT
92 #define WXDLLIMPEXP_DATA_MATHPLOT(type) type
95#if defined(__GNUG__) && !defined(__APPLE__) && !defined(__INTEL_CLANG_COMPILER)
96 #pragma interface "mathplot.h"
102#include <unordered_map>
113#include <wx/scrolwin.h>
115#include <wx/dynarray.h>
117#include <wx/dcmemory.h>
118#include <wx/string.h>
127#if defined(MP_USER_INCLUDE)
131 #define str(x) xstr(x)
132 #define header MP_USER_INCLUDE.h
137#if defined(MP_ENABLE_CONFIG) || defined(ENABLE_MP_CONFIG)
138 #include "MathPlotConfig.h"
145#if defined(MP_ENABLE_NAMESPACE) || defined(ENABLE_MP_NAMESPACE)
149#ifdef MP_ENABLE_DEBUG
154 #define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__)
156 #define DEBUG_NEW new
162#define MP_X_BORDER_SEPARATION 40
164#define MP_Y_BORDER_SEPARATION 60
167#define MP_X_LOCALTIME 0x10
169#define MP_X_UTCTIME 0x20
171#define MP_X_RAWTIME MP_X_UTCTIME
174#define MP_EPSILON 1e-30
176#define MP_ISNOTNULL(x) (std::fpclassify(x) != FP_ZERO)
179#define MP_EXTRA_MARGIN 8
182#define MP_ZOOM_AROUND_CENTER -1
189#define DECLARE_DYNAMIC_CLASS_MATHPLOT(mp_class) wxDECLARE_DYNAMIC_CLASS(mp_class)
221#if defined(MP_ENABLE_CONFIG) || defined(ENABLE_MP_CONFIG)
258 return wxRect(startPx, startPy, endPx - startPx, endPy - startPy);
261static_assert(
sizeof(
mpRect) == 4 *
sizeof(wxCoord));
344 return ((min != 0) || (max != 0));
402 return (min + max) / 2;
408 return std::max(fabs(min), fabs(max));
414 min = (min > 0) ? log10(min) : 0;
415 max = (max > 0) ? log10(max) : 0;
421 return ((point >= min) && (point <= max));
424 #if (defined(__cplusplus) && (__cplusplus > 201703L))
425 bool operator==(
const mpRange&)
const =
default;
430 return (min == other.
min) && (max == other.
max);
435 return !(*
this == other);
445struct [[deprecated(
"Deprecated! No longer used as X and Y are now separated")]]
mpFloatRect
448 std::vector<mpRange<double>>
y;
468 if (yAxisID < y.size())
470 if( (px < x.min || px > x.
max) ||
471 (py < y[yAxisID].min || py > y[yAxisID].max))
491 assert(yAxisID < y.size());
492 if (yAxisID < y.size())
494 if (px < x.
min ) x.
min = px;
495 else if (px > x.
max ) x.
max = px;
496 if (py < y[yAxisID].min ) y[yAxisID].min = py;
497 else if (py > y[yAxisID].max ) y[yAxisID].max = py;
508 assert(yAxisID < y.size());
509 if (yAxisID < y.size())
512 y[yAxisID].min = y[yAxisID].max = py;
518#if (defined(__cplusplus) && (__cplusplus > 201703L))
519 bool operator==(
const mpFloatRect&)
const =
default;
525 auto Same = [](
double a,
double b) {
536 if (y.size() != rect.
y.size())
542 for (
size_t i = 0; i < y.size(); ++i)
544 if (!Same(y[i].min, rect.
y[i].min) ||
545 !Same(y[i].max, rect.
y[i].max) )
617#if defined(MP_ENABLE_CONFIG) || defined(ENABLE_MP_CONFIG)
892 *subtype = m_subtype;
893 return (m_type == typeOfInterest);
1008 m_fontcolour = colour;
1016 return m_fontcolour;
1039 if (brush == wxNullBrush)
1040 m_brush = *wxTRANSPARENT_BRUSH;
1048 void SetBrush(
const wxColour &colour,
enum wxBrushStyle style = wxBRUSHSTYLE_SOLID)
1050 m_brush.SetColour(colour);
1051 m_brush.SetStyle(style);
1079 m_drawOutsideMargins = drawModeOutside;
1086 return m_drawOutsideMargins;
1120 m_tractable = track;
1141 m_CanDelete = canDelete;
1253 [[deprecated(
"Use Show() instead")]]
1273 return m_dim.GetPosition();
1280 m_relX = pos.x / 100.0;
1281 m_relY = pos.y / 100.0;
1288 return m_dim.GetSize();
1302 m_location = location;
1367 [[deprecated(
"Use Show() instead")]]
1390 return IsVisible() && (GetDrawOutsideMargins() || plotArea.Contains(mousePos));
1399 m_timeConv = time_conv;
1406 m_series_coord = show;
1413 return m_series_coord;
1452 std::unordered_map<int, double> m_yValList;
1482 m_needs_update =
true;
1495 m_item_direction = mode;
1496 m_needs_update =
true;
1502 return m_item_direction;
1508 m_needs_update =
true;
1515 m_showDraggedSeries = active;
1522 return m_showDraggedSeries;
1529 m_enableSeriesValues = enable;
1530 m_maxSeriesValueWidth = 0;
1537 return m_enableSeriesValues;
1545 return m_enableSeriesValues && plotArea.Contains(mousePos);
1552 m_showSeriesValues = show;
1559 return m_showSeriesValues && IsVisible();
1600 wxString m_headerString = wxString::FromUTF8(
"≡");
1612 unsigned int layerIdx;
1616 std::vector<LegendDetail> m_LegendDetailList;
1617 wxCoord m_headerEnd;
1618 bool m_needs_update;
1619 int m_maxSeriesValueWidth;
1620 bool m_enableSeriesValues;
1621 bool m_showSeriesValues;
1633 void UpdateBitmap(wxDC &dc,
mpWindow &w);
1643 int GetMaxLabelWidth(wxDC &dc,
mpWindow &w);
1665 int DrawSeriesValue(wxDC& dc,
mpWindow& w,
mpFunction& function,
int posX,
int posY,
int labelHeight,
int labelWidth,
int maxLabelWidth);
1697 m_continuous = continuity;
1705 return m_continuous;
1740 m_symbolSize = size;
1747 return m_symbolSize;
1774 m_yAxisID = yAxisID;
1782 m_LegendIsAlwaysVisible = alwaysVisible;
1790 return m_LegendIsAlwaysVisible;
1798 m_autoStep = enable;
1813 m_maxNOfPoints = nOfPoints;
1820 return m_maxNOfPoints;
1848 mpLine(
double value,
const wxPen &pen = *wxGREEN_PEN);
1877 return m_IsHorizontal;
2029 mpFY(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_TOP,
unsigned int yAxisID = 0);
2095 mpFXY(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_SW,
bool viewAsBar =
false,
unsigned int yAxisID = 0);
2170 bool m_ViewAsBar =
false;
2221 mpFXYVector(
const wxString &name = wxEmptyString,
int flags =
mpALIGN_SW,
bool viewAsBar =
false,
unsigned int yAxisID = 0);
2234 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
2257 bool AddData(
const double x,
const double y,
bool updatePlot);
2267 m_reserveXY = reserve;
2268 m_xs.reserve(m_reserveXY);
2269 m_ys.reserve(m_reserveXY);
2319 return m_rangeX.
min - (m_deltaX / 2);
2323 return m_rangeX.
min;
2331 return m_rangeY.
min;
2341 return m_rangeX.
max + (m_deltaX / 2);
2345 return m_rangeX.
max;
2353 return m_rangeY.
max;
2359 void First_Point(
double x,
double y);
2363 void Check_Limit(
double val,
mpRange<double> *range,
double *last,
double *delta);
2415 mpFX(name, flags, yAxisID)
2417 wxPen FXpen(*wxBLUE, 1, wxPENSTYLE_SOLID);
2418 SetDrawOutsideMargins(
false);
2419 SetContinuity(
true);
2449 return m_rangeY.min;
2458 return m_rangeY.max;
2492 m_variance = sigma * sigma;
2493 m_const = 1.0 / sqrt(2.0 * M_PI * m_variance);
2504 return m_const * exp(-(x - m_mu) * (x - m_mu) / (2.0 * m_variance));
2528 m_variance = sigma * sigma;
2529 m_const = 1.0 / (m_variance * sqrt(2.0 * M_PI));
2544 double tmp = log(x) - m_mu;
2545 return m_const * exp(-tmp * tmp / (2.0 * m_variance)) / x;
2582 void AddData(
const double &data,
const std::string &label);
2591 return (values.size() > 0);
2610#define mpBAR_AXIS_H 1
2611#define mpBAR_AXIS_V 2
2612#define mpBAR_INSIDE 3
2621 mpBarChart(
const wxString &name = wxEmptyString,
double width = 0.5);
2687 mpPieChart(
const wxString &name = wxEmptyString,
double radius = 20);
2722 return m_center.x - m_radius;
2730 return m_center.x + m_radius;
2738 return m_center.y - m_radius;
2746 return m_center.y + m_radius;
2851 m_labelFormat = format;
2852 if (updateLabelMode)
2869 m_timeConv = time_conv;
2876 return m_labelFormat;
2900 m_auto = automaticScalingIsEnabled;
2916 m_axisRange.SetMin(min);
2924 return m_axisRange.min;
2932 m_axisRange.SetMax(max);
2940 return m_axisRange.max;
2949 m_axisRange.Set(min, max);
2958 *min = m_axisRange.min;
2959 *max = m_axisRange.max;
2967 m_axisRange = range;
3007 m_CoordIsAlwaysVisible = alwaysVisible;
3015 return m_CoordIsAlwaysVisible;
3019 static const wxCoord kTickSize = 4;
3020 static const wxCoord kAxisExtraSpace = 6;
3032 bool m_hover =
false;
3045 double GetStep(
double scale,
int minLabelSpacing);
3101 double maxAxisValue;
3103 int SignificantDigits;
3105 double EpsilonScale;
3106 } m_ScaleConstraints;
3132 mpScale(name, flags, grids, type)
3189 mpScale(name, flags, grids, labelType, yAxisID)
3221 if ( (IsLeftAxis() || IsRightAxis()) && (xPixel >= m_xPos) && (xPixel <= (m_xPos + m_axisWidth)) )
3252#define mpMOUSEMODE_DRAG 0
3254#define mpMOUSEMODE_ZOOMBOX 1
3283 return (scale == other.
scale) && (pos == other.
pos) &&
3312typedef std::function<void(
void *Sender,
const wxString &classname,
bool &cancel)>
mpOnDeleteLayer;
3342 m_domain = plotArea;
3363 return m_enable && m_domain.Contains(mousePos);
3420 mpWindow(wxWindow *parent, wxWindowID
id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
3583 m_AxisDataX.scale = scaleX;
3584 UpdateDesiredBoundingBox(uXAxis);
3595 return m_AxisDataX.scale;
3604 assert(m_AxisDataYList.count(yAxisID) != 0);
3607 m_AxisDataYList[yAxisID].scale = scaleY;
3608 UpdateDesiredBoundingBox(uYAxis);
3620 assert(m_AxisDataYList.count(yAxisID) != 0);
3621 return m_AxisDataYList[yAxisID].scale;
3624 [[deprecated(
"Incomplete, use UpdateBBox instead")]]
3632 return m_AxisDataX.bound;
3638 return m_AxisDataX.desired;
3646 assert(m_AxisDataYList.count(yAxisID) != 0);
3647 return m_AxisDataYList[yAxisID].bound;
3655 assert(m_AxisDataYList.count(yAxisID) != 0);
3656 return m_AxisDataYList[yAxisID].desired;
3665 std::unordered_map<int, mpRange<double>> yRange;
3666 for (
const auto& [m_yID, m_yData] : m_AxisDataYList)
3668 yRange[m_yID] = m_yData.bound;
3679 std::unordered_map<int, mpRange<double>> yRange;
3680 for (
const auto& [m_yID, m_yData] : m_AxisDataYList)
3682 yRange[m_yID] = m_yData.desired;
3692 m_AxisDataX.pos = posX;
3693 UpdateDesiredBoundingBox(uXAxis);
3703 return m_AxisDataX.pos;
3710 void SetPosY(std::unordered_map<int, double>& posYList)
3712 for (
auto& [m_yID, m_yData] : m_AxisDataYList)
3714 m_yData.pos = posYList[m_yID];
3716 UpdateDesiredBoundingBox(uYAxis);
3727 assert(m_AxisDataYList.count(yAxisID) != 0);
3728 return m_AxisDataYList[yAxisID].pos;
3736 return (
int)m_AxisDataYList.size();
3744 return m_AxisDataYList;
3756 m_plotWidth = m_scrX - (m_margin.left + m_margin.right);
3757 m_plotHeight = m_scrY - (m_margin.top + m_margin.bottom);
3759 m_plotBoundaries.endPx = m_scrX;
3760 m_plotBoundariesMargin.endPx = m_scrX - m_margin.right;
3761 m_plotBoundaries.endPy = m_scrY;
3762 m_plotBoundariesMargin.endPy = m_scrY - m_margin.bottom;
3764 m_PlotArea = wxRect(m_margin.left - m_extraMargin, m_margin.top - m_extraMargin,
3765 m_plotWidth + 2*m_extraMargin, m_plotHeight + 2*m_extraMargin);
3767 m_magnet.UpdateBox(m_PlotArea);
3797 void SetPos(
const double posX, std::unordered_map<int, double>& posYList)
3799 m_AxisDataX.pos = posX;
3806 inline double p2x(
const wxCoord pixelCoordX)
const
3808 return m_AxisDataX.pos + (pixelCoordX / m_AxisDataX.scale);
3814 inline double p2y(
const wxCoord pixelCoordY,
int yAxisID = 0)
3816 assert(m_AxisDataYList.count(yAxisID) != 0);
3817 if (m_AxisDataYList.count(yAxisID) == 0)
3819 return m_AxisDataYList[yAxisID].pos - (pixelCoordY / m_AxisDataYList[yAxisID].scale);
3825 inline wxCoord
x2p(
const double x)
const
3827 return (wxCoord)((x - m_AxisDataX.pos) * m_AxisDataX.scale);
3833 inline wxCoord
y2p(
const double y,
int yAxisID = 0)
3835 assert(m_AxisDataYList.count(yAxisID) != 0);
3836 if (m_AxisDataYList.count(yAxisID) == 0)
3838 return (wxCoord)((m_AxisDataYList[yAxisID].pos - y) * m_AxisDataYList[yAxisID].scale);
3842 [[deprecated(
"Deprecated - use EnableBufferedPaintDC??")]]
3845 EnableBufferedPaintDC(enabled);
3853 m_enableBufferedPaintDC = enabled;
3860 m_enableMouseNavigation = enabled;
3876 return m_lockaspect;
3908 void ZoomIn(
const wxPoint ¢erPoint = wxDefaultPosition);
3914 void ZoomOut(
const wxPoint ¢erPoint = wxDefaultPosition);
3950 return (
unsigned int)m_layers.size();
3972 if (update & uXAxis)
3974 m_AxisDataX.desired.Set(m_AxisDataX.pos + (m_margin.left / m_AxisDataX.scale),
3975 m_AxisDataX.pos + ((m_margin.left + m_plotWidth) / m_AxisDataX.scale));
3979 if (update & uYAxis)
3981 for (
auto& [m_yID, m_yData] : m_AxisDataYList)
3983 m_yData.desired.Set(m_yData.pos - ((m_margin.top + m_plotHeight) / m_yData.scale),
3984 m_yData.pos - (m_margin.top / m_yData.scale));
3996 assert(m_AxisDataYList.count(yAxisID) != 0);
3998 return mpFloatRectSimple(m_AxisDataX.desired, m_AxisDataYList[yAxisID].desired);
4008 return m_AxisDataX.desired.min;
4017 return m_AxisDataX.desired.max;
4027 assert(m_AxisDataYList.count(yAxisID) != 0);
4028 return m_AxisDataYList[yAxisID].desired.min;
4038 assert(m_AxisDataYList.count(yAxisID) != 0);
4039 return m_AxisDataYList[yAxisID].desired.max;
4049 if (m_AxisDataYList.count(yAxisID) == 0)
4051 *boundX = m_AxisDataX.bound;
4052 *boundY = m_AxisDataYList[yAxisID].bound;
4063 if (m_AxisDataYList.count(yAxisID) == 0)
4066 return m_AxisDataX.bound.PointIsInside(px) && GetBoundY(yAxisID).PointIsInside(py);
4076 if (m_AxisDataYList.count(yAxisID) == 0)
4079 m_AxisDataX.bound.Update(px);
4080 m_AxisDataYList[yAxisID].bound.Update(py);
4091 if (m_AxisDataYList.count(yAxisID) == 0)
4094 m_AxisDataX.bound.Set(px, px);
4095 m_AxisDataYList[yAxisID].bound.Set(py, py);
4106 return m_enableScrollBars;
4114 bool SaveScreenshot(
const wxString &filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
4131 m_wildcard = wildcard;
4149 bool LoadFile(
const wxString &filename = wxEmptyString);
4157 m_DefaultDir = dirname;
4176 m_DefaultLegendIsAlwaysVisible = visible;
4191 m_autoFit = autoFit;
4205 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
4211 SetMargins(top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
4220 return m_margin.top - m_extraMargin;
4222 return m_margin.top;
4228 SetMargins(m_marginOuter.top, right, m_marginOuter.bottom, m_marginOuter.left);
4237 return m_margin.right - m_extraMargin;
4239 return m_margin.right;
4245 return m_marginOuter.right;
4251 SetMargins(m_marginOuter.top, m_marginOuter.right, bottom, m_marginOuter.left);
4260 return m_margin.bottom - m_extraMargin;
4262 return m_margin.bottom;
4268 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, left);
4277 return m_margin.left - m_extraMargin;
4279 return m_margin.left;
4285 m_extraMargin = extra;
4286 SetMargins(m_marginOuter.top, m_marginOuter.right, m_marginOuter.bottom, m_marginOuter.left);
4292 return m_extraMargin;
4298 return m_marginOuter.left;
4310 return m_plotHeight;
4321 bond = m_plotBoundariesMargin;
4323 bond = m_plotBoundaries;
4324 bond.startPx -= m_extraMargin;
4325 bond.endPx += m_extraMargin;
4326 bond.startPy -= m_extraMargin;
4327 bond.endPy += m_extraMargin;
4344 m_drawBox = drawbox;
4387 void SetColourTheme(
const wxColour &bgColour,
const wxColour &drawColour,
const wxColour &axesColour);
4405 m_bgColour = colour;
4415 m_OnDeleteLayer = event;
4421 m_OnDeleteLayer = NULL;
4430 m_OnUserMouseAction = userMouseEventHandler;
4436 m_OnUserMouseAction = NULL;
4446 if (m_AxisDataX.axis)
4447 return ((
mpScaleX *)m_AxisDataX.axis)->IsLogAxis();
4458 assert(m_AxisDataYList.count(yAxisID) != 0);
4459 mpScaleY* yAxis = GetLayerYAxis(yAxisID);
4472 if (m_AxisDataX.axis)
4473 ((
mpScaleX *)m_AxisDataX.axis)->SetLogAxis(log);
4483 mpScaleY* yAxis = GetLayerYAxis(yAxisID);
4494 return m_magnet.IsEnabled();
4500 m_magnet.Enable(mag);
4509 m_mouseLeftDownAction = action;
4518 return m_mouseLeftDownAction;
4536 return m_movingInfoLayer;
4539#if defined(MP_ENABLE_CONFIG) || defined(ENABLE_MP_CONFIG)
4584 m_buff_dc.SelectObject(m_buff_bmp);
4594 virtual void OnFit(wxCommandEvent &event);
4599#if defined(MP_ENABLE_CONFIG) || defined(ENABLE_MP_CONFIG)
4600 virtual void OnConfiguration(wxCommandEvent &event);
4656 void Zoom(
bool zoomIn,
const wxPoint ¢erPoint);
4731#if defined(MP_ENABLE_CONFIG) || defined(ENABLE_MP_CONFIG)
4734 bool m_openConfigWindowPending =
false;
4747 void CheckAndReportDesiredBoundsChanges();
4753 unsigned int GetNewAxisDataID(
void)
4756 for (
const auto& [m_yID, m_yData] : m_AxisDataYList)
4761 newID = std::max(newID, m_yID + 1);
4802 mpText(
const wxString &name,
int offsetx,
int offsety);
4820 m_location = location;
4874 SetPen(*wxWHITE_PEN);
4875 SetBrush(*wxWHITE_BRUSH);
4928 stretch_factor = factor;
4955 m_reference_x(0), m_reference_y(0), m_reference_phi(0), m_shape_xs(0), m_shape_ys(0)
4969 phi = m_reference_phi;
4978 m_reference_phi = phi;
4985 return m_trans_shape_xs.size() != 0;
4992 return m_bbox_x.min;
4999 return m_bbox_x.max;
5006 return m_bbox_y.min;
5013 return m_bbox_y.max;
5073 mpCovarianceEllipse(
double cov_00 = 1,
double cov_11 = 1,
double cov_01 = 0,
double quantiles = 2,
int segments = 32,
5075 m_cov_00(cov_00), m_cov_11(cov_11), m_cov_01(cov_01), m_quantiles(quantiles), m_segments(segments)
5077 m_continuous =
true;
5105 m_segments = segments;
5167 m_continuous =
true;
5181 void setPoints(
const std::vector<double> &points_xs,
const std::vector<double> &points_ys,
bool closedShape =
true);
5202 m_bitmapChanged =
false;
5203 m_scaledBitmap_offset_x = m_scaledBitmap_offset_y = 0;
5222 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly);
5228 return m_bitmapX.min;
5235 return m_bitmapX.max;
5242 return m_bitmapY.min;
5249 return m_bitmapY.max;
5304 auto GetRandomColor = []() {
5305 return (rand() * 255) / RAND_MAX;
5308 auto GetRandomColor = []() {
5309 return (random() * 255) / RAND_MAX;
5315 this->Set(0, 0, 255);
5318 this->Set(255, 0, 0);
5321 this->Set(0, 128, 0);
5324 this->Set(128, 0, 128);
5327 this->Set(255, 255, 0);
5330 this->Set(255, 0, 255);
5333 this->Set(0, 255, 0);
5336 this->Set(0, 255, 255);
5339 this->Set(128, 128, 0);
5342 this->Set((ChannelType) (GetRandomColor()), (ChannelType) (GetRandomColor()), (ChannelType) (GetRandomColor()));
5350#if defined(MP_ENABLE_NAMESPACE) || defined(ENABLE_MP_NAMESPACE)
Dialog box for configuring the plot's layer objects In this dialog, you can configure:
Definition MathPlotConfig.h:156
Layer for bar chart.
Definition mathplot.h:2618
virtual double GetMaxY()
Get inclusive top border of bounding box.
void SetBarColour(const wxColour &colour)
Set the colour used to fill the bars.
virtual double GetMinY()
Get inclusive bottom border of bounding box.
double m_width
Width of each bar/column in plot units.
Definition mathplot.h:2663
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
void SetBarLabelPosition(int position)
Set bar labels positioning.
wxColour m_barColour
Fill colour used for the bars.
Definition mathplot.h:2664
void SetColumnWidth(const double colWidth)
Set the bar width in plot units.
Definition mathplot.h:2633
~mpBarChart()
Destructor.
Definition mathplot.h:2624
virtual double GetMinX()
Get inclusive left border of bounding box.
virtual double GetMaxX()
Get inclusive right border of bounding box.
int m_labelPos
Bar-label placement mode.
Definition mathplot.h:2665
double m_labelAngle
Rotation angle used for bar labels, in degrees.
Definition mathplot.h:2666
mpBarChart(const wxString &name=wxEmptyString, double width=0.5)
Debault constructor.
A layer that allows you to have a bitmap image printed in the mpWindow.
Definition mathplot.h:5195
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition mathplot.h:5240
void SetBitmap(const wxImage &inBmp, double x, double y, double lx, double ly)
Change the bitmap associated with the layer (to update the screen, refresh the mpWindow).
bool m_validImg
True when the source image is valid and ready to draw.
Definition mathplot.h:5260
void GetBitmapCopy(wxImage &outBmp) const
Returns a copy of the current bitmap assigned to the layer.
wxBitmap m_scaledBitmap
Cached scaled bitmap used for drawing.
Definition mathplot.h:5257
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition mathplot.h:5233
wxImage m_bitmap
The internal copy of the Bitmap:
Definition mathplot.h:5256
virtual void DoPlot(wxDC &dc, mpWindow &w)
Pure virtual method to plot the layer.
mpRange< double > m_bitmapX
The shape of the bitmap:
Definition mathplot.h:5265
mpBitmapLayer()
Default constructor.
Definition mathplot.h:5199
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition mathplot.h:5226
wxCoord m_scaledBitmap_offset_x
Cached X pixel offset used when drawing the scaled bitmap.
Definition mathplot.h:5258
bool m_bitmapChanged
True when the cached scaled bitmap must be regenerated.
Definition mathplot.h:5261
mpRange< double > m_bitmapY
Range of the bitmap on y direction.
Definition mathplot.h:5266
wxCoord m_scaledBitmap_offset_y
Cached Y pixel offset used when drawing the scaled bitmap.
Definition mathplot.h:5259
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition mathplot.h:5247
abstract Layer for chart (bar and pie).
Definition mathplot.h:2559
void AddData(const double &data, const std::string &label)
Add data and label.
mpChart(const wxString &name=wxEmptyString)
Default constructor.
void SetChartLabels(const std::vector< std::string > &labelArray)
Set bar label values.
double m_total_value
Total of the values vector.
Definition mathplot.h:2599
void SetChartValues(const std::vector< double > &data)
Set bar values.
std::vector< std::string > labels
Labels of the Values.
Definition mathplot.h:2596
double m_max_value
Max value of the values vector.
Definition mathplot.h:2598
std::vector< double > values
Values of the chart.
Definition mathplot.h:2595
virtual void Clear()
Clears all the data, leaving the layer empty.
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition mathplot.h:2589
~mpChart()
Destructor.
Definition mathplot.h:2565
A 2D ellipse, described by a 2x2 covariance matrix.
Definition mathplot.h:5068
void SetSegments(int segments)
Set the number of line segments used to approximate the ellipse.
Definition mathplot.h:5103
int GetSegments() const
Get the number of line segments used to approximate the ellipse. */.
Definition mathplot.h:5109
double m_cov_11
Covariance matrix element (1,1).
Definition mathplot.h:5137
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:5136
double m_quantiles
Confidence-interval multiplier used when drawing the ellipse.
Definition mathplot.h:5139
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see GetQuantiles a...
Definition mathplot.h:5096
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:5073
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
Definition mathplot.h:5125
void RecalculateShape()
Called to update the m_shape_xs, m_shape_ys vectors, whenever a parameter changes.
double GetQuantiles() const
Get the confidence-interval multiplier used for the ellipse.
Definition mathplot.h:5089
int m_segments
The number of line segments that build up the ellipse.
Definition mathplot.h:5143
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
Definition mathplot.h:5116
double m_cov_01
Covariance matrix element (0,1), equal to element (1,0).
Definition mathplot.h:5138
Create a generic FX function Override the ComputeY() function with your function.
Definition mathplot.h:2408
virtual double GetMinY()
Get min Y of the function.
Definition mathplot.h:2447
virtual double GetMaxY()
Get max Y of the function.
Definition mathplot.h:2456
virtual double ComputeY(double x)=0
The main computation of the FX function.
mpFXGeneric(const wxString &name=wxT("Generic FX function"), int flags=mpALIGN_LEFT, unsigned int yAxisID=0)
Definition mathplot.h:2414
virtual double GetY(double x)
Get function value for argument.
Definition mathplot.h:2428
mpRange< double > m_rangeY
Y range.
Definition mathplot.h:2462
Abstract base class providing plot and labeling functionality for functions F:X->Y.
Definition mathplot.h:1961
virtual double GetY(double x)=0
Get function value for argument.
double DoGetY(double x)
Get function value with log if necessary Call DefineDoGetY() function if pDoGetY pointer is not defin...
double NormalDoGetY(double x)
Definition of the DoGetY function without log.
double LogDoGetY(double x)
Definition of the DoGetY function with log.
mpFX(const wxString &name=wxEmptyString, int flags=mpALIGN_RIGHT, unsigned int yAxisID=0)
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
void DefineDoGetY(void)
Define the good DoGetY function (with ou without log).
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,...
Definition mathplot.h:2088
void SetViewMode(bool asBar)
Switch series plot like a bar mode.
int m_BarWidth
Bar width in pixels when the XY series is drawn in bar mode.
Definition mathplot.h:2168
virtual void Rewind()=0
Rewind value enumeration with mpFXY::GetNextXY.
double m_deltaX
Min delta between 2 consecutive coordinate on x direction.
Definition mathplot.h:2165
int GetBarWidth(void) const
Get the width of the bar when we plot in bar mode.
Definition mathplot.h:2144
bool DoGetNextXY(double *x, double *y)
Get function value with log test.
double m_deltaY
Min delta between 2 consecutive coordinate on y direction.
Definition mathplot.h:2166
void UpdateViewBoundary(wxCoord xnew, wxCoord ynew)
Update label positioning data.
mpRange< int > m_drawX
Range min and max on x axis.
Definition mathplot.h:2161
mpFXY(const wxString &name=wxEmptyString, int flags=mpALIGN_SW, bool viewAsBar=false, unsigned int yAxisID=0)
mpRange< int > m_drawY
Range min and max on y axis.
Definition mathplot.h:2162
virtual bool GetNextXY(double *x, double *y)=0
Get locus value for next N.
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
bool ViewAsBar(void) const
Get if we are in bar mode.
Definition mathplot.h:2153
virtual int GetSize()
Return the number of points in the series.
Definition mathplot.h:2113
virtual void Clear()
Clears all the data, leaving the layer empty.
Definition mathplot.h:2105
A class providing graphs functionality for a 2D plot (either continuous or a set of points),...
Definition mathplot.h:2214
int GetReserve() const
Get memory reserved for m_xs and m_ys.
Definition mathplot.h:2275
virtual bool GetNextXY(double *x, double *y) override
Get locus value for next N.
virtual int GetSize() override
Return the number of points in the series We assume that size of m_xs equals size of m_ys.
Definition mathplot.h:2245
virtual void Rewind() override
Calculates the start and end index which shall be used when iterating the data.
mpRange< double > m_rangeY
Range min and max on y axis.
Definition mathplot.h:2289
void Clear() override
Clears all the data, leaving the layer empty.
std::vector< double > m_ys
internal copy of the set of data on y direction
Definition mathplot.h:2282
void DrawAddedPoint(double x, double y)
Draw the point added if there is in bound.
std::vector< double > m_xs
internal copy of the set of data on x direction
Definition mathplot.h:2281
mpFXYVector(const wxString &name=wxEmptyString, int flags=mpALIGN_SW, bool viewAsBar=false, unsigned int yAxisID=0)
void SetData(const std::vector< double > &xs, const std::vector< double > &ys)
Changes the internal data: the set of points to draw.
bool AddData(const double x, const double y, bool updatePlot)
Add data to the internal vector.
int m_reserveXY
Memory reserved for m_xs and m_ys. Default 1000.
Definition mathplot.h:2284
double m_lastX
Last x-coordinate point added.
Definition mathplot.h:2288
size_t m_endIndex
The end index indicating the last point inside plot area.
Definition mathplot.h:2286
virtual double GetMaxY() override
Returns the actual maximum Y data (loaded in SetData).
Definition mathplot.h:2351
virtual double GetMinY() override
Returns the actual minimum Y data (loaded in SetData).
Definition mathplot.h:2329
virtual double GetMinX() override
Returns the actual minimum X data (loaded in SetData).
Definition mathplot.h:2314
bool m_isMonotonicX
Indicates if all all X values are monotonic, i.e increasing, which enables binary search.
Definition mathplot.h:2283
virtual double GetMaxX() override
Returns the actual maximum X data (loaded in SetData).
Definition mathplot.h:2336
double m_lastY
Last y-coordinate point added.
Definition mathplot.h:2290
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:2265
mpRange< double > m_rangeX
Range min and max on x axis.
Definition mathplot.h:2287
virtual ~mpFXYVector()
destrutor
Definition mathplot.h:2225
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition mathplot.h:2285
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition mathplot.h:2023
double LogDoGetX(double y)
Definition of the DoGetX function with log.
void DefineDoGetX(void)
Define the good DoGetX function (with ou without log).
double DoGetX(double y)
Get function value with log if necessary Call DefineDoGetX() function if pDoGetX pointer is not defin...
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
virtual double GetX(double y)=0
Get function value for argument.
double NormalDoGetX(double y)
Definition of the DoGetX function without log.
mpFY(const wxString &name=wxEmptyString, int flags=mpALIGN_TOP, unsigned int yAxisID=0)
Plot layer implementing an abstract function plot class.
Definition mathplot.h:1683
unsigned int GetStep() const
Get step for plot.
Definition mathplot.h:1717
mpSymbol m_symbol
A symbol for the plot in place of point. Default mpNone.
Definition mathplot.h:1825
bool GetContinuity() const
Gets the 'continuity' property of the layer.
Definition mathplot.h:1703
int GetYAxisID() const
Get the ID of the Y axis used by the function.
Definition mathplot.h:1763
virtual bool DrawSymbol(wxDC &dc, wxCoord x, wxCoord y)
Draw a symbol in place of point.
void SetStep(unsigned int step)
Set step for plot.
Definition mathplot.h:1710
std::optional< double > GetSeriesValue(double xValue)
Get Y value of series at specified X.
size_t GetMaxNOfPoints() const
Get maximum number of points to plot.
Definition mathplot.h:1818
bool m_autoStep
Calculates m_step automatically based on how many points you want to draw.
Definition mathplot.h:1830
void SetYAxisID(unsigned int yAxisID)
Set the ID of the Y axis used by the function.
Definition mathplot.h:1772
void SetSymbolSize(int size)
Set symbol size.
Definition mathplot.h:1738
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points. Default false.
Definition mathplot.h:1824
size_t m_maxNOfPoints
Maximum number of points to draw to screen.
Definition mathplot.h:1831
bool GetLegendIsAlwaysVisible() const
Get the visibility of the legend.
Definition mathplot.h:1788
bool GetAutoStep() const
Get if auto stop is enabled.
Definition mathplot.h:1803
void SetLegendIsAlwaysVisible(bool alwaysVisible)
Set the visibility of the name of the function in the legend despite the visibility of the function i...
Definition mathplot.h:1780
void SetSymbol(mpSymbol symbol)
Set symbol.
Definition mathplot.h:1724
int m_yAxisID
The ID of the Y axis used by the function. Equal 0 if no axis.
Definition mathplot.h:1828
mpSymbol GetSymbol() const
Get symbol.
Definition mathplot.h:1731
void SetAutoStep(bool enable)
Enables auto step which is used to plot a maximum nuber of points at a time to the plot no matter zoo...
Definition mathplot.h:1796
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer.
Definition mathplot.h:1695
bool m_LegendIsAlwaysVisible
If true, the name is visible in the legend despite the visibility of the function....
Definition mathplot.h:1829
void SetMaxNOfPoints(size_t nOfPoints)
Set how many points that is allowed to be drawn at a time.
Definition mathplot.h:1811
mpFunction(mpLayerType layerType=mpLAYER_PLOT, const wxString &name=wxEmptyString, unsigned int yAxisID=0)
Full constructor.
int m_symbolSize
Size of the symbol. Default 6.
Definition mathplot.h:1826
int GetSymbolSize() const
Get symbol size.
Definition mathplot.h:1745
unsigned int m_step
Step to get point to be draw. Default : 1.
Definition mathplot.h:1827
Classic Gaussian distribution f(x) = exp(-(x-μ)²/2σ²)/sqrt(2πσ²)
Definition mathplot.h:2480
double m_sigma
Sigma value.
Definition mathplot.h:2498
double m_variance
Sigma² is the variance.
Definition mathplot.h:2499
double m_mu
Mean value.
Definition mathplot.h:2497
virtual double ComputeY(double x)
The main computation of the FX function.
Definition mathplot.h:2502
mpGaussian(double mu, double sigma)
Classic Gaussian distribution.
Definition mathplot.h:2487
double m_const
Const factor.
Definition mathplot.h:2500
Abstract class providing an horizontal line.
Definition mathplot.h:1891
mpHorizontalLine(double yvalue, const wxPen &pen= *wxGREEN_PEN, unsigned int yAxisID=0)
Draw a horizontal line.
virtual void DoPlot(wxDC &dc, mpWindow &w)
Pure virtual method to plot the layer.
void SetYValue(const double yvalue)
Set y.
Definition mathplot.h:1904
Implements an overlay box which shows the mouse coordinates in plot units.
Definition mathplot.h:1340
wxPen m_penSeries
Pen used to draw the series marker when series-coordinate mode is active.
Definition mathplot.h:1443
wxCoord m_mouseX
Last mouse X position in window pixel coordinates.
Definition mathplot.h:1440
~mpInfoCoords()
Default destructor.
Definition mathplot.h:1355
bool ShouldBeShown(wxRect plotArea, wxPoint mousePos)
Check conditions if info coords shall be shown or not.
Definition mathplot.h:1388
virtual void DoPlot(wxDC &dc, mpWindow &w)
Plot method.
void SetSeriesCoord(bool show)
Set the series coordinates of the mouse position (if tractable set)
Definition mathplot.h:1404
mpLabelType m_labelType
Label formatting mode used for the X coordinate display.
Definition mathplot.h:1438
void Show(bool show)
Set if info coords shall be shown or hidden.
Definition mathplot.h:1372
void DrawContent(wxDC &dc, mpWindow &w)
Draw the content of info coords to plot.
void SetLabelMode(mpLabelType mode, unsigned int time_conv=0x20)
Set X axis label view mode.
Definition mathplot.h:1396
mpInfoCoords(wxPoint pos, const wxBrush &brush= *wxTRANSPARENT_BRUSH, mpLocation location=mpMarginUser)
Complete constructor, setting initial rectangle and background brush.
wxString m_content
string holding the coordinates to be drawn.
Definition mathplot.h:1437
unsigned int m_timeConv
Time conversion mode used when formatting date/time X values.
Definition mathplot.h:1439
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Update the content of the info box.
mpInfoCoords(mpLocation location)
Limited constructor.
bool m_series_coord
True to show the nearest plotted series value instead of raw mouse Y coordinates.
Definition mathplot.h:1442
virtual wxString GetInfoCoordsText(mpWindow &w, double xVal, std::unordered_map< int, double > yValList)
Get string describing mouse position.
wxCoord m_mouseY
Last mouse Y position in window pixel coordinates.
Definition mathplot.h:1441
void SetPenSeries(const wxPen &pen)
Pen series for tractable.
Definition mathplot.h:1425
virtual void ErasePlot(wxDC &, mpWindow &)
Just delete the bitmap of the info.
Definition mathplot.h:1368
bool m_show
Indicates if magnet shall be shown in plot.
Definition mathplot.h:1436
bool IsSeriesCoord() const
Return if we show the series coordinates.
Definition mathplot.h:1411
bool IsShown()
Get shown status.
Definition mathplot.h:1379
mpInfoCoords()
Default constructor.
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition mathplot.h:1220
const wxRect & GetRectangle() const
Get the current rectangle coordinates.
Definition mathplot.h:1293
virtual void ErasePlot(wxDC &, mpWindow &)
Just delete the bitmap of the info.
Definition mathplot.h:1254
double m_relX
Box X position relative window, used to rescale the info box position when the window is resized.
Definition mathplot.h:1316
wxBitmap * m_info_bmp
The bitmap that contain the info.
Definition mathplot.h:1314
wxPoint m_reference
Holds the reference point for movements.
Definition mathplot.h:1315
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Update the content of the info box.
void SetLocation(mpLocation location)
Set the location of the mpInfoLayer box.
Definition mathplot.h:1300
virtual bool HasBBox()
mpInfoLayer has not bounding box.
Definition mathplot.h:1246
wxRect m_dim
The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method).
Definition mathplot.h:1313
mpInfoLayer()
Default constructor.
wxPoint GetPosition() const
Get the position of the upper left corner of the box (in pixels)
Definition mathplot.h:1271
void SetInfoRectangle(mpWindow &w, int width=0, int height=0)
Compute the dimensions and position of the mpInfoLayer rectangle.
mpLocation GetLocation() const
Return the location of the mpInfoLayer box.
Definition mathplot.h:1307
virtual void SetVisible(bool show)
Sets layer visibility.
virtual bool Inside(const wxPoint &point)
Is given point inside the info box rectangle?
virtual void UpdateReference()
Update the rectangle reference point.
double m_relY
Box Y position relative window, used to rescale the info box position when the window is resized.
Definition mathplot.h:1317
mpInfoLayer(wxPoint pos, const wxBrush &brush= *wxTRANSPARENT_BRUSH, mpLocation location=mpMarginUser)
Complete constructor.
virtual void Move(wxPoint delta, mpWindow &w)
Move the layer rectangle by given pixel deltas.
virtual void DoPlot(wxDC &dc, mpWindow &w)
Plot method.
mpLocation m_location
Location of the box in the margin. Default mpMarginNone = use coordinates.
Definition mathplot.h:1318
void SetInitialPosition(wxPoint pos)
Set the position in percent of the upper left corner of the box.
Definition mathplot.h:1278
virtual ~mpInfoLayer()
Destructor.
wxSize GetSize() const
Get the size of the box (in pixels)
Definition mathplot.h:1286
Implement the legend to be added to the plot This layer allows you to add a legend to describe the pl...
Definition mathplot.h:1462
int GetLegendHitRegion(wxPoint mousePos)
Checks if mouse is inside legend and if it hovers the header or any of the series If a series is hove...
bool SeriesValuesShouldBeShown(wxRect plotArea, wxPoint mousePos)
Check if series values should be shown in plot, depending on where mouse is.
Definition mathplot.h:1543
mpInfoLegend()
Default constructor.
bool m_showDraggedSeries
Indicate if series that has been gripped with mouse shall be drawn.
Definition mathplot.h:1599
void SetNeedUpdate()
Mark the legend bitmap as needing regeneration.
Definition mathplot.h:1506
mpInfoLegend(wxPoint pos, const wxBrush &brush= *wxWHITE_BRUSH, mpLocation location=mpMarginUser)
Complete constructor, setting initial rectangle and background brush.
void ShowDraggedSeries(bool active)
Set if dragged series shall be shown or hidden.
Definition mathplot.h:1513
void SetItemMode(mpLegendStyle mode)
Set item mode (the element on the left of text representing the plot line may be line,...
Definition mathplot.h:1479
void DrawContent(wxDC &dc, mpWindow &w)
Draw the content of info legend to plot.
void RestoreAxisHighlighting(mpWindow &w)
Clear the dragged series rectangle from the plot and restores axis hovering indication.
void EnableSeriesValues(bool enable)
Enables to show series values in the legend.
Definition mathplot.h:1527
mpLegendStyle m_item_mode
Visual style used for each legend entry.
Definition mathplot.h:1597
mpLegendStyle GetItemMode() const
Get the current legend item drawing mode.
Definition mathplot.h:1486
mpLegendDirection m_item_direction
Layout direction used when arranging legend entries.
Definition mathplot.h:1598
bool IsSeriesValuesEnabled() const
Check if series values is enabled in legend.
Definition mathplot.h:1535
void ShowSeriesValues(bool show)
Set if the series values shall be drawn to the plot.
Definition mathplot.h:1550
bool IsSeriesValuesShown()
Indicates if series values shall be shown.
Definition mathplot.h:1557
HitCode
Return codes for GetLegendHitRegion() if no series was hit.
Definition mathplot.h:1588
virtual void DoPlot(wxDC &dc, mpWindow &w)
Plot method.
mpLegendDirection GetItemDirection() const
Get the current legend item layout direction.
Definition mathplot.h:1500
void DrawDraggedSeries(wxDC &dc, mpWindow &w)
When a series is being dragged, draw a rectangle with its name at the mouse cursor.
void SetItemDirection(mpLegendDirection mode)
Set item direction (may be vertical or horizontal)
Definition mathplot.h:1493
bool IsDraggedSeriesShown() const
Get shown status of dragged series.
Definition mathplot.h:1520
~mpInfoLegend()
Default destructor.
Definition mathplot.h:1475
Plot layer, abstract base class.
Definition mathplot.h:837
void UpdateContext(wxDC &dc) const
Initialize the context.
void Plot(wxDC &dc, mpWindow &w)
Plot given view of layer to the given device context.
mpLayerZOrder m_ZIndex
The index in Z-Order to draw the layer.
Definition mathplot.h:1174
mpLayerType GetLayerType() const
Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc.
Definition mathplot.h:872
bool GetDrawOutsideMargins() const
Get Draw mode: inside or outside margins.
Definition mathplot.h:1084
wxFont m_font
Layer's font.
Definition mathplot.h:1162
bool m_drawOutsideMargins
Select if the layer should draw only inside margins or over all DC. Default : false.
Definition mathplot.h:1168
void SetFontColour(const wxColour &colour)
Set layer font foreground colour.
Definition mathplot.h:1006
void SetFont(const wxFont &font)
Set layer font.
Definition mathplot.h:990
bool GetCanDelete(void) const
Retreive what we do with the object associated with the layer when we delete the layer.
Definition mathplot.h:1146
bool IsVisible() const
Is this layer visible?
Definition mathplot.h:1097
const wxString & GetName() const
Get layer name.
Definition mathplot.h:982
mpLayerZOrder GetZIndex(void) const
Get the ZIndex of the plot.
Definition mathplot.h:1153
wxBitmap GetColourSquare(int side=16)
Get a small square bitmap filled with the colour of the pen used in the layer.
wxColour m_fontcolour
Layer's font foreground colour.
Definition mathplot.h:1163
mpWindow * m_win
The wxWindow handle.
Definition mathplot.h:1160
bool m_CanDelete
Is the layer can be deleted.
Definition mathplot.h:1173
bool m_showName
States whether the name of the layer must be shown. Default : false.
Definition mathplot.h:1167
bool m_visible
Toggles layer visibility. Default : true.
Definition mathplot.h:1169
mpRect m_plotBoundaries
The boundaries for plotting curve calculated by mpWindow.
Definition mathplot.h:1172
bool GetShowName() const
Get Name visibility.
Definition mathplot.h:1070
void SetBrush(const wxColour &colour, enum wxBrushStyle style=wxBRUSHSTYLE_SOLID)
Set layer brush.
Definition mathplot.h:1048
const mpLayerType m_type
Layer type mpLAYER_*.
Definition mathplot.h:1159
int m_subtype
Layer sub type, set in constructors.
Definition mathplot.h:1161
void SetShowName(bool show)
Set Name visibility.
Definition mathplot.h:1063
const wxFont & GetFont() const
Get font set for this layer.
Definition mathplot.h:998
int GetLayerSubType() const
Get layer subtype: each layer type can have several flavors.
Definition mathplot.h:880
mpLayer(mpLayerType layerType)
The base class of all layer objects.
void SetAlign(int align)
Set X/Y alignment.
Definition mathplot.h:1125
const wxColour & GetFontColour() const
Get font foreground colour set for this layer.
Definition mathplot.h:1014
virtual void DoPlot(wxDC &dc, mpWindow &w)=0
Pure virtual method to plot the layer.
bool m_tractable
Is the layer tractable.
Definition mathplot.h:1170
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:890
const wxPen & GetPen() const
Get pen set for this layer.
Definition mathplot.h:1030
void SetName(const wxString &name)
Set layer name.
Definition mathplot.h:974
bool IsTractable() const
Checks whether the layer is tractable or not.
Definition mathplot.h:1111
int m_flags
Holds label alignment. Default : mpALIGN_SW for series and mpALIGN_CENTER for scale.
Definition mathplot.h:1171
virtual void SetTractable(bool track)
Sets layer tractability.
Definition mathplot.h:1118
wxString m_name
Layer's name.
Definition mathplot.h:1166
wxBrush m_brush
Layer's brush. Default wxTRANSPARENT_BRUSH.
Definition mathplot.h:1165
virtual bool DoBeforePlot()
If we need to do something before plot like reinitialize some parameters ... Return true by default t...
Definition mathplot.h:1190
virtual void SetVisible(bool show)
Sets layer visibility.
Definition mathplot.h:1104
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition mathplot.h:864
void SetPen(const wxPen &pen)
Set layer pen.
Definition mathplot.h:1022
wxPen m_pen
Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
Definition mathplot.h:1164
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition mathplot.h:907
void SetBrush(const wxBrush &brush)
Set layer brush.
Definition mathplot.h:1037
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition mathplot.h:899
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition mathplot.h:923
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition mathplot.h:915
void SetWindow(mpWindow &w)
Set the wxWindow handle.
Definition mathplot.h:852
void CheckLog(double *x, double *y, int yAxisID)
Test if we are in log axis and if true return the log of the values.
const wxBrush & GetBrush() const
Get brush set for this layer.
Definition mathplot.h:1056
int GetAlign() const
Get X/Y alignment.
Definition mathplot.h:1132
void SetCanDelete(bool canDelete)
Set what we do with the object associated with the layer when we delete the layer.
Definition mathplot.h:1139
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition mathplot.h:1077
Abstract class providing a line.
Definition mathplot.h:1840
void SetValue(const double value)
Set x or y value.
Definition mathplot.h:1867
bool IsHorizontal(void) const
Is it a horizontal line?
Definition mathplot.h:1875
bool m_IsHorizontal
Is the line horizontal? Default false.
Definition mathplot.h:1882
mpLine(double value, const wxPen &pen= *wxGREEN_PEN)
Implement a line.
double GetValue() const
Get the x or y coordinates of the line.
Definition mathplot.h:1859
double m_value
The x or y coordinates of the line.
Definition mathplot.h:1881
virtual bool HasBBox() override
Check whether this layer has a bounding box.
Definition mathplot.h:1851
Class for drawing mouse magnetization Draw an horizontal and a vertical line at the mouse position.
Definition mathplot.h:3327
void UpdateBox(const wxRect &plotArea)
Update the drawable magnet area from a wxRect.
Definition mathplot.h:3340
void DrawCross(wxDC &dc, mpWindow &w)
Update the magnet cross to a new mouse position.
bool IsShown()
Get shown status.
Definition mathplot.h:3373
void Show(bool show)
Set if magnet shall be shown or hidden.
Definition mathplot.h:3367
bool ShouldBeShown(wxPoint mousePos)
Check conditions if magnet shall be shown.
Definition mathplot.h:3361
void Enable(bool enable)
Enables the magnet.
Definition mathplot.h:3346
bool IsEnabled() const
Check if magnet is enabled.
Definition mathplot.h:3352
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
Definition mathplot.h:4950
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
Definition mathplot.h:4965
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition mathplot.h:4990
std::vector< double > m_trans_shape_xs
Transformed shape vertices in X coordinates.
Definition mathplot.h:5035
mpRange< double > m_bbox_y
Range of bounding box on y direction.
Definition mathplot.h:5042
mpMovableObject()
Default constructor (sets mpMovableObject location and rotation to (0,0,0))
Definition mathplot.h:4954
virtual void DoPlot(wxDC &dc, mpWindow &w)
Pure virtual method to plot the layer.
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition mathplot.h:5011
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
Definition mathplot.h:4974
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition mathplot.h:5004
double m_reference_phi
Current object rotation angle in radians.
Definition mathplot.h:5022
std::vector< double > m_shape_xs
Shape vertices in object-local X coordinates.
Definition mathplot.h:5031
mpRange< double > m_bbox_x
The precomputed bounding box:
Definition mathplot.h:5041
double m_reference_y
Current object Y position in plot coordinates.
Definition mathplot.h:5021
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition mathplot.h:4983
void ShapeUpdated()
Must be called by the descendent class after updating the shape (m_shape_xs/ys), or when the transfor...
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition mathplot.h:4997
void TranslatePoint(double x, double y, double &out_x, double &out_y) const
A method for 2D translation and rotation, using the current transformation stored in m_reference_x,...
double m_reference_x
The coordinates of the object (orientation "phi" is in radians).
Definition mathplot.h:5020
std::vector< double > m_shape_ys
Shape vertices in object-local Y coordinates.
Definition mathplot.h:5032
std::vector< double > m_trans_shape_ys
Transformed shape vertices in Y coordinates.
Definition mathplot.h:5036
Classic Normal distribution f(x) = exp(-(ln(x)-μ)²/2σ²)/(xσ.sqrt(2π))
Definition mathplot.h:2516
mpNormal(double mu, double sigma)
Classic Normal distribution.
Definition mathplot.h:2523
double m_const
Const factor.
Definition mathplot.h:2536
virtual double ComputeY(double x)
The main computation of the FX function.
Definition mathplot.h:2538
double m_variance
Sigma² is the variance.
Definition mathplot.h:2535
double m_mu
Mean value.
Definition mathplot.h:2533
double m_sigma
Sigma value.
Definition mathplot.h:2534
Layer for pie chart.
Definition mathplot.h:2682
void SetCenter(const wxPoint center)
Set the center of the pie chart.
Definition mathplot.h:2699
wxPoint m_center
Center of the pie chart in device coordinates.
Definition mathplot.h:2752
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
std::vector< wxColour > colours
Per-slice colours used when drawing the chart.
Definition mathplot.h:2753
void SetPieColours(const std::vector< wxColour > &colourArray)
Set colours for the pie.
double m_radius
Radius of the pie chart in pixels.
Definition mathplot.h:2751
~mpPieChart()
Destructor.
Definition mathplot.h:2690
mpPieChart(const wxString &name=wxEmptyString, double radius=20)
Default constructor.
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition mathplot.h:2736
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition mathplot.h:2744
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition mathplot.h:2720
wxPoint GetCenter(void) const
Get the center of the pie chart.
Definition mathplot.h:2707
const wxColour & GetColour(unsigned int id)
Get the colour used for the slice with the given index.
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition mathplot.h:2728
An arbitrary polygon, descendant of mpMovableObject.
Definition mathplot.h:5161
void setPoints(const std::vector< double > &points_xs, const std::vector< double > &points_ys, bool closedShape=true)
Set the points in the polygon.
mpPolygon(const wxString &layerName=_T(""))
Default constructor.
Definition mathplot.h:5165
Printout class used by mpWindow to draw in the objects to be printed.
Definition mathplot.h:4891
mpPrintout(mpWindow *drawWindow, const wxString &title=_T("wxMathPlot print output"), int factor=2)
Construct a printout helper for a plot window.
void SetFactor(int factor)
Definition mathplot.h:4926
void SetDrawState(bool drawState)
Set whether the plot has already been drawn on the current printout.
Definition mathplot.h:4914
bool HasPage(int page)
Does this page exist?
bool OnPrintPage(int page)
Render the requested print page.
Abstract base class providing plot and labeling functionality for functions F:Y->X.
Definition mathplot.h:2377
mpProfile(const wxString &name=wxEmptyString, int flags=mpALIGN_TOP)
virtual double GetY(double x)=0
Get function value for argument.
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
Plot layer implementing an abstract scale ruler.
Definition mathplot.h:2781
mpLabelType GetLabelMode() const
Get axis label view mode.
Definition mathplot.h:2858
void SetMaxScale(double max)
Set the maximum of the scale range when we are in automatic mode.
Definition mathplot.h:2930
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:2956
wxString FormatLabelValue(double value)
Formats a label value to a string Use m_ScaleConstraints, so this structure must be up to date.
mpLabelType m_labelType
Select labels mode: mpLabel_AUTO for normal labels, mpLabel_TIME for time axis in hours,...
Definition mathplot.h:3028
bool m_isLog
Is the axis a log axis ?
Definition mathplot.h:3031
virtual void SetLogAxis(bool log)
Set Logarithmic mode.
Definition mathplot.h:2997
bool m_grids
Flag to show grids. Default false.
Definition mathplot.h:3025
void SetLabelFormat(const wxString &format, bool updateLabelMode=false)
Set axis Label format (used for mpLabel_AUTO draw mode).
Definition mathplot.h:2849
virtual bool IsLogAxis()
Get if we are in Logarithmic mode.
Definition mathplot.h:2989
const wxString & GetLabelFormat() const
Get axis Label format (used for mpLabel_AUTO draw mode).
Definition mathplot.h:2874
virtual int GetOrigin(mpWindow &w)=0
virtual function to compute origin of the axis
bool UseScientific(double maxAxisValue)
Checks if scientific notation shall be used on the labels.
void SetScale(double min, double max)
Set the minimum and maximum of the scale range when we are in automatic mode.
Definition mathplot.h:2947
bool GetCoordIsAlwaysVisible() const
Get the visibility of the mouse coordinates in the info coordinates.
Definition mathplot.h:3013
void SetCoordIsAlwaysVisible(bool alwaysVisible)
Set the visibility of the mouse coordinates in the info coordinates despite the visibility of the axi...
Definition mathplot.h:3005
bool GetShowTicks() const
Get axis ticks.
Definition mathplot.h:2826
int m_axisID
Unique ID that identify this axis. Default -1 mean that axis is not used.
Definition mathplot.h:3022
bool m_CoordIsAlwaysVisible
If true, the mouse coordinates is visible in the info coordinates despite the visibility of the axis....
Definition mathplot.h:3033
void ComputeScaleConstraints(double step, double maxAxisValue)
Initialize and compute properties of m_ScaleConstraints structure.
int GetAxisID(void)
Return the ID of the Axis.
Definition mathplot.h:2803
void ShowGrids(bool grids)
Set axis grids.
Definition mathplot.h:2833
void SetScale(mpRange< double > range)
Set the minimum and maximum of the scale range when we are in automatic mode.
Definition mathplot.h:2965
void SetAxisID(unsigned int yAxisID)
Set an ID to the axis.
Definition mathplot.h:2812
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition mathplot.h:2795
bool m_ticks
Flag to show ticks. Default true.
Definition mathplot.h:3024
void SetMinScale(double min)
Set the minimum of the scale range when we are in automatic mode.
Definition mathplot.h:2914
unsigned int m_timeConv
Selects if time has to be converted to local time or not.
Definition mathplot.h:3029
wxString FormatLogValue(double n)
Formats a value to a string used on a log axis.
mpRange< double > m_axisRange
Range axis values when autosize is false.
Definition mathplot.h:3027
double GetStep(double scale, int minLabelSpacing)
Calculate a 'nice' label step size for the given dataset and desired pixel spacing.
int GetDecimalDigits(double step)
Get number of decimal digits to be used in decimal notation.
wxString m_labelFormat
Format string used to print labels.
Definition mathplot.h:3030
double GetMaxScale() const
Get the maximum of the scale range when we are in automatic mode.
Definition mathplot.h:2938
void SetAuto(bool automaticScalingIsEnabled)
Enable/Disable automatic scaling for this axis.
Definition mathplot.h:2898
virtual void DrawScaleName(wxDC &dc, mpWindow &w, int origin, int labelSize)=0
Draw the name of the scale This function is virtual and need to be overloaded in child class.
bool GetAuto() const
Is automatic scaling enabled for this axis?
Definition mathplot.h:2906
const wxPen & GetGridPen() const
Get pen set for this axis.
Definition mathplot.h:2890
void SetLabelMode(mpLabelType mode, unsigned int time_conv=0x20)
Set axis label view mode.
Definition mathplot.h:2866
void ShowTicks(bool ticks)
Set axis ticks.
Definition mathplot.h:2819
int GetSignificantDigits(double step, double maxAxisValue)
Get number of significant digits to be used in scientific notation.
void SetHovering(bool hover)
Set if axis shall be highlighted when a series is dragged over it.
Definition mathplot.h:2981
bool m_auto
Flag to autosize grids. Default true.
Definition mathplot.h:3026
mpScale(const wxString &name, int flags, bool grids, mpLabelType labelType=mpLabel_AUTO, mpOptional_uint axisID=std::nullopt)
Full constructor.
wxPen m_gridpen
Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
Definition mathplot.h:3023
bool GetShowGrids() const
Get axis grids.
Definition mathplot.h:2840
mpRange< double > GetScale() const
Get the minimum and maximum of the scale range when we are in automatic mode.
Definition mathplot.h:2973
void SetGridPen(const wxPen &pen)
Set grid pen.
Definition mathplot.h:2882
int GetLabelWidth(double value, wxDC &dc)
Get label text width for a given value Use m_ScaleConstraints, so this structure must be up to date.
double GetMinScale() const
Get the minimum of the scale range when we are in automatic mode.
Definition mathplot.h:2922
Plot layer implementing a x-scale ruler.
Definition mathplot.h:3124
virtual int GetOrigin(mpWindow &w)
virtual function to compute origin of the axis
bool IsBottomAxis()
Return true when this X axis is aligned at the bottom edge or bottom border.
Definition mathplot.h:3144
mpScaleX(const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, mpLabelType type=mpLabel_AUTO)
Full constructor.
Definition mathplot.h:3131
static int m_orgy
The y origin coordinate of the X axis We declare it static so we can access to it in mpScaleY.
Definition mathplot.h:3154
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
virtual void DrawScaleName(wxDC &dc, mpWindow &w, int origin, int labelSize)
Draw the name of the scale This function is virtual and need to be overloaded in child class.
bool IsTopAxis()
Return true when this X axis is aligned at the top edge or top border.
Definition mathplot.h:3138
Plot layer implementing a y-scale ruler.
Definition mathplot.h:3179
int m_axisWidth
Reserved width for this Y axis including labels, in pixels.
Definition mathplot.h:3229
mpScaleY(const wxString &name=_T("Y"), int flags=mpALIGN_CENTERY, bool grids=false, mpOptional_uint yAxisID=std::nullopt, mpLabelType labelType=mpLabel_AUTO)
Full constructor.
Definition mathplot.h:3188
virtual void DrawScaleName(wxDC &dc, mpWindow &w, int origin, int labelSize)
Draw the name of the scale This function is virtual and need to be overloaded in child class.
void UpdateAxisWidth(mpWindow &w)
Recalculate the axis width based on the label and name text sizes.
bool IsLeftAxis()
Return true if this Y axis is aligned to the left side.
Definition mathplot.h:3207
bool IsRightAxis()
Return true if this Y axis is aligned to the right side.
Definition mathplot.h:3213
bool IsInside(wxCoord xPixel)
Return true if the given X pixel lies within this Y-axis drawing area.
Definition mathplot.h:3219
int m_xPos
Leftmost X pixel occupied by this axis (starting point).
Definition mathplot.h:3230
virtual int GetOrigin(mpWindow &w)
virtual function to compute origin of the axis
int GetAxisWidth()
Get the reserved width of the Y axis in pixels.
Definition mathplot.h:3201
virtual void DoPlot(wxDC &dc, mpWindow &w)
Layer plot handler.
Plot layer implementing a text string.
Definition mathplot.h:4785
mpLocation m_location
The location of the text.
Definition mathplot.h:4848
virtual bool HasBBox()
Text Layer has not bounding box.
Definition mathplot.h:4811
void SetLocation(mpLocation location)
Set the location of the box.
Definition mathplot.h:4818
mpText(const wxString &name=wxEmptyString)
Default constructor.
Definition mathplot.h:4789
int m_offsetx
Holds offset for X in percentage.
Definition mathplot.h:4846
void SetOffset(int offX, int offY)
Set offset.
Definition mathplot.h:4832
void GetOffset(int *offX, int *offY) const
Get the offset.
Definition mathplot.h:4839
mpLocation GetLocation() const
Returns the location of the box.
Definition mathplot.h:4825
mpText(const wxString &name, mpLocation marginLocation)
virtual void DoPlot(wxDC &dc, mpWindow &w)
Text Layer plot handler.
int m_offsety
Holds offset for Y in percentage.
Definition mathplot.h:4847
mpText(const wxString &name, int offsetx, int offsety)
Plot layer implementing a simple title.
Definition mathplot.h:4862
mpTitle(const wxString &name)
Definition mathplot.h:4870
mpTitle()
Default constructor.
Abstract class providing an vertical line.
Definition mathplot.h:1920
mpVerticalLine(double xvalue, const wxPen &pen= *wxGREEN_PEN)
Draw a vertical line.
virtual void DoPlot(wxDC &dc, mpWindow &w)
Pure virtual method to plot the layer.
void SetXValue(const double xvalue)
Set x.
Definition mathplot.h:1932
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:1945
Canvas for plotting mpLayer implementations.
Definition mathplot.h:3406
const wxString & GetWildcard(void) const
Get wildcard.
Definition mathplot.h:4137
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
Definition mathplot.h:4718
mpRange< double > GetDesiredBoundX(void) const
Get desired bounding box for X axis.
Definition mathplot.h:3636
bool PointIsInsideBound(double px, double py, int yAxisID)
Is the given point inside the current bounding box for the selected Y axis?
Definition mathplot.h:4061
int GetScreenY(void) const
Get current view's Y dimension in device context units.
Definition mathplot.h:3787
mpRect GetPlotBoundaries(bool with_margin) const
Get the boundaries of the plot.
Definition mathplot.h:4317
int GetMarginTop(bool minusExtra=false) const
Get the top margin.
Definition mathplot.h:4217
int GetNOfYAxis(void) const
Get the number of Y axis.
Definition mathplot.h:3734
virtual void OnMouseLeftRelease(wxMouseEvent &event)
Mouse left click (for rect zoom)
int GetMarginBottom(bool minusExtra=false) const
Get the bottom margin.
Definition mathplot.h:4257
void SetColourTheme(const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
Set Color theme.
void UnSetOnUserMouseAction()
Remove the 'user mouse action event' callback.
Definition mathplot.h:4434
void ZoomRect(wxPoint p0, wxPoint p1)
Zoom view fitting given coordinates to the window (p0 and p1 do not need to be in any specific order)
double m_mouseScaleX
Store current X-scale, used as reference during drag zooming.
Definition mathplot.h:4713
void SetScaleY(const double scaleY, int yAxisID)
Set current view's Y scale and refresh display.
Definition mathplot.h:3602
mpRange< double > GetBoundY(int yAxisID)
Get bounding box for Y axis of ID yAxisID.
Definition mathplot.h:3644
bool GetDrawBox() const
Get the draw of the box around the plot.
Definition mathplot.h:4348
int m_infoLegendSelectedSeries
Only used with config window: the selected series in info legend.
Definition mathplot.h:4735
virtual void OnToggleCoords(wxCommandEvent &event)
Toggle Coords handler.
bool m_mouseMovedAfterRightClick
If the mouse does not move after a right click, then the context menu is displayed.
Definition mathplot.h:4709
double GetScaleY(int yAxisID)
Get current view's Y scale.
Definition mathplot.h:3618
bool m_enableMouseNavigation
For pan/zoom with the mouse.
Definition mathplot.h:4707
const wxColour & GetAxesColour() const
Get axes draw colour.
Definition mathplot.h:4391
void SetOnDeleteLayer(const mpOnDeleteLayer &event)
On delete layer event Allows the user to perform certain actions before deleting the layer.
Definition mathplot.h:4413
virtual void OnMouseWheel(wxMouseEvent &event)
Mouse handler for the wheel.
int GetExtraMargin() const
Get the extra margin.
Definition mathplot.h:4290
bool IsLayerVisible(const wxString &name)
Check whether a layer with given name is visible.
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:4481
bool SaveScreenshot(const wxString &filename, int type=wxBITMAP_TYPE_BMP, wxSize imageSize=wxDefaultSize, bool fit=false)
Draw the window on a wxBitmap, then save it to a file.
unsigned int CountLayersFXYPlot()
Counts the number of XY plot layers.
unsigned int CountLayersType(mpLayerType type)
Counts the number of plot layers: this is to count only the layers which have a plot.
void SetMarginLeft(int left)
Set the left margin.
Definition mathplot.h:4266
void ZoomInX()
Zoom in current view along X around center and refresh display.
std::unordered_map< int, double > m_mouseScaleYList
Store current Y-scales, used as reference during drag zooming.
Definition mathplot.h:4714
bool m_boxZoomActive
Indicate if box zoom is active.
Definition mathplot.h:4722
void SetPosY(std::unordered_map< int, double > &posYList)
Set current view's Y position and refresh display.
Definition mathplot.h:3710
bool GetMagnetize() const
Is mouse magnetization enabled? Useful to read the position on the axes.
Definition mathplot.h:4492
virtual void OnMouseHelp(wxCommandEvent &event)
Help handler.
virtual void OnSize(wxSizeEvent &event)
Size handler, will update scroll bar sizes.
virtual void OnScrollPageDown(wxScrollWinEvent &event)
Scroll page down.
int m_last_lx
Last logical X origin, used for double buffering.
Definition mathplot.h:4701
void SetLayerVisible(const unsigned int position, bool viewable)
Sets the visibility of a layer by its position in layer list.
bool m_autoFit
Automatically fit plot when hiding / showing axis and series.
Definition mathplot.h:4717
virtual void OnToggleGrids(wxCommandEvent &event)
Toggle Grids handler.
virtual void OnMouseMove(wxMouseEvent &event)
Mouse handler for mouse motion (for pan)
void Zoom(bool zoomIn, const wxPoint ¢erPoint)
zoom action
void UpdateDesiredBoundingBox(mpAxisUpdate update)
Update m_desired bounds.
Definition mathplot.h:3969
wxMemoryDC * GetMemoryDC(void)
Give a direct access to the memory DC to draw in the buffered bitmap You need release the bitmap afte...
Definition mathplot.h:4582
mpMagnet m_magnet
For mouse magnetization.
Definition mathplot.h:4724
virtual void OnLoadFile(wxCommandEvent &event)
Load File handler.
void SetMargins(int top, int right, int bottom, int left)
Set window margins, creating a blank area where some kinds of layers cannot draw.
int GetScreenX(void) const
Get current view's X dimension in device context units.
Definition mathplot.h:3776
virtual void OnShowPopupMenu(wxMouseEvent &event)
Mouse handler, will show context menu.
bool m_enableBufferedPaintDC
For auto DC double buffering.
Definition mathplot.h:4706
mpOptional_int IsInsideYAxis(const wxPoint &point)
Check if a given point is inside the area of a visible Y-axis and returns its ID if so.
void SetScaleX(const double scaleX)
Set current view's X scale and refresh display.
Definition mathplot.h:3579
void Fit()
Set view to fit global bounding box of all plot layers and refresh display with UpdateAll().
void SetDefaultDir(const wxString &dirname)
Set the default directory for wxFileDialog.
Definition mathplot.h:4155
virtual void OnScrollBottom(wxScrollWinEvent &event)
Scroll to bottom.
wxCoord y2p(const double y, int yAxisID=0)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
Definition mathplot.h:3833
unsigned int CountLayers()
Counts the number of plot layers, including axes: this is to count only the layers which have a bound...
void OpenConfigWindow()
Opens configuration window.
mpLayer * GetLayerByClassName(const wxString &name)
int GetRightYAxesWidth(mpOptional_int yAxisID=std::nullopt)
Calculate width of all axes to the right of this axis.
void SetBound()
Update bound for mpFX and mpFY when axis is scaled.
void EnableBufferedPaintDC(const bool enabled)
Enable/disable the auto buffering of PaintDC.
Definition mathplot.h:3851
wxBitmap m_buff_bmp
Bmp for double buffering.
Definition mathplot.h:4703
mpMouseButtonAction GetMouseLeftDownAction()
Returns the type of action for the left mouse button.
Definition mathplot.h:4516
mpMouseButtonAction m_mouseLeftDownAction
Type of action for left mouse button.
Definition mathplot.h:4708
void SetAutoFit(bool autoFit)
Set if plot shall be auto fitted when hiding or showing axis and series via mouse.
Definition mathplot.h:4189
mpLayer * GetLayersType(int position, mpLayerType type)
wxMemoryDC m_buff_dc
DC for double buffering.
Definition mathplot.h:4704
wxCoord x2p(const double x) const
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
Definition mathplot.h:3825
void Paint(wxDC &dc)
Paint handler which plot all attached layers, with possibility to chose type of DC.
mpScale * GetLayerAxis(int position, mpScaleType scale=mpsAllType)
wxTopLevelWindow * m_parent
Pointer to the top-level window containing the plot (used for fullscreen)
Definition mathplot.h:4672
void SetMarginRight(int right)
Set the right margin.
Definition mathplot.h:4226
wxRect m_PlotArea
The full size of the plot with m_extraMargin.
Definition mathplot.h:4699
virtual void OnZoomIn(wxCommandEvent &event)
Zoom In handler.
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
Definition mathplot.h:4689
void SetDrawBox(bool drawbox)
Set the draw of the box around the plot.
Definition mathplot.h:4342
wxColour m_bgColour
Background Colour.
Definition mathplot.h:4681
virtual void OnScrollLineDown(wxScrollWinEvent &event)
Scroll line down.
wxCoord m_plotHeight
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom)
Definition mathplot.h:4695
mpFloatRectSimple GetBoundingBox(bool desired, unsigned int yAxisID=0)
Return a bounding box for an y-axis ID.
Definition mathplot.h:3994
void SetWildcard(const wxString &wildcard)
Set wildcard for LoadFile() function when we use wxFileDialog.
Definition mathplot.h:4129
wxPoint GetMousePosition()
Returns current mouse position in window.
Definition mathplot.h:4525
wxCoord m_plotWidth
Width of the plot = m_scrX - (m_margin.left + m_margin.right)
Definition mathplot.h:4694
wxPoint m_mouseLClick
Starting coords for rectangular zoom selection.
Definition mathplot.h:4712
mpScaleY * GetLayerYAxis(int yAxisID)
void SetMarginTop(int top)
Set the top margin.
Definition mathplot.h:4209
void DrawBoxZoom(wxDC &dc)
Draws the box zoom selection rectangle.
virtual void OnFit(wxCommandEvent &event)
Fit handler.
mpScaleX * GetLayerXAxis()
const wxColour & GetbgColour() const
Get the plot background colour.
Definition mathplot.h:4397
bool m_lockaspect
Scale aspect is locked or not.
Definition mathplot.h:4680
void SetScaleYAndCenter(double scaleY, int yAxisID)
Set the m_scaleY directly to fixed zoom level, but also adjust m_posY to to make the zoom around cent...
bool m_enableScrollBars
Enable scrollbar in plot window (default false)
Definition mathplot.h:4716
bool IsYAxisUsedByFunction(int yAxisID, int *position)
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:4036
double p2y(const wxCoord pixelCoordY, int yAxisID=0)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition mathplot.h:3814
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:4444
mpLayer * GetLayerPlot(int position, mpFunctionType func=mpfAllType)
mpLayer * GetClosestPlot(wxCoord ix, wxCoord iy, double *xnear, double *ynear)
void SetLayerVisible(const wxString &name, bool viewable)
Sets the visibility of a layer by its name.
bool m_drawBox
Draw box of the plot bound. Default true.
Definition mathplot.h:4684
void SetScreen(const int scrX, const int scrY)
Set current view's dimensions in device context units.
Definition mathplot.h:3752
mpWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long flags=0)
Construct a plotting window.
void DoZoomXCalc(bool zoomIn, wxCoord staticXpixel=-1)
Zoom in or out X around a X position.
virtual void OnLockAspect(wxCommandEvent &event)
Lock Aspect handler.
void RenderOverlays(wxDC &dc)
Draw fast moving objects as a overlay on top of the buffered DC, without having to re-draw all layers...
virtual void OnScrollPageUp(wxScrollWinEvent &event)
Scroll page up.
virtual void OnPaint(wxPaintEvent &event)
Paint handler, will plot all attached layers.
bool IsLayerVisible(const unsigned int position)
Check whether the layer at given position is visible.
wxPoint m_mousePos
Current mouse position in window.
Definition mathplot.h:4710
unsigned int CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
Definition mathplot.h:3948
mpRect m_plotBoundaries
The full size of the plot. Calculated.
Definition mathplot.h:4697
void SetMarginBottom(int bottom)
Set the bottom margin.
Definition mathplot.h:4249
bool LoadFile(const wxString &filename=wxEmptyString)
Load a data file like a csv file Data must be formatted in 2 or more columns.
double GetScaleX(void) const
Get current view's X scale.
Definition mathplot.h:3593
bool IsYAxisUsed(int yAxisID)
int GetPlotWidth() const
Get the width of the plot.
Definition mathplot.h:4302
void SetScaleXAndCenter(double scaleX)
Set the m_scaleX directly to fixed zoom level, but also adjust m_posX to to make the zoom around cent...
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:4047
bool DelLayer(mpLayer *layer, mpDeleteAction alsoDeleteObject, bool refreshDisplay=true, bool refreshConfig=true)
Remove a plot layer from the canvas.
wxPoint m_mouseRClick
For the right button "drag" feature.
Definition mathplot.h:4711
virtual void OnMouseLeftDown(wxMouseEvent &event)
Mouse left click (for rect zoom)
std::unordered_map< int, mpRange< double > > GetAllDesiredY()
Returns the desired bounds for all Y-axes.
Definition mathplot.h:3677
int GetLayerPosition(mpLayer *layer)
void ZoomInY(mpOptional_int yAxisID=std::nullopt)
Zoom in current view along Y around center and refresh display.
void EnableMousePanZoom(const bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition mathplot.h:3858
mpAxisList GetAxisDataYList(void) const
Get the Y-axis data map.
Definition mathplot.h:3742
void ZoomIn(const wxPoint ¢erPoint=wxDefaultPosition)
Zoom into current view and refresh display.
void DoZoomYCalc(bool zoomIn, wxCoord staticYpixel=-1, mpOptional_int yAxisID=std::nullopt)
Zoom in or out Y around a Y position.
void SetMagnetize(bool mag)
Enable or disable mouse-position magnet lines (cross-hairs) in the plot area.
Definition mathplot.h:4498
wxColour m_fgColour
Foreground Colour.
Definition mathplot.h:4682
void ZoomOut(const wxPoint ¢erPoint=wxDefaultPosition)
Zoom out current view and refresh display.
void SetDefaultLegendIsAlwaysVisible(bool visible)
Set if legend is always visible even if series is not plotted.
Definition mathplot.h:4174
bool IsAspectLocked() const
Checks whether the X/Y scale aspect is locked.
Definition mathplot.h:3874
mpRange< double > GetBoundX(void) const
Get bounding box for X axis.
Definition mathplot.h:3630
mpAxisList m_AxisDataYList
List of axis data for the Y direction.
Definition mathplot.h:4677
double p2x(const wxCoord pixelCoordX) const
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition mathplot.h:3806
mpInfoLayer * IsInsideInfoLayer(const wxPoint &point)
Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer.
void DelAllPlot(mpDeleteAction alsoDeleteObject, mpFunctionType func=mpfAllType, bool refreshDisplay=true)
Remove all plot layers.
void DelAllLayers(mpDeleteAction alsoDeleteObject, bool refreshDisplay=true)
Remove all layers from the plot.
void LockAspect(bool enable=true)
Enable or disable X/Y scale aspect locking for the view.
void SetOnUserMouseAction(const mpOnUserMouseAction &userMouseEventHandler)
On user mouse action event Allows the user to perform certain actions before normal event processing.
Definition mathplot.h:4428
void UpdateAll()
Refresh display.
wxString m_DefaultDir
The default directory for wxFileDialog.
Definition mathplot.h:4729
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:4015
wxMenu m_popmenu
Canvas' context menu.
Definition mathplot.h:4679
virtual void OnScrollThumbTrack(wxScrollWinEvent &event)
Scroll thumb on scroll bar moving.
bool CheckUserMouseAction(wxMouseEvent &event)
Check if a user mouse action is required.
virtual void OnMouseLeave(wxMouseEvent &event)
Mouse handler for mouse motion (for pan)
int m_clickedX
Last mouse click X position, for centering and zooming the view.
Definition mathplot.h:4688
virtual void OnCenter(wxCommandEvent &event)
Center handler.
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
Definition mathplot.h:3428
int GetMarginLeft(bool minusExtra=false) const
Get the left margin.
Definition mathplot.h:4274
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:4006
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:3797
static bool m_DefaultCoordIsAlwaysVisible
This value sets the default behaviour when an axis is not visible for the mouse info coordinates disp...
Definition mathplot.h:4182
void DelAllYAxisAfterID(mpDeleteAction alsoDeleteObject, int yAxisID=0, bool refreshDisplay=true)
Remove all extra y axis after the selected y axis.
static bool m_DefaultLegendIsAlwaysVisible
This value sets the default behaviour when a series is not visible for the legend display.
Definition mathplot.h:4167
mpInfoLayer * GetMovingInfoLayer()
Returns moving info layer.
Definition mathplot.h:4534
wxBitmap * BitmapScreenshot(wxSize imageSize=wxDefaultSize, bool fit=false)
Get a screen shot of the window plot.
void DeleteConfigWindow(void)
Deletes configuration window.
void EnableDoubleBuffer(const bool enabled)
Deprecated: Enable/disable the double-buffering of the window, eliminating the flicker (default=enabl...
Definition mathplot.h:3843
virtual void OnFullScreen(wxCommandEvent &event)
FullScreen handler.
void SetMPScrollbars(bool status)
Enable/disable scrollbars.
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:4025
wxBitmap * m_Screenshot_bmp
For clipboard, save and print.
Definition mathplot.h:4726
void ClipboardScreenshot(wxSize imageSize=wxDefaultSize, bool fit=false)
Send the screen shot to the Clipboard.
virtual void BindEvents(void)
Connect all events.
virtual void OnScreenShot(wxCommandEvent &event)
ScreenShot handler.
virtual void OnScrollLineUp(wxScrollWinEvent &event)
Scroll line up.
mpLayerList m_layers
List of attached plot layers.
Definition mathplot.h:4675
void SetbgColour(const wxColour &colour)
Set the plot background colour.
Definition mathplot.h:4403
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:4162
virtual void OnZoomOut(wxCommandEvent &event)
Zoom Out handler.
void UpdateBoundingBoxToInclude(double px, double py, int yAxisID)
Ensure the bounding box includes the given point for the selected Y axis.
Definition mathplot.h:4074
wxColour m_axColour
Axes Colour.
Definition mathplot.h:4683
mpLayer * GetLayerByName(const wxString &name)
void SetExtraMargin(int extra)
Set the extra margin.
Definition mathplot.h:4283
mpAxisData m_AxisDataX
Axis data for the X direction.
Definition mathplot.h:4676
void SetPosX(const double posX)
Set current view's X position and refresh display.
Definition mathplot.h:3690
mpRect m_marginOuter
Margin around the plot exluding Y-axis. Default 50.
Definition mathplot.h:4692
mpLayer * GetLayer(int position)
mpRect m_margin
Margin around the plot including Y-axis.
Definition mathplot.h:4691
mpRange< double > GetDesiredBoundY(int yAxisID)
Get desired bounding box for Y axis of ID yAxisID.
Definition mathplot.h:3653
void ZoomOutX()
Zoom out current view along X around center and refresh display.
void InitParameters()
Function to initialize all variables to their default values This function is called in mpWindow cons...
virtual void OnMouseRightDown(wxMouseEvent &event)
Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu.
int GetPlotHeight() const
Get the height of the plot.
Definition mathplot.h:4308
int GetLeftYAxesWidth(mpOptional_int yAxisID=std::nullopt)
Calculate width of all axes to the left of this axis.
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:4456
std::unordered_map< int, mpRange< double > > GetAllBoundY()
Returns the bounds for all Y-axes.
Definition mathplot.h:3663
void ZoomOutY(mpOptional_int yAxisID=std::nullopt)
Zoom out current view along Y around center and refresh display.
virtual void DesiredBoundsHaveChanged()
To be notified of displayed bounds changes (after user zoom etc), override this callback in your deri...
Definition mathplot.h:4743
double GetPosX(void) const
Get current view's X position.
Definition mathplot.h:3701
int m_scrY
Current view's Y dimension.
Definition mathplot.h:4687
bool m_cacheDirty
Indicate that the cached buffer m_buff_bmp need to be re-created.
Definition mathplot.h:4705
void RefreshConfigWindow(mpLayerType layerType, int param=0, bool show=false)
Refresh the config window if present.
void FitX(void)
Similar to Fit() but only fit in X.
mpOptional_int m_mouseYAxisID
Indicate which ID of Y-axis the mouse was on during zoom/pan.
Definition mathplot.h:4715
bool m_fullscreen
Boolean value indicating that we are in fullscreen mode (default false)
Definition mathplot.h:4673
bool GetMPScrollbars() const
Get scrollbars status.
Definition mathplot.h:4104
mpRect m_plotBoundariesMargin
The size of the plot with the margins. Calculated.
Definition mathplot.h:4698
void InitializeBoundingBox(double px, double py, int yAxisID)
Initialize the bounding box from a first point for the selected Y axis.
Definition mathplot.h:4089
int m_extraMargin
Extra margin around the plot. Default 8.
Definition mathplot.h:4693
int GetMarginRightOuter() const
Get the right outer margin, exluding Y-axis.
Definition mathplot.h:4243
void Fit(const mpRange< double > &rangeX, std::unordered_map< int, mpRange< double > > rangeY, wxCoord *printSizeX=NULL, wxCoord *printSizeY=NULL)
Set view to fit a given bounding box and refresh display with UpdateAll().
void UpdateMargins()
Update margins if e.g.
Definition mathplot.h:4203
int GetMarginRight(bool minusExtra=false) const
Get the right margin.
Definition mathplot.h:4234
void UnSetOnDeleteLayer()
Remove the 'delete layer event' callback.
Definition mathplot.h:4419
int GetMarginLeftOuter() const
Get the left outer margin, exluding Y-axis.
Definition mathplot.h:4296
void FitY(int yAxisID)
Similar to Fit() but only fit in Y and only one Y-axis, specified by ID.
mpInfoLegend * m_InfoLegend
Pointer to the optional info legend layer.
Definition mathplot.h:4720
bool AddLayer(mpLayer *layer, bool refreshDisplay=true, bool refreshConfig=true)
Add a plot layer to the canvas.
void SetLogXaxis(bool log)
Enable or disable logarithmic scaling on the X axis.
Definition mathplot.h:4470
void DoScrollCalc(const int position, const int orientation)
Update scrolling state from a scrollbar position/orientation pair.
virtual bool UpdateBBox()
Set bounding box 'm_bound' to contain all visible plots of this mpWindow.
mpInfoCoords * m_InfoCoords
Pointer to the optional info coords layer.
Definition mathplot.h:4719
mpFXYVector * GetXYSeries(unsigned int n, const wxString &name=_T("Serie "), bool create=true)
virtual void OnScrollTop(wxScrollWinEvent &event)
Scroll to top.
wxString m_wildcard
For loadfile() function when we use wxFileDialog.
Definition mathplot.h:4728
int m_scrX
Current view's X dimension in DC units, including all scales, margins.
Definition mathplot.h:4686
int m_last_ly
Last logical Y origin, used for double buffering.
Definition mathplot.h:4702
void SetMouseLeftDownAction(mpMouseButtonAction action)
Set the type of action for the left mouse button.
Definition mathplot.h:4507
double GetPosY(int yAxisID)
Get current view's Y position.
Definition mathplot.h:3725
Create a wxColour id is the number of the colour : blue, red, green, ...
Definition mathplot.h:5295
wxIndexColour(unsigned int id)
Constructor.
Definition mathplot.h:5301
@ mpID_LOAD_FILE
Load a file.
Definition mathplot.h:620
@ mpID_FIT
Fit view to match bounding box of all layers.
Definition mathplot.h:609
@ mpID_LOCKASPECT
Lock x/y scaling aspect.
Definition mathplot.h:613
@ mpID_FULLSCREEN
Toggle fullscreen only if parent is a frame windows.
Definition mathplot.h:622
@ mpID_ZOOM_IN
Zoom into view at clickposition / window center.
Definition mathplot.h:610
@ mpID_TOGGLE_GRID
Show/Hide grids.
Definition mathplot.h:614
@ mpID_CENTER
Center view on click position.
Definition mathplot.h:612
@ mpID_SCREENSHOT
Copy a screen shot to the clipboard.
Definition mathplot.h:616
@ mpID_TOGGLE_COORD
Show/Hide info coord.
Definition mathplot.h:615
@ mpID_HELP_MOUSE
Shows information about the mouse commands.
Definition mathplot.h:621
@ mpID_ZOOM_OUT
Zoom out.
Definition mathplot.h:611
std::map< int, mpAxisData > mpAxisList
Define the type for the list of axis.
Definition mathplot.h:3289
enum __XAxis_Align_Type mpXAxis_Align
Alignment for X axis.
__mp_Style_Type
Style for the Legend layer.
Definition mathplot.h:671
@ mpLegendSquare
Show legend items with small square with the same color of referred mpLayer.
Definition mathplot.h:673
@ mpLegendSymbol
Show legend items with symbol used with the referred mpLayer.
Definition mathplot.h:674
@ mpLegendLine
Show legend items with line with the same pen of referred mpLayer.
Definition mathplot.h:672
enum __Chart_Type mpChartType
sub_type values for mpLAYER_CHART
__Chart_Type
sub_type values for mpLAYER_CHART
Definition mathplot.h:741
@ mpcAllType
sub type for all layers who are chart.
Definition mathplot.h:745
@ mpcBarChart
sub type for mpBarChart
Definition mathplot.h:743
@ mpcPieChart
sub type for mpPieChart
Definition mathplot.h:744
@ mpcChartNone
sub type not defined (should be never used)
Definition mathplot.h:742
__mp_Location_Type
Location for the Info layer.
Definition mathplot.h:627
@ mpMarginBottomCenter
Align the info in margin center-bottom.
Definition mathplot.h:634
@ mpMarginTopLeft
Align the info in margin top-left.
Definition mathplot.h:629
@ mpMarginBottomLeft
Align the info in margin bottom-left.
Definition mathplot.h:633
@ mpMarginTopCenter
Align the info in margin center-top.
Definition mathplot.h:630
@ mpMarginBottomRight
Align the info in margin bottom-right.
Definition mathplot.h:635
@ mpMarginRightCenter
Align the info in margin center-right.
Definition mathplot.h:632
@ mpMarginTopRight
Align the info in margin top-right.
Definition mathplot.h:631
@ mpMarginLeftCenter
Align the info in margin center-left.
Definition mathplot.h:628
@ mpCursor
only for mpInfoCoords
Definition mathplot.h:637
@ mpMarginUser
User defined position. Can be change by mouse drag.
Definition mathplot.h:636
enum __mp_Colour mpColour
Enumeration of classic colour.
std::optional< unsigned int > mpOptional_uint
Shortcut to optional unsigned integer type.
Definition mathplot.h:106
enum __Symbol_Type mpSymbol
Displaying a symbol instead of a point in the plot function.
__mp_Layer_Type
Major type of an mpLayer (detail is in subtype)
Definition mathplot.h:785
@ mpLAYER_TEXT
Text box type layer.
Definition mathplot.h:790
@ mpLAYER_CHART
Chart type layer (bar chart)
Definition mathplot.h:793
@ mpLAYER_INFO
Info box type layer.
Definition mathplot.h:789
@ mpLAYER_BITMAP
Bitmap type layer.
Definition mathplot.h:791
@ mpLAYER_LINE
Line (horizontal or vertical) type layer.
Definition mathplot.h:792
@ mpLAYER_UNDEF
Layer type undefined; SHOULD NOT BE USED.
Definition mathplot.h:786
@ mpLAYER_AXIS
Axis type layer.
Definition mathplot.h:787
@ mpLAYER_PLOT
Plot type layer.
Definition mathplot.h:788
__Info_Type
sub_type values for mpLAYER_INFO
Definition mathplot.h:702
@ mpiLegend
sub type for mpInfoLegend layer
Definition mathplot.h:706
@ mpiInfo
sub type for mpInfoLayer layer
Definition mathplot.h:704
@ mpiNone
sub type not defined (should be never used)
Definition mathplot.h:703
@ mpiCoords
sub type for mpInfoCoords layer
Definition mathplot.h:705
__YAxis_Align_Type
Alignment for Y axis.
Definition mathplot.h:652
@ mpALIGN_LEFT
Align the y-axis towards left plot.
Definition mathplot.h:654
@ mpALIGN_BORDER_LEFT
Align the y-axis towards left border.
Definition mathplot.h:653
@ mpALIGN_RIGHT
Align the y-axis towards right plot.
Definition mathplot.h:656
@ mpALIGN_BORDER_RIGHT
Align the y-axis towards right border.
Definition mathplot.h:657
@ mpALIGN_CENTERY
Align the y-axis center plot.
Definition mathplot.h:655
__Text_Type
sub_type values for mpLAYER_TEXT
Definition mathplot.h:711
@ mptText
sub type for mpText layer
Definition mathplot.h:713
@ mptTitle
sub type for mpTitle layer
Definition mathplot.h:714
@ mptNone
sub type not defined (should be never used)
Definition mathplot.h:712
std::function< void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer
Define an event for when we delete a layer.
Definition mathplot.h:3312
__mp_Delete_Action
Action to do with the object associated to the layer when we delete it.
Definition mathplot.h:820
@ mpYesDelete
Delete the object if CanDelete is true and remove it from the layer list.
Definition mathplot.h:822
@ mpForceDelete
Delete the object regardless of the CanDelete value and remove it from the layer list.
Definition mathplot.h:823
@ mpNoDelete
Keep the object, just remove the layer from the layer list.
Definition mathplot.h:821
enum __mp_Layer_Type mpLayerType
Major type of an mpLayer (detail is in subtype)
#define DECLARE_DYNAMIC_CLASS_MATHPLOT(mp_class)
Definition for RTTI.
Definition mathplot.h:189
#define MP_Y_BORDER_SEPARATION
Default minimum separation in pixels between Y axes and the plot border.
Definition mathplot.h:164
mpAxisUpdate
Define the axis we want to update.
Definition mathplot.h:3297
__mp_Direction_Type
Direction for the Legend layer.
Definition mathplot.h:679
@ mpVertical
each visible plot is described on its own line, one above the other
Definition mathplot.h:680
@ mpHorizontal
legend components follow each other horizontally on a single line
Definition mathplot.h:681
enum __mp_Layer_ZOrder mpLayerZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer,...
enum __mp_Style_Type mpLegendStyle
Style for the Legend layer.
#define MP_EPSILON
An epsilon for float comparison to 0.
Definition mathplot.h:174
enum __mp_Direction_Type mpLegendDirection
Direction for the Legend layer.
mpMouseButtonAction
enum for left button mouse action: box zoom or drag
Definition mathplot.h:750
@ mpMouseBoxZoom
Mouse action draw a box to zoom inside.
Definition mathplot.h:751
@ mpMouseDragZoom
Mouse action drag the plot.
Definition mathplot.h:752
std::deque< mpLayer * > mpLayerList
Define the type for the list of layers inside mpWindow.
Definition mathplot.h:3259
#define WXDLLIMPEXP_MATHPLOT
Definition uses windows dll to export function.
Definition mathplot.h:90
enum __Text_Type mpTextType
sub_type values for mpLAYER_TEXT
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:3320
enum __YAxis_Align_Type mpYAxis_Align
Alignment for Y axis.
#define MP_X_RAWTIME
Shortcut for MP_X_UTCTIME.
Definition mathplot.h:171
#define MP_ZOOM_AROUND_CENTER
Default value for zoom around a point (default -1 is no zoom)
Definition mathplot.h:182
enum __mp_Location_Type mpLocation
Location for the Info layer.
enum __Plot_Align_Name_Type mpPlot_Align
Plot alignment (which corner should plot be placed)
__XAxis_Align_Type
Alignment for X axis.
Definition mathplot.h:642
@ mpALIGN_BORDER_BOTTOM
Align the x-axis towards bottom border.
Definition mathplot.h:643
@ mpALIGN_TOP
Align the x-axis towards top plot.
Definition mathplot.h:646
@ mpALIGN_BORDER_TOP
Align the x-axis towards top border.
Definition mathplot.h:647
@ mpALIGN_CENTERX
Align the x-axis center plot.
Definition mathplot.h:645
@ mpALIGN_BOTTOM
Align the x-axis towards bottom plot.
Definition mathplot.h:644
mpLabelType
enum for label for grid
Definition mathplot.h:757
@ mpLabel_AUTO
Set label for axis in auto mode, automatically switch between decimal and scientific notation.
Definition mathplot.h:759
@ mpLabel_SCIENTIFIC
Set label for axis in scientific notation.
Definition mathplot.h:763
@ mpLabel_USER
Set label user defined.
Definition mathplot.h:774
@ mpLabel_DATETIME
Set label for axis in datetime mode: the value is always represented as yyyy-mm-ddThh:mm:ss.
Definition mathplot.h:772
@ mpLabel_DATE
Set label for axis in date mode: the value is always represented as yyyy-mm-dd.
Definition mathplot.h:770
@ mpLabel_HOURS
Set label for axis in hours mode: the value is always represented as hours:minutes:seconds.
Definition mathplot.h:768
@ mpLabel_TIME
Set label for axis in time mode: the value is represented as minutes:seconds.milliseconds if time is ...
Definition mathplot.h:766
@ mpLabel_DECIMAL
Set label for axis in decimal notation, with number of decimals automatically calculated based on zoo...
Definition mathplot.h:761
@ mpLabel_NONE
Set no label for axis (useful for bar)
Definition mathplot.h:776
enum __Scale_Type mpScaleType
sub_type values for mpLAYER_AXIS
__Scale_Type
sub_type values for mpLAYER_AXIS
Definition mathplot.h:732
@ mpsAllType
sub type for all layers who are scale.
Definition mathplot.h:736
@ mpsScaleY
sub type for mpScaleY
Definition mathplot.h:735
@ mpsScaleX
sub type for mpScaleX
Definition mathplot.h:734
@ mpsScaleNone
sub type not defined (should be never used)
Definition mathplot.h:733
__mp_Layer_ZOrder
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer,...
Definition mathplot.h:802
@ mpZIndex_BACKGROUND
Bitmap type layer.
Definition mathplot.h:803
@ mpZIndex_TEXT
Text box type layer.
Definition mathplot.h:809
@ mpZIndex_END
Just the end of ZOrder.
Definition mathplot.h:810
@ mpZIndex_AXIS
Axis type layer.
Definition mathplot.h:804
@ mpZIndex_PLOT
Plot (function) type layer.
Definition mathplot.h:806
@ mpZIndex_INFO
Info box type layer.
Definition mathplot.h:808
@ mpZIndex_LINE
Line (horizontal or vertical) type layer.
Definition mathplot.h:805
@ mpZIndex_CHART
Chart type layer.
Definition mathplot.h:807
__mp_Colour
Enumeration of classic colour.
Definition mathplot.h:5278
#define MP_ISNOTNULL(x)
Nullity test. Old solution is to test according small epsilon: (fabs(x) > MP_EPSILON)
Definition mathplot.h:176
enum __Info_Type mpInfoType
sub_type values for mpLAYER_INFO
enum __mp_Delete_Action mpDeleteAction
Action to do with the object associated to the layer when we delete it.
__Plot_Align_Name_Type
Plot alignment (which corner should plot be placed)
Definition mathplot.h:662
@ mpALIGN_NW
Align the plot label towards the northwest.
Definition mathplot.h:663
@ mpALIGN_SE
Align the plot label towards the southeast.
Definition mathplot.h:665
@ mpALIGN_SW
Align the plot label towards the southwest.
Definition mathplot.h:666
@ mpALIGN_NE
Align the plot label towards the northeast.
Definition mathplot.h:664
__Symbol_Type
Displaying a symbol instead of a point in the plot function.
Definition mathplot.h:686
@ mpsDownTriangle
Draw a triangle down oriented.
Definition mathplot.h:691
@ mpsSquare
Draw a square.
Definition mathplot.h:689
@ mpsCircle
Draw a circle.
Definition mathplot.h:688
@ mpsUpTriangle
Draw a triangle up oriented.
Definition mathplot.h:690
@ mpsPlus
Draw a plus +.
Definition mathplot.h:693
@ mpsNone
No symbol is drawing.
Definition mathplot.h:687
@ mpsCross
Draw a cross X.
Definition mathplot.h:692
enum __Function_Type mpFunctionType
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
std::optional< int > mpOptional_int
Shortcut to optional integer type..
Definition mathplot.h:108
__Function_Type
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
Definition mathplot.h:719
@ mpfAllType
sub type for all layers who are function.
Definition mathplot.h:727
@ mpfFX
sub type for mpFX function
Definition mathplot.h:721
@ mpfLine
sub type for mpLine function
Definition mathplot.h:726
@ mpfMovable
sub type for mpMovableObject function
Definition mathplot.h:725
@ mpfFY
sub type for mpFY function
Definition mathplot.h:722
@ mpfFXYVector
sub type for mpFXYVector function
Definition mathplot.h:724
@ mpfNone
sub type not defined (should be never used)
Definition mathplot.h:720
@ mpfFXY
sub type for mpFXY function
Definition mathplot.h:723
Represents all the informations needed for plotting a layer in one direction (X or Y) This struct hol...
Definition mathplot.h:3271
double pos
Position.
Definition mathplot.h:3274
mpRange< double > desired
Desired range min and max.
Definition mathplot.h:3276
mpRange< double > lastDesired
Last desired ranged, used for check if desired has changed.
Definition mathplot.h:3277
double scale
Scale.
Definition mathplot.h:3273
mpRange< double > bound
Range min and max.
Definition mathplot.h:3275
bool operator==(const mpAxisData &other) const
Compare axis data while ignoring the axis pointer itself.
Definition mathplot.h:3281
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer t...
Definition mathplot.h:446
mpFloatRect(mpWindow &w)
Construct a new mpFloatRect using it's parent mpWindow to obtain the number of Y-scales to use.
mpRange< double > x
range over x direction
Definition mathplot.h:447
mpFloatRect()=delete
Only allow constructor with mpWindow supplied.
bool IsNotSet(mpWindow &w) const
Is mpFloatRect set ?
Definition mathplot.h:516
void InitializeBoundingBox(double px, double py, size_t yAxisID=0)
Initialize bounding box with an initial point.
Definition mathplot.h:507
bool PointIsInside(double px, double py, size_t yAxisID=0) const
Is point inside this bounding box?
Definition mathplot.h:467
std::vector< mpRange< double > > y
array of range over all y directions
Definition mathplot.h:448
bool operator==(const mpFloatRect &rect) const
Equal operator.
Definition mathplot.h:523
void UpdateBoundingBoxToInclude(double px, double py, size_t yAxisID=0)
Update bounding box to include this point.
Definition mathplot.h:490
Define a simple rectangular box X refer to X axis Y refer to Y axis.
Definition mathplot.h:562
void InitializeBoundingBox(double px, double py)
Initialize bounding box with an initial point.
Definition mathplot.h:597
void UpdateBoundingBoxToInclude(double px, double py)
Update bounding box (X and Y axis) to include this point.
Definition mathplot.h:587
mpRange< double > y
range over y direction
Definition mathplot.h:564
mpFloatRectSimple(mpRange< double > _x, mpRange< double > _y)
Construct a simple rectangular box.
Definition mathplot.h:571
mpRange< double > x
range over x direction
Definition mathplot.h:563
bool PointIsInside(double px, double py) const
Is point inside this bounding box?
Definition mathplot.h:578
Represents a numeric range with minimum and maximum values.
Definition mathplot.h:270
mpRange(T value1, T value2)
Create range with the 2 values.
Definition mathplot.h:282
bool PointIsInside(T point) const
Return true if the point is inside the range (min and max included)
Definition mathplot.h:419
void Update(mpRange range)
Update range with new range values if this expand the range.
Definition mathplot.h:373
T Length(void) const
Length of the range.
Definition mathplot.h:394
void Set(T _value)
Initialize min and max.
Definition mathplot.h:297
void Update(T value)
Update range according new value: Expand the range to include the value.
Definition mathplot.h:351
mpRange()
Default constructor.
Definition mathplot.h:275
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:363
bool operator!=(const mpRange &other) const
Compare two ranges for inequality.
Definition mathplot.h:433
void SetMax(T _max)
Set max function, correct min.
Definition mathplot.h:319
bool operator==(const mpRange &other) const
Compare two ranges for equality.
Definition mathplot.h:428
T GetCenter(void) const
Center of the range.
Definition mathplot.h:400
T max
The max value of the range.
Definition mathplot.h:272
void Check(void)
Check to always have a range. If min = max then introduce the 0 to make a range.
Definition mathplot.h:382
void Set(T _min, T _max)
Set min, max function.
Definition mathplot.h:304
void SetMin(T _min)
Set min function, correct max.
Definition mathplot.h:311
T min
The min value of the range.
Definition mathplot.h:271
T GetMaxAbs(void) const
Max absolute value of the range.
Definition mathplot.h:406
bool IsSet()
Check if this mpRange has been assigned any values.
Definition mathplot.h:342
void ToLog(void)
Convert to log range.
Definition mathplot.h:412
void Assign(T value1, T value2)
Assign values to min and max.
Definition mathplot.h:327
A rectangle structure in several (integer) flavors.
Definition mathplot.h:227
wxRect GetRect(void)
Create standard wxWidgets rectangle defined by this object's start and end points.
Definition mathplot.h:256