scenepic 1.1.0
3D Visualization Made Easy
Classes | Public Member Functions | Friends | List of all members
scenepic::Graph Class Reference

A 2D viewport that animates one or more sparklines. More...

#include <graph.h>

Classes

struct  Margin
 Represents the margin along the edges of a graph. More...
 
struct  VerticalRule
 Represents a vertical line in a sparkline graph. More...
 

Public Member Functions

const std::string & canvas_id () const
 A unique identifier for the canvas. More...
 
void add_sparkline (const std::string &name, const std::vector< float > &values, const scenepic::Color &line_color=scenepic::Colors::Black, float line_width=1.0f, const std::vector< VerticalRule > &vertical_rules={})
 Adds a sparkline to the graph. More...
 
std::string to_string () const
 Return a JSON string representing the object. More...
 
JsonValue to_json () const
 Convert this object into ScenePic json. More...
 
const Colorbackground_color () const
 The background color of the frame. More...
 
Graphbackground_color (const Color &color)
 Set the background color of the frame. More...
 
const Marginmargin () const
 The outside margin of the graph. More...
 
Graphmargin (const Margin &margin)
 Set the outside margin of the graph. More...
 
const std::string & name_align () const
 How to align the sparkline label (one of 'left', 'right', 'top', 'bottom', or 'none') More...
 
Graphname_align (const std::string &name_align)
 How to align the sparkline label (one of 'left', 'right', 'top', 'bottom', or 'none') More...
 
const std::string & value_align () const
 How to align the sparkline value (one of 'left', 'right', 'top', 'bottom', or 'none') More...
 
Graphvalue_align (const std::string &value_align)
 How to align the sparkline value (one of 'left', 'right', 'top', 'bottom', or 'none') More...
 
const std::string & font_family () const
 The font family used for the graph labels. More...
 
Graphfont_family (const std::string &font_family)
 Set the font family used for the graph labels. More...
 
float name_size () const
 The size of the graph labels in pixels. More...
 
Graphname_size (float name_size)
 Set the size of the graph labels in pixels. More...
 
float value_size () const
 The size of the graph labels in pixels. More...
 
Graphvalue_size (float value_size)
 Set the size of the graph labels in pixels. More...
 
const std::string & media_id () const
 The unique ID of the media file associated with this canvas. More...
 
Graphmedia_id (const std::string &media_id)
 The unique ID of the media file associated with this canvas. More...
 

Friends

class Scene
 

Detailed Description

A 2D viewport that animates one or more sparklines.

Member Function Documentation

◆ add_sparkline()

void scenepic::Graph::add_sparkline ( const std::string &  name,
const std::vector< float > &  values,
const scenepic::Color line_color = scenepic::Colors::Black,
float  line_width = 1.0f,
const std::vector< VerticalRule > &  vertical_rules = {} 
)

Adds a sparkline to the graph.

Parameters
namethe name of the measured quantity
valuesa vector of measured values, one per frame
line_colorthe color of the line (and its labels)
line_widththe width of the line
vertical_rulesvertical rules to draw on the sparkline

◆ background_color() [1/2]

const Color & scenepic::Graph::background_color ( ) const

The background color of the frame.

◆ background_color() [2/2]

Graph & scenepic::Graph::background_color ( const Color color)

Set the background color of the frame.

◆ canvas_id()

const std::string & scenepic::Graph::canvas_id ( ) const

A unique identifier for the canvas.

◆ font_family() [1/2]

const std::string & scenepic::Graph::font_family ( ) const

The font family used for the graph labels.

◆ font_family() [2/2]

Graph & scenepic::Graph::font_family ( const std::string &  font_family)

Set the font family used for the graph labels.

◆ margin() [1/2]

const Margin & scenepic::Graph::margin ( ) const

The outside margin of the graph.

◆ margin() [2/2]

Graph & scenepic::Graph::margin ( const Margin margin)

Set the outside margin of the graph.

◆ media_id() [1/2]

const std::string & scenepic::Graph::media_id ( ) const

The unique ID of the media file associated with this canvas.

This file will be used to drive playback, i.e. frames will be displayed in time with of the media file.

◆ media_id() [2/2]

Graph & scenepic::Graph::media_id ( const std::string &  media_id)

The unique ID of the media file associated with this canvas.

◆ name_align() [1/2]

const std::string & scenepic::Graph::name_align ( ) const

How to align the sparkline label (one of 'left', 'right', 'top', 'bottom', or 'none')

◆ name_align() [2/2]

Graph & scenepic::Graph::name_align ( const std::string &  name_align)

How to align the sparkline label (one of 'left', 'right', 'top', 'bottom', or 'none')

◆ name_size() [1/2]

float scenepic::Graph::name_size ( ) const

The size of the graph labels in pixels.

◆ name_size() [2/2]

Graph & scenepic::Graph::name_size ( float  name_size)

Set the size of the graph labels in pixels.

◆ to_json()

JsonValue scenepic::Graph::to_json ( ) const

Convert this object into ScenePic json.

Returns
a json value

◆ to_string()

std::string scenepic::Graph::to_string ( ) const

Return a JSON string representing the object.

◆ value_align() [1/2]

const std::string & scenepic::Graph::value_align ( ) const

How to align the sparkline value (one of 'left', 'right', 'top', 'bottom', or 'none')

◆ value_align() [2/2]

Graph & scenepic::Graph::value_align ( const std::string &  value_align)

How to align the sparkline value (one of 'left', 'right', 'top', 'bottom', or 'none')

◆ value_size() [1/2]

float scenepic::Graph::value_size ( ) const

The size of the graph labels in pixels.

◆ value_size() [2/2]

Graph & scenepic::Graph::value_size ( float  value_size)

Set the size of the graph labels in pixels.

Friends And Related Function Documentation

◆ Scene

friend class Scene
friend

The documentation for this class was generated from the following file: