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 "MathPlotConfig.h"
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  MathPlot::mpRect
 A rectangle structure in several (integer) flavors. More...
 
struct  MathPlot::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  MathPlot::mpLayer
 Plot layer, abstract base class. More...
 
class  MathPlot::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  MathPlot::mpInfoCoords
 Implements an overlay box which shows the mouse coordinates in plot units. More...
 
class  MathPlot::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  MathPlot::mpFunction
 Plot layer implementing an abstract function plot class. More...
 
class  MathPlot::mpLine
 Abstract class providing a line. More...
 
class  MathPlot::mpHorizontalLine
 Abstract class providing an horizontal line. More...
 
class  MathPlot::mpVerticalLine
 Abstract class providing an vertical line. More...
 
class  MathPlot::mpFX
 Abstract base class providing plot and labeling functionality for functions F:X->Y. More...
 
class  MathPlot::mpFY
 Abstract base class providing plot and labeling functionality for functions F:Y->X. More...
 
class  MathPlot::mpFXY
 Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y. More...
 
class  MathPlot::mpFXYVector
 A class providing graphs functionality for a 2D plot (either continuous or a set of points), from vectors of data. More...
 
class  MathPlot::mpProfile
 Abstract base class providing plot and labeling functionality for functions F:Y->X. More...
 
class  MathPlot::mpChart
 abstract Layer for chart (bar and pie). More...
 
class  MathPlot::mpBarChart
 Layer for bar chart. More...
 
class  MathPlot::mpPieChart
 Layer for pie chart. More...
 
class  MathPlot::mpScale
 Plot layer implementing an abstract scale ruler. More...
 
class  MathPlot::mpScaleX
 Plot layer implementing a x-scale ruler. More...
 
class  MathPlot::mpScaleY
 Plot layer implementing a y-scale ruler. More...
 
class  MathPlot::mpMagnet
 Class for drawing mouse magnetization. More...
 
class  MathPlot::mpWindow
 Canvas for plotting mpLayer implementations. More...
 
class  MathPlot::mpText
 Plot layer implementing a text string. More...
 
class  MathPlot::mpTitle
 Plot layer implementing a simple title. More...
 
class  MathPlot::mpPrintout
 Printout class used by mpWindow to draw in the objects to be printed. More...
 
class  MathPlot::mpMovableObject
 This virtual class represents objects that can be moved to an arbitrary 2D location+rotation. More...
 
class  MathPlot::mpCovarianceEllipse
 A 2D ellipse, described by a 2x2 covariance matrix. More...
 
class  MathPlot::mpPolygon
 An arbitrary polygon, descendant of mpMovableObject. More...
 
class  MathPlot::mpBitmapLayer
 A layer that allows you to have a bitmap image printed in the mpWindow. More...
 
class  MathPlot::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 ENABLE_MP_CONFIG
 
#define ENABLE_MP_NAMESPACE
 A simple plot component for wxWidgets.
 
#define X_BORDER_SEPARATION   40
 
#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 MathPlot::__mp_Location_Type MathPlot::mpLocation
 Location for the Info layer.
 
typedef enum MathPlot::__XAxis_Align_Type MathPlot::mpXAxis_Align
 Alignment for X axis.
 
typedef enum MathPlot::__YAxis_Align_Type MathPlot::mpYAxis_Align
 Alignment for Y axis.
 
typedef enum MathPlot::__Plot_Align_Name_Type MathPlot::mpPlot_Align
 Plot alignment (which corner should plot be placed)
 
typedef enum MathPlot::__mp_Style_Type MathPlot::mpLegendStyle
 Style for the Legend layer.
 
typedef enum MathPlot::__mp_Direction_Type MathPlot::mpLegendDirection
 Direction for the Legend layer.
 
typedef enum MathPlot::__Symbol_Type MathPlot::mpSymbol
 
typedef enum MathPlot::__Info_Type MathPlot::mpInfoType
 sub_type values for mpLAYER_INFO
 
typedef enum MathPlot::__Text_Type MathPlot::mpTextType
 sub_type values for mpLAYER_TEXT
 
