GClasses
|
This class simplifies plotting data to an SVG file.
#include <GPlot.h>
Public Types |
Public Member Functions | |
GSVG (size_t width, size_t height, size_t hWindows=1, size_t vWindows=1) | |
This object represents a hWindows-by-vWindows grid of charts. Typically, hWindows and vWindows are 1, so this is just a single chart, but you may specify larger values to produce a grid of charts. width and height specify the width and height of the entire grid of charts. An equal portion of the width and height is given to each chart in the grid. More... | |
~GSVG () | |
void | add_raw (const char *string) |
Writes some raw SVG code to the stream. More... | |
void | clip () |
After calling this method, all draw operations will be clipped to fall within (xmin, ymin)-(xmax, ymax), until a new chart is started. More... | |
void | dot (double x, double y, double r=1.0, unsigned int col=0x000080) |
Draw a dot. More... | |
double | horizLabelPos () |
Returns a good y position for the horizontal axis label. More... | |
void | horizMarks (int maxLabels, bool notext=false, std::vector< std::string > *pLabels=NULL) |
Label the horizontal axis. If maxLabels is 0, then no grid-lines will be drawn. If maxLabels is -1, then Logarithmic grid-lines will be drawn. If pLabels is non-NULL, then its values will be used to label the grid-lines instead of the continuous values. More... | |
double | hunit () |
Returns (xmax - xmin) / width, which is often a useful size. More... | |
void | line (double x1, double y1, double x2, double y2, double thickness=1.0, unsigned int col=0x008000) |
Draw a line. More... | |
void | newChart (double xmin, double ymin, double xmax, double ymax, size_t hPos=0, size_t vPos=0, double margin=100) |
Start a new chart. This method must be called before any drawing operations are performed. xmin, ymin, xmax, and ymax specify the coordinates in the chart to begin drawing. If this contains more than a 1x1 grid of charts, then you may call this method again to begin drawing a different chart in the grid. hPos and vPos specify which chart in the grid to begin drawing. More... | |
void | print (std::ostream &stream) |
Generate an SVG file with all of the components that have been added so far. More... | |
void | rect (double x, double y, double w, double h, unsigned int col=0x008080) |
Draw a rectangle. More... | |
void | text (double x, double y, const char *szText, double size=1.0, Anchor eAnchor=Start, unsigned int col=0x000000, double angle=0.0, bool serifs=true) |
Draw text. More... | |
double | vertLabelPos () |
Returns a good x position for the vertical axis label. More... | |
void | vertMarks (int maxLabels, bool notext=false, std::vector< std::string > *pLabels=NULL) |
Label the vertical axis. If maxLabels is 0, then no grid-lines will be drawn. If maxLabels is -1, then Logarithmic grid-lines will be drawn. If pLabels is non-NULL, then its values will be used to label the grid-lines instead of the continuous values. More... | |
double | vunit () |
Returns (ymax - ymin) / height, which is often a useful size. More... | |
Protected Member Functions | |
void | closeTags () |
void | color (unsigned int c) |
Protected Attributes | |
bool | m_clipping |
size_t | m_height |
size_t | m_hPos |
double | m_hunit |
size_t | m_hWindows |
double | m_margin |
std::stringstream | m_ss |
size_t | m_vPos |
double | m_vunit |
size_t | m_vWindows |
size_t | m_width |
double | m_xmax |
double | m_xmin |
double | m_ymax |
double | m_ymin |
GClasses::GSVG::GSVG | ( | size_t | width, |
size_t | height, | ||
size_t | hWindows = 1 , |
||
size_t | vWindows = 1 |
||
) |
This object represents a hWindows-by-vWindows grid of charts. Typically, hWindows and vWindows are 1, so this is just a single chart, but you may specify larger values to produce a grid of charts. width and height specify the width and height of the entire grid of charts. An equal portion of the width and height is given to each chart in the grid.
GClasses::GSVG::~GSVG | ( | ) |
void GClasses::GSVG::add_raw | ( | const char * | string | ) |
Writes some raw SVG code to the stream.
void GClasses::GSVG::clip | ( | ) |
After calling this method, all draw operations will be clipped to fall within (xmin, ymin)-(xmax, ymax), until a new chart is started.
|
protected |
|
protected |
void GClasses::GSVG::dot | ( | double | x, |
double | y, | ||
double | r = 1.0 , |
||
unsigned int | col = 0x000080 |
||
) |
Draw a dot.
double GClasses::GSVG::horizLabelPos | ( | ) |
Returns a good y position for the horizontal axis label.
void GClasses::GSVG::horizMarks | ( | int | maxLabels, |
bool | notext = false , |
||
std::vector< std::string > * | pLabels = NULL |
||
) |
Label the horizontal axis. If maxLabels is 0, then no grid-lines will be drawn. If maxLabels is -1, then Logarithmic grid-lines will be drawn. If pLabels is non-NULL, then its values will be used to label the grid-lines instead of the continuous values.
|
inline |
Returns (xmax - xmin) / width, which is often a useful size.
void GClasses::GSVG::line | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2, | ||
double | thickness = 1.0 , |
||
unsigned int | col = 0x008000 |
||
) |
Draw a line.
void GClasses::GSVG::newChart | ( | double | xmin, |
double | ymin, | ||
double | xmax, | ||
double | ymax, | ||
size_t | hPos = 0 , |
||
size_t | vPos = 0 , |
||
double | margin = 100 |
||
) |
Start a new chart. This method must be called before any drawing operations are performed. xmin, ymin, xmax, and ymax specify the coordinates in the chart to begin drawing. If this contains more than a 1x1 grid of charts, then you may call this method again to begin drawing a different chart in the grid. hPos and vPos specify which chart in the grid to begin drawing.
void GClasses::GSVG::print | ( | std::ostream & | stream | ) |
Generate an SVG file with all of the components that have been added so far.
void GClasses::GSVG::rect | ( | double | x, |
double | y, | ||
double | w, | ||
double | h, | ||
unsigned int | col = 0x008080 |
||
) |
Draw a rectangle.
void GClasses::GSVG::text | ( | double | x, |
double | y, | ||
const char * | szText, | ||
double | size = 1.0 , |
||
Anchor | eAnchor = Start , |
||
unsigned int | col = 0x000000 , |
||
double | angle = 0.0 , |
||
bool | serifs = true |
||
) |
Draw text.
double GClasses::GSVG::vertLabelPos | ( | ) |
Returns a good x position for the vertical axis label.
void GClasses::GSVG::vertMarks | ( | int | maxLabels, |
bool | notext = false , |
||
std::vector< std::string > * | pLabels = NULL |
||
) |
Label the vertical axis. If maxLabels is 0, then no grid-lines will be drawn. If maxLabels is -1, then Logarithmic grid-lines will be drawn. If pLabels is non-NULL, then its values will be used to label the grid-lines instead of the continuous values.
|
inline |
Returns (ymax - ymin) / height, which is often a useful size.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |