Plaquette
 
Loading...
Searching...
No Matches
pq::PlotterFormat Struct Reference

Formatting specification used by Plotter to render values and (optionally) a header. More...

#include <PlotterFormat.h>

Public Member Functions

void beginPlot (Print &out) const
 
void endPlot (Print &out) const
 
void beginRow (Print &out) const
 
void endRow (Print &out) const
 
void sep (Print &out) const
 
void printValueElement (Print &out, uint16_t index, LabelView label, float value, uint8_t digits, bool isFirst) const
 Print one element for a normal (value) row.
 
void printKeyElement (Print &out, uint16_t index, LabelView label, uint8_t digits, bool isFirst) const
 Print one element for a header (key) row.
 

Static Public Member Functions

static void printString (Print &out, const char *str)
 

Public Attributes

const char * plotBegin = ""
 
const char * plotEnd = ""
 
const char * rowBegin = ""
 
const char * rowEnd = "\r\n"
 
const char * separator = ","
 
const char * valueTemplate = "$v"
 
const char * keyTemplate = "$k"
 
bool headerEnabled = false
 
bool trailingSeparator = false
 
bool trailingRowEnd = true
 
const char * keyFallback = "value_$i"
 

Detailed Description

Formatting specification used by Plotter to render values and (optionally) a header.

This is intentionally minimal:

  • The row and the header share the same framing (begin/end/separator).
  • The only difference is which template is used:
    • valueTemplate: used for normal rows
    • keyTemplate: used for header row (keys)

Template mini-language:

  • $v : numeric value (float) printed with the provided precision
  • $i : element index (0-based)
  • $k : key/label (LabelView) if available, otherwise keyFallback

Escaping:

  • Backslash escapes the next character: "\$" prints '$'
  • "\X" prints 'X' for any character X

Unknown $-tokens are printed literally (e.g., "$q" prints "$q").

Member Function Documentation

◆ printKeyElement()

void pq::PlotterFormat::printKeyElement ( Print &  out,
uint16_t  index,
LabelView  label,
uint8_t  digits,
bool  isFirst 
) const

Print one element for a header (key) row.

Typically Plotter will call this only when labels exist, but this function also applies keyFallback if label is missing for the index.

◆ printValueElement()

void pq::PlotterFormat::printValueElement ( Print &  out,
uint16_t  index,
LabelView  label,
float  value,
uint8_t  digits,
bool  isFirst 
) const

Print one element for a normal (value) row.

Parameters
outOutput device
indexElement index (0-based)
labelLabel for this index (may be empty)
valueValue for this element
digitsDigits after decimal point (Arduino Print convention)
isFirstWhether this is the first element in the row

The documentation for this struct was generated from the following files: