MathPlot
Classes | Macros | Typedefs | Enumerations
mathplot.h File Reference
#include <vector>
#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 dependency graph for mathplot.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  mpRect
 A rectangle structure in several (integer) flavors. More...
 
struct  mpFloatRect
 A structure for computation of bounds in real units (not in screen pixel) X refer to X axis Y refer to Y axis Y2 refer to Y2 axis when it is defined. 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...
 
class  mpMagnet
 Class for drawing mouse magnetization. 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
 
#define WXDLLIMPEXP_DATA_MATHPLOT(type)   type
 
#define X_BORDER_SEPARATION   40
 A simple plot component for wxWidgets.
 
#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
 
#define EPSILON   1e-8
 
#define ISNOTNULL(x)   (fabs(x) > EPSILON)
 
#define EXTRA_MARGIN   8
 
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.
 
mpLayer implementations - furniture (scales, ...)
#define mpX_NORMAL   0x00
 Set label for X axis in normal mode.
 
#define mpX_TIME   0x01
 Set label for X axis in time mode: the value is represented as minutes:seconds.milliseconds if time is less than 2 minutes, hours:minutes:seconds otherwise. More...
 
#define mpX_HOURS   0x02
 Set label for X axis in hours mode: the value is always represented as hours:minutes:seconds. More...
 
#define mpX_DATE   0x03
 Set label for X axis in date mode: the value is always represented as yyyy-mm-dd. More...
 
#define mpX_DATETIME   0x04
 Set label for X axis in datetime mode: the value is always represented as yyyy-mm-ddThh:mm:ss. More...
 
#define mpX_USER   0x05
 Set label user defined.
 
#define mpX_NONE   0x06
 Set no label for X axis (useful for 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 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
 
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
 
typedef enum __Scale_Type mpScaleType
 
typedef enum __Chart_Type mpChartType
 
typedef enum __mp_Layer_Type mpLayerType
 
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 std::deque< mpLayer * > mpLayerList
 Define the type for the list of layers inside mpWindow.
 
typedef std::function< void(void *Sender, const wxString &classname, bool &cancel)> mpOnDeleteLayer
 Define an event for when we delete a layer Use like this : your_plot->SetOnDeleteLayer([this](void *Sender, const wxString &classname, bool &cancel) { your_event_function(Sender, classname, cancel);});.
 
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
 

Enumerations

enum  {
  mpID_FIT = 2000, mpID_ZOOM_IN, mpID_ZOOM_OUT, mpID_CENTER,
  mpID_LOCKASPECT, mpID_TOGGLE_GRID, mpID_TOGGLE_COORD, mpID_SCREENSHOT,
  mpID_LOAD_FILE, mpID_HELP_MOUSE, mpID_FULLSCREEN
}
 Command IDs used by mpWindow Same order for the popup menu. More...
 
enum  __mp_Location_Type {
  mpMarginLeftCenter, mpMarginTopLeft, mpMarginTopCenter, mpMarginTopRight,
  mpMarginRightCenter, mpMarginBottomLeft, mpMarginBottomCenter, mpMarginBottomRight,
  mpMarginNone, mpCursor
}
 Location for the Info layer.
 
enum  __XAxis_Align_Type {
  mpALIGN_BORDER_BOTTOM = 10, mpALIGN_BOTTOM, mpALIGN_CENTERX, mpALIGN_TOP,
  mpALIGN_BORDER_TOP
}
 Alignment for X axis.
 
enum  __YAxis_Align_Type {
  mpALIGN_BORDER_LEFT = 20, mpALIGN_LEFT, mpALIGN_CENTERY, mpALIGN_RIGHT,
  mpALIGN_BORDER_RIGHT
}
 Alignment for Y axis.
 
enum  __Plot_Align_Name_Type { mpALIGN_NW = 5, mpALIGN_NE, mpALIGN_SE, mpALIGN_SW }
 Plot alignment (which corner should plot be placed)
 
enum  __mp_Style_Type { mpLegendLine, mpLegendSquare, mpLegendSymbol }
 Style for the Legend layer. More...
 
enum  __mp_Direction_Type { mpVertical, mpHorizontal }
 Direction for the Legend layer. More...
 
enum  __Symbol_Type {
  mpsNone, mpsCircle, mpsSquare, mpsUpTriangle,
  mpsDownTriangle, mpsCross, mpsPlus
}
 
enum  __Info_Type { mpiNone, mpiInfo, mpiCoords, mpiLegend }
 sub_type values for mpLAYER_INFO
 
enum  __Text_Type { mptNone, mptText, mptTitle }
 sub_type values for mpLAYER_TEXT
 
enum  __Function_Type {
  mpfNone, mpfFX, mpfFY, mpfFXY,
  mpfFXYVector, mpfMovable, mpfLine, mpfAllType
}
 
enum  __Scale_Type { mpsScaleNone, mpsScaleX, mpsScaleY, mpsAllType }
 
enum  __Chart_Type { mpcChartNone, mpcBarChart, mpcPieChart, mpcAllType }
 
enum  __mp_Layer_Type {
  mpLAYER_UNDEF, mpLAYER_AXIS, mpLAYER_PLOT, mpLAYER_INFO,
  mpLAYER_TEXT, mpLAYER_BITMAP, mpLAYER_LINE, mpLAYER_CHART
}
 
enum  __mp_Layer_ZOrder {
  mpZIndex_BACKGROUND, mpZIndex_AXIS, mpZIndex_LINE, mpZIndex_PLOT,
  mpZIndex_CHART, mpZIndex_INFO, mpZIndex_TEXT, mpZIndex_END
}
 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) More...
 
