|
MathPlot
|
#include <cassert>#include <vector>#include <map>#include <unordered_map>#include <wx/defs.h>#include <wx/menu.h>#include <wx/scrolwin.h>#include <wx/event.h>#include <wx/dynarray.h>#include <wx/pen.h>#include <wx/dcmemory.h>#include <wx/string.h>#include <wx/print.h>#include <wx/image.h>#include <wx/intl.h>#include <cmath>#include <deque>#include <algorithm>

Go to the source code of this file.
Classes | |
| union | mpRect |
| A rectangle structure in several (integer) flavors. More... | |
| struct | mpRange< T > |
| Represents a numeric range with minimum and maximum values. More... | |
| struct | mpFloatRectSimple |
| Define a simple rectangular box X refer to X axis Y refer to Y axis. More... | |
| class | mpLayer |
| Plot layer, abstract base class. More... | |
| class | mpInfoLayer |
| Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rectangular info box in transparent overlay over plot layers. More... | |
| class | mpInfoCoords |
| Implements an overlay box which shows the mouse coordinates in plot units. More... | |
| class | mpInfoLegend |
| Implements the legend to be added to the plot This layer allows you to add a legend to describe the plots in the window. More... | |
| class | mpFunction |
| Plot layer implementing an abstract function plot class. More... | |
| class | mpLine |
| Abstract class providing a line. More... | |
| class | mpHorizontalLine |
| Abstract class providing an horizontal line. More... | |
| class | mpVerticalLine |
| Abstract class providing an vertical line. More... | |
| class | mpFX |
| Abstract base class providing plot and labeling functionality for functions F:X->Y. More... | |
| class | mpFY |
| Abstract base class providing plot and labeling functionality for functions F:Y->X. More... | |
| class | mpFXY |
| Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y. More... | |
| class | mpFXYVector |
| A class providing graphs functionality for a 2D plot (either continuous or a set of points), from vectors of data. More... | |
| class | mpProfile |
| Abstract base class providing plot and labeling functionality for functions F:Y->X. More... | |
| class | mpChart |
| abstract Layer for chart (bar and pie). More... | |
| class | mpBarChart |
| Layer for bar chart. More... | |
| class | mpPieChart |
| Layer for pie chart. More... | |
| class | mpScale |
| Plot layer implementing an abstract scale ruler. More... | |
| class | mpScaleX |
| Plot layer implementing a x-scale ruler. More... | |
| class | mpScaleY |
| Plot layer implementing a y-scale ruler. More... | |
| struct | mpAxisData |
| Represents all the informations needed for plotting a layer in one direction (X or Y) This struct holds: More... | |
| class | mpMagnet |
| Class for drawing mouse magnetization Draw an horizontal and a vertical line at the mouse position. More... | |
| class | mpWindow |
| Canvas for plotting mpLayer implementations. More... | |
| class | mpText |
| Plot layer implementing a text string. More... | |
| class | mpTitle |
| Plot layer implementing a simple title. More... | |
| class | mpPrintout |
| Printout class used by mpWindow to draw in the objects to be printed. More... | |
| class | mpMovableObject |
| This virtual class represents objects that can be moved to an arbitrary 2D location+rotation. More... | |
| class | mpCovarianceEllipse |
| A 2D ellipse, described by a 2x2 covariance matrix. More... | |
| class | mpPolygon |
| An arbitrary polygon, descendant of mpMovableObject. More... | |
| class | mpBitmapLayer |
| A layer that allows you to have a bitmap image printed in the mpWindow. More... | |
| class | wxIndexColour |
| Create a wxColour id is the number of the colour : blue, red, green, ... More... | |
Macros | |
| #define | WXDLLIMPEXP_MATHPLOT |
| Definition uses windows dll to export function. | |
| #define | WXDLLIMPEXP_DATA_MATHPLOT(type) type |
| Definition uses windows dll to export data type. | |
| #define | MP_OPTNULL_INT -1 |
| #define | MP_OPTTEST(opt) ((opt) != -1) |
| #define | MP_OPTGET(opt) (opt) |
| #define | MP_LOOP_ITER auto& elem |
| #define | m_yID elem.first |
| #define | m_yData elem.second |
| #define | X_BORDER_SEPARATION 40 |
| This directive allow the user to add a custom include. More... | |
| #define | Y_BORDER_SEPARATION 60 |
| #define | mpX_LOCALTIME 0x10 |
| When setting x labels in date/time format, convert input time to local time. More... | |
| #define | mpX_UTCTIME 0x20 |
| When setting x labels in date/time format, convert input time to UTC time (or just leave it raw). More... | |
| #define | mpX_RAWTIME mpX_UTCTIME |
| Shortcut for mpX_UTCTIME. | |
| #define | EPSILON 1e-8 |
| An epsilon for float comparison to 0. | |
| #define | ISNOTNULL(x) (fabs(x) > EPSILON) |
| Nullity test according small epsilon. | |
| #define | EXTRA_MARGIN 8 |
| A small extra margin for the plot boundary. | |
| #define | ZOOM_AROUND_CENTER -1 |
| Default value for zoom around a point (default -1 is no zoom) | |
mpLayer implementations - functions | |
| #define | mpBAR_NONE 0 |
| No bar labels. | |
| #define | mpBAR_AXIS_H 1 |
| Labels under X axis - horizontal layout. | |
| #define | mpBAR_AXIS_V 2 |
| Labels under X axis - vertical layout. | |
| #define | mpBAR_INSIDE 3 |
| Labels inside bar rectangle. | |
| #define | mpBAR_TOP 4 |
| Labels over the bar. | |
Constants defining mouse modes for mpWindow | |
| #define | mpMOUSEMODE_DRAG 0 |
| Mouse panning drags the view. More... | |
| #define | mpMOUSEMODE_ZOOMBOX 1 |
| Mouse panning creates a zoom box. More... | |
Typedefs | |
| typedef unsigned int | mpOptional_uint |
| typedef int | mpOptional_int |
| typedef enum __mp_Location_Type | mpLocation |
| Location for the Info layer. | |
| typedef enum __XAxis_Align_Type | mpXAxis_Align |
| Alignment for X axis. | |
| typedef enum __YAxis_Align_Type | mpYAxis_Align |
| Alignment for Y axis. | |
| typedef enum __Plot_Align_Name_Type | mpPlot_Align |
| Plot alignment (which corner should plot be placed) | |
| typedef enum __mp_Style_Type | mpLegendStyle |
| Style for the Legend layer. | |
| typedef enum __mp_Direction_Type | mpLegendDirection |
| Direction for the Legend layer. | |
| typedef enum __Symbol_Type | mpSymbol |
| Displaying a symbol instead of a point in the plot function. | |
| typedef enum __Info_Type | mpInfoType |
| sub_type values for mpLAYER_INFO | |
| typedef enum __Text_Type | mpTextType |
| sub_type values for mpLAYER_TEXT | |
| typedef enum __Function_Type | mpFunctionType |
| sub_type values for mpLAYER_PLOT and mpLAYER_LINE | |
| typedef enum __Scale_Type | mpScaleType |
| sub_type values for mpLAYER_AXIS | |
| typedef enum __Chart_Type | mpChartType |
| sub_type values for mpLAYER_CHART | |
| typedef enum __mp_Layer_Type | mpLayerType |
| < Major type of an mpLayer (detail is in subtype) | |
| typedef enum __mp_Layer_ZOrder | mpLayerZOrder |
| Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer, function, info (info, coord, legend, ...) and finally text (text, title) | |
| typedef enum __mp_Delete_Action | mpDeleteAction |
| Action to do with the object associated to the layer when we delete it. More... | |
| typedef std::deque< mpLayer * > | mpLayerList |
| Define the type for the list of layers inside mpWindow. | |
| typedef std::unordered_map< int, mpAxisData > | mpAxisList |
| Define the type for the list of axis. | |
| typedef std::function< void(void *Sender, const wxString &classname, bool &cancel)> | mpOnDeleteLayer |
| Define an event for when we delete a layer. More... | |
| typedef 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](void *Sender, wxMouseEvent &event, bool &cancel) { your_event_function(Sender, event, cancel);});. | |
| typedef enum __mp_Colour | mpColour |
| Enumeration of classic colour. | |
Functions | |
| struct | deprecated ("No more used, X and Y are now separated")]] mpFloatRect |
| A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer to Y axis. More... | |
| #define mpMOUSEMODE_DRAG 0 |
Mouse panning drags the view.
Mouse mode for mpWindow.
| #define mpMOUSEMODE_ZOOMBOX 1 |
Mouse panning creates a zoom box.
Mouse mode for mpWindow.
| #define mpX_LOCALTIME 0x10 |
When setting x labels in date/time format, convert input time to local time.
| #define mpX_UTCTIME 0x20 |
When setting x labels in date/time format, convert input time to UTC time (or just leave it raw).
| #define X_BORDER_SEPARATION 40 |
This directive allow the user to add a custom include.
For example, this can be useful if you have your own I18N management system MP_USER_INCLUDE simply needs to contain the name of the include file without the .h extension. A simple plot component for wxWidgets
| typedef enum __mp_Delete_Action mpDeleteAction |
Action to do with the object associated to the layer when we delete it.
We can:
| typedef std::function<void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer |
Define an event for when we delete a layer.
| Sender | the mpWindow |
| classname | the class name of the object we want to delete |
| cancel | if true, the deletion is canceled (default false) Use like this : your_plot->SetOnDeleteLayer([this](void *Sender, const wxString &classname, bool &cancel) { your_event_function(Sender, classname, cancel);}); |
| anonymous enum |
Command IDs used by mpWindow Same order for the popup menu.
| enum __Chart_Type |
sub_type values for mpLAYER_CHART
| Enumerator | |
|---|---|
| mpcChartNone | sub type not defined (should be never used) |
| mpcBarChart | sub type for mpBarChart |
| mpcPieChart | sub type for mpPieChart |
| mpcAllType | sub type for all layers who are chart.
|
| enum __Function_Type |
sub_type values for mpLAYER_PLOT and mpLAYER_LINE
| Enumerator | |
|---|---|
| mpfNone | sub type not defined (should be never used) |
| mpfFX | sub type for mpFX function |
| mpfFY | sub type for mpFY function |
| mpfFXY | sub type for mpFXY function |
| mpfFXYVector | sub type for mpFXYVector function |
| mpfMovable | sub type for mpMovableObject function |
| mpfLine | sub type for mpLine function |
| mpfAllType | sub type for all layers who are function.
|
| enum __Info_Type |
sub_type values for mpLAYER_INFO
| Enumerator | |
|---|---|
| mpiNone | sub type not defined (should be never used) |
| mpiInfo | sub type for mpInfoLayer layer |
| mpiCoords | sub type for mpInfoCoords layer |
| mpiLegend | sub type for mpInfoLegend layer |
| enum __mp_Delete_Action |
Action to do with the object associated to the layer when we delete it.
We can:
| enum __mp_Direction_Type |
| enum __mp_Layer_Type |
< Major type of an mpLayer (detail is in subtype)
| enum __mp_Layer_ZOrder |
Z order for drawing layer Background is the deeper (bitmap layer) Then draw axis, custom layer, function, info (info, coord, legend, ...) and finally text (text, title)
| enum __mp_Location_Type |
Location for the Info layer.
| Enumerator | |
|---|---|
| mpMarginLeftCenter | Align the info in margin center-left. |
| mpMarginTopLeft | Align the info in margin top-left. |
| mpMarginTopCenter | Align the info in margin center-top. |
| mpMarginTopRight | Align the info in margin top-right. |
| mpMarginRightCenter | Align the info in margin center-right. |
| mpMarginBottomLeft | Align the info in margin bottom-left. |
| mpMarginBottomCenter | Align the info in margin center-bottom. |
| mpMarginBottomRight | Align the info in margin bottom-right. |
| mpMarginNone | No alignment. |
| mpCursor | only for mpInfoCoords |
| enum __mp_Style_Type |
| enum __Scale_Type |
| enum __Symbol_Type |
| enum __Text_Type |
| enum __XAxis_Align_Type |
| enum __YAxis_Align_Type |
| enum mpAxisUpdate |
Define the axis we want to update.
Could be:
| enum mpLabelType |
enum for label for grid
| enum mpMouseButtonAction |
| struct deprecated | ( | "No more | used, |
| X and Y are now separated" | |||
| ) |
A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer to Y axis.
< range over x direction
< array of range over all y directions
Constructs a new mpFloatRect using it parent mpWindow to obtain the number of Y-scales to use. This makes sure that the y-size always matches the parant mpWindow y-size
| w | parent mpWindow from which to obtain informations |
Only allow constructor with mpWindow supplied
Is point inside this bounding box?
| px | x-coordinate |
| py | y-coordinate |
| yAxisID | the y-axis ID (default 0, the first y axis) |
Update bounding box to include this point
| px | x-coordinate |
| py | y-coordinate |
| yAxisID | the y-axis ID (default 0, the first y axis) |
Initialize bounding box with an initial point
| px | x-coordinate |
| py | y-coordinate |
| yAxisID | the y-axis ID (default 0, the first y axis) |
Is mpFloatRect set ?
Equal operator
1.8.13