typedef enum MathPlot::__Function_Type MathPlot::mpFunctionType
 
typedef enum MathPlot::__Scale_Type MathPlot::mpScaleType
 
typedef enum MathPlot::__Chart_Type MathPlot::mpChartType
 
typedef enum MathPlot::__mp_Layer_Type MathPlot::mpLayerType
 
typedef enum MathPlot::__mp_Layer_ZOrder MathPlot::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 * > MathPlot::mpLayerList
 Define the type for the list of layers inside mpWindow.
 
typedef std::function< void(void *Sender, const wxString &classname, bool &cancel)> MathPlot::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)> MathPlot::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 MathPlot::__mp_Colour MathPlot::mpColour
 

Enumerations

enum  {
  MathPlot::mpID_FIT = 2000, MathPlot::mpID_ZOOM_IN, MathPlot::mpID_ZOOM_OUT, MathPlot::mpID_CENTER,
  MathPlot::mpID_LOCKASPECT, MathPlot::mpID_TOGGLE_GRID, MathPlot::mpID_TOGGLE_COORD, MathPlot::mpID_SCREENSHOT,
  MathPlot::mpID_CONFIG, MathPlot::mpID_LOAD_FILE, MathPlot::mpID_HELP_MOUSE, MathPlot::mpID_FULLSCREEN
}
 Command IDs used by mpWindow Same order for the popup menu. More...
 
enum  MathPlot::__mp_Location_Type {
  mpMarginLeftCenter, mpMarginTopLeft, mpMarginTopCenter, mpMarginTopRight,
  mpMarginRightCenter, mpMarginBottomLeft, mpMarginBottomCenter, mpMarginBottomRight,
  mpMarginNone, mpCursor
}
 Location for the Info layer.
 
enum  MathPlot::__XAxis_Align_Type {
  mpALIGN_BORDER_BOTTOM = 10, mpALIGN_BOTTOM, mpALIGN_CENTERX, mpALIGN_TOP,
  mpALIGN_BORDER_TOP
}
 Alignment for X axis.
 
enum  MathPlot::__YAxis_Align_Type {
  mpALIGN_BORDER_LEFT = 20, mpALIGN_LEFT, mpALIGN_CENTERY, mpALIGN_RIGHT,
  mpALIGN_BORDER_RIGHT
}
 Alignment for Y axis.
 
enum  MathPlot::__Plot_Align_Name_Type { mpALIGN_NW = 5, mpALIGN_NE, mpALIGN_SE, mpALIGN_SW }
 Plot alignment (which corner should plot be placed)
 
enum  MathPlot::__mp_Style_Type { MathPlot::mpLegendLine, MathPlot::mpLegendSquare, MathPlot::mpLegendSymbol }
 Style for the Legend layer. More...
 
enum  MathPlot::__mp_Direction_Type { MathPlot::mpVertical, MathPlot::mpHorizontal }
 Direction for the Legend layer. More...
 
enum  __Symbol_Type {
  mpsNone, mpsCircle, mpsSquare, mpsUpTriangle,
  mpsDownTriangle, mpsCross, mpsPlus
}
 
enum  MathPlot::__Info_Type { mpiNone, mpiInfo, mpiCoords, mpiLegend }
 sub_type values for mpLAYER_INFO
 
enum  MathPlot::__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  MathPlot::__mp_Layer_Type {
  MathPlot::mpLAYER_UNDEF, MathPlot::mpLAYER_AXIS, MathPlot::mpLAYER_PLOT, MathPlot::mpLAYER_INFO,
  MathPlot::mpLAYER_TEXT, MathPlot::mpLAYER_BITMAP, MathPlot::mpLAYER_LINE, MathPlot::mpLAYER_CHART
}
 
enum  MathPlot::__mp_Layer_ZOrder {
  MathPlot::mpZIndex_BACKGROUND, MathPlot::mpZIndex_AXIS, MathPlot::mpZIndex_LINE, MathPlot::mpZIndex_PLOT,
  MathPlot::mpZIndex_CHART, MathPlot::mpZIndex_INFO, MathPlot::mpZIndex_TEXT, MathPlot::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_CONFIG 

Configuration.

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.