Signalsmith's Basic C++ Plots  1.1.0
A minimal C++ plotting library
Nested Classes | Types | Methods | Attributes
signalsmith::plot::SvgWriter Class Reference

#include <plot.h>

Detailed Description

Wrapper for slightly more semantic code when writing SVGs.

Nested Classes

struct  Tag
 XML tag helper, closing the tag when it's destroyed. More...
 

Types

enum class  PointState { start , outOfBounds , singlePoint , pendingLine }
 

Methods

 SvgWriter (std::ostream &output, Bounds bounds, double precision)
 
SvgWriterraw ()
 
template<class First , class ... Args>
SvgWriterraw (First &&first, Args &&...args)
 
SvgWriterwrite ()
 
template<class First , class ... Args>
SvgWriterwrite (First &&v, Args &&...args)
 
template<class ... Args>
SvgWriterwrite (const char *str, Args &&...args)
 
template<class ... Args>
SvgWriterwrite (std::string str, Args &&...args)
 
template<class ... Args>
SvgWriterattr (const char *name, Args &&...args)
 
SvgWriterpushClip (Bounds b, double dataCheckPadding)
 
SvgWriterpopClip ()
 
std::string elementId (std::string prefix)
 
Tag tag (const char *name, bool selfClose=false)
 
Tag line (double x1, double y1, double x2, double y2)
 
Tag rect (double x, double y, double w, double h)
 
double round (double v)
 
void startPath ()
 
void endPath ()
 
void addPoint (double x, double y, bool alwaysInclude=false)
 

Attributes

bool animated = false
 
PointState pointState = PointState::start
 
char outOfBoundsMask = 0
 
Point2D lastDrawn
 
Point2D prevPoint
 
double totalPendingError = 0
 

Method Details

◆ addPoint()

void signalsmith::plot::SvgWriter::addPoint ( double  x,
double  y,
bool  alwaysInclude = false 
)
inline

Bitmask indicating which direction(s) the point is outside the bounds