A class providing graphs functionality for a 2D plot (either continuous or a set of points), from vectors of data.
This class can be used directly, the user does not need to derive any new class. Simply pass the data as two vectors with the same length containing the X and Y coordinates to the method SetData.
To generate a graph with a set of points, call
layerVar->SetContinuity(false)
or
layerVar->SetContinuity(true)
to render the sequence of coordinates as a continuous line.
(Added: Jose Luis Blanco, AGO-2007)
Definition at line 1281 of file mathplot.h.
#include <mrpt/otherlibs/mathplot/mathplot.h>
Public Member Functions | |
mpFXYVector (wxString name=wxEmptyString, int flags=mpALIGN_NE) | |
void | SetData (const std::vector< double > &xs, const std::vector< double > &ys) |
Changes the internal data: the set of points to draw. | |
void | SetData (const std::vector< float > &xs, const std::vector< float > &ys) |
Changes the internal data: the set of points to draw. | |
void | Clear () |
Clears all the data, leaving the layer empty. | |
size_t | GetDataLength () const |
Returns the number of data points currently hold in X & Y. | |
void | AppendDataPoint (float x, float y) |
Append a new data point (x,y) | |
double | GetMinX () |
Returns the actual minimum X data (loaded in SetData). | |
double | GetMinY () |
Returns the actual minimum Y data (loaded in SetData). | |
double | GetMaxX () |
Returns the actual maximum X data (loaded in SetData). | |
double | GetMaxY () |
Returns the actual maximum Y data (loaded in SetData). | |
Protected Member Functions | |
void | Rewind () |
Rewind value enumeration with mpFXY::GetNextXY. | |
bool | GetNextXY (double &x, double &y) |
Get locus value for next N. | |
Protected Attributes | |
std::vector< double > | m_xs |
The internal copy of the set of data to draw. | |
std::vector< double > | m_ys |
size_t | m_index |
The internal counter for the "GetNextXY" interface. | |
double | m_minX |
Loaded at SetData. | |
double | m_maxX |
double | m_minY |
double | m_maxY |
int | m_flags |
Holds label alignment. |
mpFXYVector::mpFXYVector | ( | wxString | name = wxEmptyString , |
int | flags = mpALIGN_NE |
||
) |
name | Label |
flags | Label alignment, pass one of mpALIGN_NE, mpALIGN_NW, mpALIGN_SW, mpALIGN_SE. |
void mpFXYVector::AppendDataPoint | ( | float | x, |
float | y | ||
) |
Append a new data point (x,y)
void mpFXYVector::Clear | ( | ) |
Clears all the data, leaving the layer empty.
size_t mpFXYVector::GetDataLength | ( | ) | const [inline] |
Returns the number of data points currently hold in X & Y.
Definition at line 1309 of file mathplot.h.
double mpFXYVector::GetMaxX | ( | ) | [inline, virtual] |
Returns the actual maximum X data (loaded in SetData).
Reimplemented from mpLayer.
Definition at line 1355 of file mathplot.h.
double mpFXYVector::GetMaxY | ( | ) | [inline, virtual] |
Returns the actual maximum Y data (loaded in SetData).
Reimplemented from mpLayer.
Definition at line 1359 of file mathplot.h.
double mpFXYVector::GetMinX | ( | ) | [inline, virtual] |
Returns the actual minimum X data (loaded in SetData).
Reimplemented from mpLayer.
Definition at line 1347 of file mathplot.h.
double mpFXYVector::GetMinY | ( | ) | [inline, virtual] |
Returns the actual minimum Y data (loaded in SetData).
Reimplemented from mpLayer.
Definition at line 1351 of file mathplot.h.
bool mpFXYVector::GetNextXY | ( | double & | x, |
double & | y | ||
) | [protected, virtual] |
Get locus value for next N.
Overridden in this implementation.
x | Returns X value |
y | Returns Y value |
Implements mpFXY.
void mpFXYVector::Rewind | ( | ) | [protected, virtual] |
Rewind value enumeration with mpFXY::GetNextXY.
Overridden in this implementation.
Implements mpFXY.
void mpFXYVector::SetData | ( | const std::vector< double > & | xs, |
const std::vector< double > & | ys | ||
) |
void mpFXYVector::SetData | ( | const std::vector< float > & | xs, |
const std::vector< float > & | ys | ||
) |
int mpFXYVector::m_flags [protected] |
size_t mpFXYVector::m_index [protected] |
The internal counter for the "GetNextXY" interface.
Definition at line 1326 of file mathplot.h.
double mpFXYVector::m_maxX [protected] |
Definition at line 1330 of file mathplot.h.
double mpFXYVector::m_maxY [protected] |
Definition at line 1330 of file mathplot.h.
double mpFXYVector::m_minX [protected] |
Loaded at SetData.
Definition at line 1330 of file mathplot.h.
double mpFXYVector::m_minY [protected] |
Definition at line 1330 of file mathplot.h.
std::vector<double> mpFXYVector::m_xs [protected] |
The internal copy of the set of data to draw.
Definition at line 1322 of file mathplot.h.
std::vector<double> mpFXYVector::m_ys [protected] |
Definition at line 1322 of file mathplot.h.
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011 |