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

#include <plot.h>

Detailed Description

Plotting style, used for both layout and SVG rendering.

Colour/dash/hatch styles are defined as CSS classes, assigned to elements based on their integer style index. CSS is written inline in the SVG, and can be extended/overridden with .cssPrefix/.cssSuffix.

It generates CSS classes from .colours (svg-plot-sN/svg-plot-fN/svg-plot-tN for stroke/fill/text), .dashes (svg-plot-dN) and .hatches (svg-plot-hN), where N is the index - e.g. there are six colours by default, generating svg-plot-s0 to svg-plot-s5.

Nested Classes

struct  Counter
 
struct  Hatch
 

Methods

std::string strokeClass (const Counter &counter) const
 
std::string fillClass (const Counter &counter) const
 
std::string textClass (const Counter &counter) const
 
std::string dashClass (const Counter &counter) const
 
std::string hatchClass (const Counter &counter) const
 
std::string markerId (const Counter &counter) const
 
const std::string & markerRaw (const Counter &counter) const
 
void css (std::ostream &o) const
 

Attributes

double scale = 1
 scales the entire plot (including adjusting the precision) More...
 
double padding = 10
 
double lineWidth = 1.5
 
double precision = 100
 
double markerSize = 3.25
 
double tickH = 4
 
double tickV = 4
 
double labelSize = 12
 
double valueSize = 10
 
double fontAspectRatio = 1
 scales size estimates, if using a particularly wide font More...
 
double textPadding = 5
 
double lineHeight = 1.2
 
double fillOpacity = 0.28
 
double hatchWidth = 1
 
double hatchSpacing = 3
 
double animation = 2
 Animation duration. More...
 
std::string scriptHref = ""
 
std::string scriptSrc = ""
 
std::string cssPrefix = ""
 
std::string cssSuffix = ""
 
std::vector< std::string > colours = {"#0073E6", "#CC0000", "#00B300", "#806600", "#E69900", "#CC00CC"}
 
std::vector< std::vector< double > > dashes = {{}, {1.2, 1.2}, {2.8, 1.6}, {5, 4}, {4, 1, 1, 1, 1, 1}, {10, 3}, {4, 2, 1, 2}}
 
std::vector< std::string > markers
 SVG literals for the markers. These should be centered on (0, 0) and look correct next to a filled circle of radius 1. They will be given both a stroke and fill-class, so they should specify fill="none"/stroke="none" if fill/stroke is not wanted. More...
 
std::vector< Hatchhatches = {{}, {-50}, {{30}, 0.9, 0.8}, {{8, 93}, 0.7, 1}}
 

Member Data Documentation

◆ animation

double signalsmith::plot::PlotStyle::animation = 2

Animation duration.

◆ fontAspectRatio

double signalsmith::plot::PlotStyle::fontAspectRatio = 1

scales size estimates, if using a particularly wide font

◆ markers

std::vector<std::string> signalsmith::plot::PlotStyle::markers
Initial value:
= {
"<circle cx=\"0\" cy=\"0\" r=\"1\" stroke=\"none\"/>",
"<path d=\"M0 0.9 -0.9 0 0 -0.9 0.9 0Z\" fill=\"#FFFA\" stroke-linejoin=\"miter\" stroke-width=\"0.5\"/>",
"<path fill=\"none\" d=\"M0 -1.2 0 1.2 M -1.2 0 1.2 0\" stroke-width=\"0.6\"/>",
"<circle cx=\"0\" cy=\"0\" fill=\"#FFFA\" r=\"0.82\" stroke-width=\"0.55\"/>",
"<path stroke=\"none\" d=\"M0 -1.25 1.25 0.9 -1.25 0.9Z\"/>",
}

SVG literals for the markers. These should be centered on (0, 0) and look correct next to a filled circle of radius 1. They will be given both a stroke and fill-class, so they should specify fill="none"/stroke="none" if fill/stroke is not wanted.

◆ scale

double signalsmith::plot::PlotStyle::scale = 1

scales the entire plot (including adjusting the precision)