KiCad PCB EDA Suite
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 <deque>
#include <algorithm>

Go to the source code of this file.

Classes

class  mpLayer
 
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  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  mpProfile
 Abstract base class providing plot and labeling functionality for functions F:Y->X. More...
 
class  mpScaleBase
 Plot layer implementing a x-scale ruler. More...
 
struct  mpScaleBase::TickLabel
 
class  mpScaleXBase
 
class  mpScaleX
 
class  mpScaleXLog
 
class  mpScaleY
 Plot layer implementing a y-scale ruler. More...
 
class  mpWindow
 Canvas for plotting mpLayer implementations. 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  mpText
 Plot layer implementing a text string. 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
 This virtual class represents objects that can be moved to an arbitrary 2D location+rotation. More...
 

Macros

#define WXDLLIMPEXP_MATHPLOT
 wxMathPlot is a framework for mathematical graph plotting in wxWindows. More...
 
#define WXDLLIMPEXP_DATA_MATHPLOT(type)   type
 
#define X_BORDER_SEPARATION   40
 
#define Y_BORDER_SEPARATION   60
 
Label alignment constants
#define mpALIGNMASK   0x03
 
#define mpALIGN_RIGHT   0x00
 Aligns label to the right. More...
 
#define mpALIGN_CENTER   0x01
 Aligns label to the center. More...
 
#define mpALIGN_LEFT   0x02
 Aligns label to the left. More...
 
#define mpALIGN_TOP   mpALIGN_RIGHT
 Aligns label to the top. More...
 
#define mpALIGN_BOTTOM   mpALIGN_LEFT
 Aligns label to the bottom. More...
 
#define mpALIGN_BORDER_BOTTOM   0x04
 Aligns X axis to bottom border. More...
 
#define mpALIGN_BORDER_TOP   0x05
 Aligns X axis to top border. More...
 
#define mpALIGN_FAR_RIGHT   0x06
 Aligns label to the right of mpALIGN_RIGHT. More...
 
#define mpX_NORMAL   0x00
 Set label for X axis in normal mode. More...
 
#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 mpALIGN_BORDER_LEFT   mpALIGN_BORDER_BOTTOM
 Aligns Y axis to left border. More...
 
#define mpALIGN_BORDER_RIGHT   mpALIGN_BORDER_TOP
 Aligns Y axis to right border. More...
 
#define mpALIGN_NE   0x00
 Aligns label to north-east. More...
 
#define mpALIGN_NW   0x01
 Aligns label to north-west. More...
 
#define mpALIGN_SW   0x02
 Aligns label to south-west. More...
 
#define mpALIGN_SE   0x03
 Aligns label to south-east. More...
 

Typedefs

typedef enum __mp_Layer_Type mpLayerType
 

Enumerations

enum  {
  mpID_FIT = 2000 , mpID_ZOOM_IN , mpID_ZOOM_OUT , mpID_CENTER ,
  mpID_LOCKASPECT
}
 Command IDs used by mpWindow. More...
 
enum  __mp_Layer_Type {
  mpLAYER_UNDEF , mpLAYER_AXIS , mpLAYER_PLOT , mpLAYER_INFO ,
  mpLAYER_BITMAP
}
 

Variables

class WXDLLIMPEXP_MATHPLOT mpLayer
 
class WXDLLIMPEXP_MATHPLOT mpFX
 
class WXDLLIMPEXP_MATHPLOT mpFY
 
class WXDLLIMPEXP_MATHPLOT mpFXY
 
class WXDLLIMPEXP_MATHPLOT mpFXYVector
 
class WXDLLIMPEXP_MATHPLOT mpScaleX
 
class WXDLLIMPEXP_MATHPLOT mpScaleY
 
class WXDLLIMPEXP_MATHPLOT mpWindow
 
class WXDLLIMPEXP_MATHPLOT mpText
 
class WXDLLIMPEXP_MATHPLOT mpPrintout
 

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...
 
typedef std::deque< mpLayer * > wxLayerList
 Define the type for the list of layers inside mpWindow. More...
 

Macro Definition Documentation

◆ mpALIGN_BORDER_BOTTOM

#define mpALIGN_BORDER_BOTTOM   0x04

Aligns X axis to bottom border.

For mpScaleX

Definition at line 487 of file mathplot.h.

◆ mpALIGN_BORDER_LEFT

#define mpALIGN_BORDER_LEFT   mpALIGN_BORDER_BOTTOM