enum  __mp_Colour {
  mpBlue, mpRed, mpGreen, mpPurple,
  mpYellow, mpFuchsia, mpLime, mpAqua,
  mpOlive
}
 

Macro Definition Documentation

◆ mpMOUSEMODE_DRAG

#define mpMOUSEMODE_DRAG   0

Mouse panning drags the view.

Mouse mode for mpWindow.

◆ mpMOUSEMODE_ZOOMBOX

#define mpMOUSEMODE_ZOOMBOX   1

Mouse panning creates a zoom box.

Mouse mode for mpWindow.

◆ mpX_DATE

#define mpX_DATE   0x03

Set label for X axis in date mode: the value is always represented as yyyy-mm-dd.

◆ mpX_DATETIME

#define mpX_DATETIME   0x04

Set label for X axis in datetime mode: the value is always represented as yyyy-mm-ddThh:mm:ss.

◆ mpX_HOURS

#define mpX_HOURS   0x02

Set label for X axis in hours mode: the value is always represented as hours:minutes:seconds.

◆ mpX_LOCALTIME

#define mpX_LOCALTIME   0x10

When setting x labels in date/time format, convert input time to local time.

◆ mpX_TIME

#define mpX_TIME   0x01

Set label for X axis in time mode: the value is represented as minutes:seconds.milliseconds if time is less than 2 minutes, hours:minutes:seconds otherwise.

◆ mpX_UTCTIME

#define mpX_UTCTIME   0x20

When setting x labels in date/time format, convert input time to UTC time (or just leave it raw).

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Command IDs used by mpWindow Same order for the popup menu.

Enumerator
mpID_FIT 

Fit view to match bounding box of all layers.

mpID_ZOOM_IN 

Zoom into view at clickposition / window center.

mpID_ZOOM_OUT 

Zoom out.

mpID_CENTER 

Center view on click position.

mpID_LOCKASPECT 

Lock x/y scaling aspect.

mpID_TOGGLE_GRID 

Show/Hide grids.

mpID_TOGGLE_COORD 

Show/Hide info coord.

mpID_SCREENSHOT 

Copy a screen shot to the clipboard.

mpID_LOAD_FILE 

Load a file.

mpID_HELP_MOUSE 

Shows information about the mouse commands.

mpID_FULLSCREEN 

Toggle fullscreen only if parent is a frame windows.

◆ __mp_Direction_Type

Direction for the Legend layer.

Enumerator
mpVertical 

each visible plot is described on its own line, one above the other

mpHorizontal 

legend components follow each other horizontally on a single line

◆ __mp_Layer_Type

Enumerator
mpLAYER_UNDEF 

Layer type undefined; SHOULD NOT BE USED.

mpLAYER_AXIS 

Axis type layer.

mpLAYER_PLOT 

Plot type layer.

mpLAYER_INFO 

Info box type layer.

mpLAYER_TEXT 

Text box type layer.

mpLAYER_BITMAP 

Bitmap type layer.

mpLAYER_LINE 

Line (horizontal or vertical) type layer.

mpLAYER_CHART 

Chart type layer (bar chart)

◆ __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)

Enumerator
mpZIndex_BACKGROUND 

Bitmap type layer.

mpZIndex_AXIS 

Axis type layer.

mpZIndex_LINE 

Line (horizontal or vertical) type layer.

mpZIndex_PLOT 

Plot (function) type layer.

mpZIndex_CHART 

Chart type layer.

mpZIndex_INFO 

Info box type layer.

mpZIndex_TEXT 

Text box type layer.

mpZIndex_END 

Just the end of ZOrder.

◆ __mp_Style_Type

Style for the Legend layer.

Enumerator
mpLegendLine 

Show legend items with line with the same pen of referred mpLayer.

mpLegendSquare 

Show legend items with small square with the same color of referred mpLayer.

mpLegendSymbol 

Show legend items with symbol used with the referred mpLayer.