Signalsmith's Basic C++ Plots  1.1.0
A minimal C++ plotting library
Methods | Protected Member Functions | Protected Attributes
signalsmith::plot::SvgDrawable Class Reference

#include <plot.h>

Detailed Description

Any drawable element.

Each element can draw to three layers: fill, stroke and label. Child elements are drawn in reverse order, so the earliest ones are drawn on top of each layer.

Copy/assign is disabled, to prevent accidental copying when you should be holding a reference.

Inherited by signalsmith::plot::HeatMap::EmbeddedHeatMap, signalsmith::plot::HeatMap::RetainedMap, signalsmith::plot::Image, signalsmith::plot::Line2D, signalsmith::plot::SvgFileDrawable, and signalsmith::plot::TextLabel.

Methods

 SvgDrawable (const SvgDrawable &other)=delete
 
SvgDrawableoperator= (const SvgDrawable &other)=delete
 
Bounds layoutIfNeeded (const PlotStyle &style)
 
void addChild (SvgDrawable *child, bool front=false)
 Takes ownership of the child. More...
 
virtual void writeData (SvgWriter &svg, const PlotStyle &style)
 
virtual void writeLabel (SvgWriter &svg, const PlotStyle &style)
 
virtual void toFrame (double time, bool clear=true)
 Creates a frame from the current stat, and optionally clears the state ready for the next frame. More...
 
virtual void loopFrame (double loopTime)
 Sets loop time (or < 0 to disable) More...
 
virtual void clearFrames ()
 Removes all animation frames. Mostly useful if re-using the diagram for multiple animations. More...
 

Protected Member Functions

void invalidateLayout ()
 
virtual void layout (const PlotStyle &style)
 
void addLayoutChild (SvgDrawable *child)
 These children are removed when the layout is invalidated. More...
 

Protected Attributes

Bounds bounds
 

Method Details

◆ addChild()

void signalsmith::plot::SvgDrawable::addChild ( SvgDrawable child,
bool  front = false 
)
inline

Takes ownership of the child.

◆ addLayoutChild()

void signalsmith::plot::SvgDrawable::addLayoutChild ( SvgDrawable child)
inlineprotected

These children are removed when the layout is invalidated.

◆ clearFrames()

virtual void signalsmith::plot::SvgDrawable::clearFrames ( )
inlinevirtual

Removes all animation frames. Mostly useful if re-using the diagram for multiple animations.

Reimplemented in signalsmith::plot::Grid, and signalsmith::plot::Line2D.

◆ loopFrame()

virtual void signalsmith::plot::SvgDrawable::loopFrame ( double  loopTime)
inlinevirtual

Sets loop time (or < 0 to disable)

Reimplemented in signalsmith::plot::Grid, and signalsmith::plot::Line2D.

◆ toFrame()

virtual void signalsmith::plot::SvgDrawable::toFrame ( double  time,
bool  clear = true 
)
inlinevirtual

Creates a frame from the current stat, and optionally clears the state ready for the next frame.

The time is the start-time of the frame being created.

Two lines with a different number of frames

Reimplemented in signalsmith::plot::Grid, and signalsmith::plot::Line2D.