Aligns Y axis to left border.

For mpScaleY

Definition at line 503 of file mathplot.h.

◆ mpALIGN_BORDER_RIGHT

#define mpALIGN_BORDER_RIGHT   mpALIGN_BORDER_TOP

Aligns Y axis to right border.

For mpScaleY

Definition at line 505 of file mathplot.h.

◆ mpALIGN_BORDER_TOP

#define mpALIGN_BORDER_TOP   0x05

Aligns X axis to top border.

For mpScaleX

Definition at line 489 of file mathplot.h.

◆ mpALIGN_BOTTOM

#define mpALIGN_BOTTOM   mpALIGN_LEFT

Aligns label to the bottom.

For use with mpFY.

Definition at line 485 of file mathplot.h.

◆ mpALIGN_CENTER

#define mpALIGN_CENTER   0x01

Aligns label to the center.

For use with mpFX and mpFY.

Definition at line 479 of file mathplot.h.

◆ mpALIGN_FAR_RIGHT

#define mpALIGN_FAR_RIGHT   0x06

Aligns label to the right of mpALIGN_RIGHT.

Definition at line 491 of file mathplot.h.

◆ mpALIGN_LEFT

#define mpALIGN_LEFT   0x02

Aligns label to the left.

For use with mpFX.

Definition at line 481 of file mathplot.h.

◆ mpALIGN_NE

#define mpALIGN_NE   0x00

Aligns label to north-east.

For use with mpFXY.

Definition at line 507 of file mathplot.h.

◆ mpALIGN_NW

#define mpALIGN_NW   0x01

Aligns label to north-west.

For use with mpFXY.

Definition at line 509 of file mathplot.h.

◆ mpALIGN_RIGHT

#define mpALIGN_RIGHT   0x00

Aligns label to the right.

For use with mpFX.

Definition at line 477 of file mathplot.h.

◆ mpALIGN_SE

#define mpALIGN_SE   0x03

Aligns label to south-east.

For use with mpFXY.

Definition at line 513 of file mathplot.h.

◆ mpALIGN_SW

#define mpALIGN_SW   0x02

Aligns label to south-west.

For use with mpFXY.

Definition at line 511 of file mathplot.h.

◆ mpALIGN_TOP

#define mpALIGN_TOP   mpALIGN_RIGHT

Aligns label to the top.

For use with mpFY.

Definition at line 483 of file mathplot.h.

◆ mpALIGNMASK

#define mpALIGNMASK   0x03

Definition at line 475 of file mathplot.h.

◆ mpMOUSEMODE_DRAG

#define mpMOUSEMODE_DRAG   0

Mouse panning drags the view.

Mouse mode for mpWindow.

Definition at line 1017 of file mathplot.h.

◆ mpMOUSEMODE_ZOOMBOX

#define mpMOUSEMODE_ZOOMBOX   1

Mouse panning creates a zoom box.

Mouse mode for mpWindow.

Definition at line 1019 of file mathplot.h.

◆ mpX_DATE

#define mpX_DATE   0x03

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

Definition at line 499 of file mathplot.h.

◆ 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.

Definition at line 501 of file mathplot.h.

◆ mpX_HOURS

#define mpX_HOURS   0x02

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

Definition at line 497 of file mathplot.h.

◆ mpX_NORMAL

#define mpX_NORMAL   0x00

Set label for X axis in normal mode.

Definition at line 493 of file mathplot.h.

◆ 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.

Definition at line 495 of file mathplot.h.

◆ WXDLLIMPEXP_DATA_MATHPLOT

#define WXDLLIMPEXP_DATA_MATHPLOT (   type)    type

Definition at line 62 of file mathplot.h.

◆ WXDLLIMPEXP_MATHPLOT

#define WXDLLIMPEXP_MATHPLOT

wxMathPlot is a framework for mathematical graph plotting in wxWindows.

The framework is designed for convenience and ease of use.

Screenshots

Go to the screenshots page.

Overview

The heart of wxMathPlot is mpWindow, which is a 2D canvas for plot layers. mpWindow can be embedded as subwindow in a wxPane, a wxFrame, or any other wxWindow. mpWindow provides a zoomable and moveable view of the layers. The current view can be controlled with the mouse, the scrollbars, and a context menu.

