OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
Loading...
Searching...
No Matches
openpine::Graph Class Reference

Represents a non-series graph in a chart. More...

#include <graph.hpp>

Public Member Functions

 Graph (const ffi::Graph *p)
 Constructs a Graph wrapper around the given pointer.
GraphType type () const
 Gets the type of the graph.
std::optional< graph::HlineasHline () const
 Gets the hline payload, if this graph is an hline.
std::optional< graph::LabelasLabel () const
 Gets the label payload, if this graph is a label.
std::optional< graph::LineasLine () const
 Gets the line payload, if this graph is a line.
std::optional< graph::LineFillasLineFill () const
 Gets the line-fill payload, if this graph is a line fill.
std::optional< graph::BoxasBox () const
 Gets the box payload, if this graph is a box.
std::optional< graph::PolylineasPolyline () const
 Gets the polyline payload, if this graph is a polyline.
std::optional< graph::TableasTable () const
 Gets the table payload, if this graph is a table.

Detailed Description

Represents a non-series graph in a chart.

A Graph is a tagged union of draw primitives (hline, label, line, box, etc.). Use type() to inspect the kind, then call the corresponding asXxx() accessor.

Definition at line 36 of file graph.hpp.

Constructor & Destructor Documentation

◆ Graph()

openpine::Graph::Graph ( const ffi::Graph * p)
inline

Constructs a Graph wrapper around the given pointer.

Definition at line 42 of file graph.hpp.

Member Function Documentation

◆ asBox()

std::optional< graph::Box > openpine::Graph::asBox ( ) const
inline

Gets the box payload, if this graph is a box.

Returns
graph::Box when type() == GraphType::Box, else std::nullopt.

Definition at line 107 of file graph.hpp.

◆ asHline()

std::optional< graph::Hline > openpine::Graph::asHline ( ) const
inline

Gets the hline payload, if this graph is an hline.

Returns
graph::Hline when type() == GraphType::Hline, else std::nullopt.

Definition at line 55 of file graph.hpp.

◆ asLabel()

std::optional< graph::Label > openpine::Graph::asLabel ( ) const
inline

Gets the label payload, if this graph is a label.

Returns
graph::Label when type() == GraphType::Label, else std::nullopt.

Definition at line 68 of file graph.hpp.

◆ asLine()

std::optional< graph::Line > openpine::Graph::asLine ( ) const
inline

Gets the line payload, if this graph is a line.

Returns
graph::Line when type() == GraphType::Line, else std::nullopt.

Definition at line 81 of file graph.hpp.

◆ asLineFill()

std::optional< graph::LineFill > openpine::Graph::asLineFill ( ) const
inline

Gets the line-fill payload, if this graph is a line fill.

Returns
graph::LineFill when type() == GraphType::LineFill, else std::nullopt.

Definition at line 94 of file graph.hpp.

◆ asPolyline()

std::optional< graph::Polyline > openpine::Graph::asPolyline ( ) const
inline

Gets the polyline payload, if this graph is a polyline.

Returns
graph::Polyline when type() == GraphType::Polyline, else std::nullopt.

Definition at line 120 of file graph.hpp.

◆ asTable()

std::optional< graph::Table > openpine::Graph::asTable ( ) const
inline

Gets the table payload, if this graph is a table.

Returns
graph::Table when type() == GraphType::Table, else std::nullopt.

Definition at line 133 of file graph.hpp.

◆ type()

GraphType openpine::Graph::type ( ) const
inline

Gets the type of the graph.

Returns
The graph type tag.

Definition at line 48 of file graph.hpp.


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