Plot layers are implementations of the abstract base class mpLayer. Those can be function plots, scale rulers, or any other vector data visualisation. wxMathPlot provides two mpLayer implementations for plotting horizontal and vertical rulers: mpScaleX and mpScaleY. For convenient function plotting a series of classes derived from mpLayer are provided, like mpFX, mpProfile, mpLegend and so on. These base classes already come with plot code, user's own functions can be implemented by overriding just one member for retrieving a function value.

mpWindow has built-in support for mouse-based pan and zoom through intuitive combinations of buttons and the mouse wheel. It also incorporates an optional double buffering mechanism to avoid flicker. Plots can be easily sent to printer evices or exported in bitmap formats like PNG, BMP or JPEG.

Coding conventions

wxMathPlot sticks to wxWindow's coding conventions. All entities defined by wxMathPlot have the prefix mp.

Author and license

wxMathPlot is published under the terms of the wxWindow license.
The original author is David Schalig mrhil[email protected][email protected][email protected]ers.s[email protected]ourc[email protected]eforg[email protected]e.ne[email protected]t.
From June 2007 the project is maintained by Davide Rondini cdron[email protected][email protected][email protected]sers.[email protected]sour[email protected]cefor[email protected]ge.n[email protected]et.
Authors can be contacted via the wxMathPlot's homepage at https://sourceforge.net/projects/wxmathplot
Contributors:
Jose Luis Blanco, Val Greene.

Definition at line 61 of file mathplot.h.

◆ X_BORDER_SEPARATION

#define X_BORDER_SEPARATION   40

Definition at line 94 of file mathplot.h.

◆ Y_BORDER_SEPARATION

#define Y_BORDER_SEPARATION   60

Definition at line 95 of file mathplot.h.

Typedef Documentation

◆ mpLayerType

◆ wxLayerList

typedef std::deque<mpLayer*> wxLayerList

Define the type for the list of layers inside mpWindow.

Definition at line 1024 of file mathplot.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Command IDs used by mpWindow.

Enumerator
mpID_FIT 
mpID_ZOOM_IN 
mpID_ZOOM_OUT 
mpID_CENTER 
mpID_LOCKASPECT 

Definition at line 113 of file mathplot.h.

114{
115 mpID_FIT = 2000, // !< Fit view to match bounding box of all layers
116 mpID_ZOOM_IN, // !< Zoom into view at clickposition / window center
117 mpID_ZOOM_OUT, // !< Zoom out
118 mpID_CENTER, // !< Center view on click position
119 mpID_LOCKASPECT, // !< Lock x/y scaling aspect
120};
@ mpID_FIT
Definition: mathplot.h:115
@ mpID_LOCKASPECT
Definition: mathplot.h:119
@ mpID_ZOOM_IN
Definition: mathplot.h:116
@ mpID_CENTER
Definition: mathplot.h:118
@ mpID_ZOOM_OUT
Definition: mathplot.h:117

◆ __mp_Layer_Type

Enumerator
mpLAYER_UNDEF 
mpLAYER_AXIS 
mpLAYER_PLOT 
mpLAYER_INFO 
mpLAYER_BITMAP 

Definition at line 126 of file mathplot.h.

127{
128 mpLAYER_UNDEF, // !< Layer type undefined
129 mpLAYER_AXIS, // !< Axis type layer
130 mpLAYER_PLOT, // !< Plot type layer
131 mpLAYER_INFO, // !< Info box type layer
132 mpLAYER_BITMAP // !< Bitmap type layer
@ mpLAYER_INFO
Definition: mathplot.h:131
@ mpLAYER_BITMAP
Definition: mathplot.h:132
@ mpLAYER_UNDEF
Definition: mathplot.h:128
@ mpLAYER_AXIS
Definition: mathplot.h:129
@ mpLAYER_PLOT
Definition: mathplot.h:130
enum __mp_Layer_Type mpLayerType

Variable Documentation

◆ mpFX

Definition at line 102 of file mathplot.h.

◆ mpFXY

Definition at line 104 of file mathplot.h.

◆ mpFXYVector

Definition at line 105 of file mathplot.h.

◆ mpFY

Definition at line 103 of file mathplot.h.

◆ mpLayer

Definition at line 101 of file mathplot.h.

◆ mpPrintout

Definition at line 110 of file mathplot.h.

◆ mpScaleX

Definition at line 106 of file mathplot.h.

◆ mpScaleY

Definition at line 107 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::updateAxes().

◆ mpText

Definition at line 109 of file mathplot.h.

◆ mpWindow

Definition at line 108 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().