Plotly.cpp 0.1.0
A C++ plotting library for expressive, interactive, real-time & streaming data visualization
Loading...
Searching...
No Matches
plotly::Figure::Impl Class Reference

Public Member Functions

 Impl (const std::filesystem::path &webappPath)
 ~Impl ()
void waitConnection () const
auto openBrowser (bool headless=false) -> bool
auto callPlotly (const std::string &method, const Object &params, const std::chrono::duration< double > &timeout=RPC_CALL_TIMEOUT_SECONDS) const -> std::optional< plotly::Object >
auto isOpen () const -> bool
void waitClose () const
auto newPlot (const Object &data, const Object &layout, const Object &config) const -> bool
auto update (const Object &traceUpdate, const Object &layoutUpdate) const -> bool
auto downloadImage (const Object &opts) const -> bool
auto relayout (const Object &layout) const -> bool
auto redraw () const -> bool
 Redraws the plot.
auto purge () const -> bool
 Purges the plot, removing all data and layout.
auto restyle (const Object &aobj, const Object &traces) const -> bool
auto addTraces (const Object &traces, const Object &newIndices) const -> bool
auto deleteTraces (const Object &indices) const -> bool
auto moveTraces (const Object &currentIndices, const Object &newIndices) const -> bool
auto extendTraces (const Object &update, const Object &indices, const Object &maxPoints) const -> bool
auto prependTraces (const Object &update, const Object &indices) const -> bool
auto react (const Object &data, const Object &layout, const Object &config) const -> bool
auto addFrames (const Object &frames) const -> bool
auto deleteFrames (const Object &frames) const -> bool
auto animate (const Object &frameOrGroupNameOrFrameList, const Object &opts) const -> bool
auto setDownloadDirectory (const std::filesystem::path &directory, int remoteDebuggingPort=CHROME_DEVTOOLS_PORT) -> bool

Public Attributes

std::unique_ptr< detail::JsonRpcjsonRpc
std::unique_ptr< detail::HttpServerhttpServer
bool isHeadless = false
std::optional< std::filesystem::path > downloadDirectoryOfHeadlessMode
std::optional< std::function< void()> > closeChromiumFunction
bool isOnceConnected = false
std::unordered_map< std::string, std::function< void(plotly::Object)> > eventCallbacks
std::unordered_map< std::string, std::vector< std::string > > eventNameToIds

Constructor & Destructor Documentation

◆ Impl()

plotly::Figure::Impl::Impl ( const std::filesystem::path & webappPath)
inline

◆ ~Impl()

plotly::Figure::Impl::~Impl ( )
inline

Member Function Documentation

◆ addFrames()

auto plotly::Figure::Impl::addFrames ( const Object & frames) const -> bool
inline

Adds animation frames to the plot

Parameters
framesFrame data to add

◆ addTraces()

auto plotly::Figure::Impl::addTraces ( const Object & traces,
const Object & newIndices ) const -> bool
inline

Adds new traces to the plot

Parameters
tracesNew trace data to add
newIndicesOptional indices where to insert the traces

◆ animate()

auto plotly::Figure::Impl::animate ( const Object & frameOrGroupNameOrFrameList,
const Object & opts ) const -> bool
inline

Animates the plot

Parameters
frameOrGroupNameOrFrameListFrame specification for animation
optsAnimation options

◆ callPlotly()

auto plotly::Figure::Impl::callPlotly ( const std::string & method,
const Object & params,
const std::chrono::duration< double > & timeout = RPC_CALL_TIMEOUT_SECONDS ) const -> std::optional<plotly::Object>
inline

◆ deleteFrames()

auto plotly::Figure::Impl::deleteFrames ( const Object & frames) const -> bool
inline

Deletes animation frames from the plot

Parameters
framesFrame names or indices to delete

◆ deleteTraces()

auto plotly::Figure::Impl::deleteTraces ( const Object & indices) const -> bool
inline

Deletes traces from the plot

Parameters
indicesIndices of traces to delete

◆ downloadImage()

auto plotly::Figure::Impl::downloadImage ( const Object & opts) const -> bool
inline

◆ extendTraces()

auto plotly::Figure::Impl::extendTraces ( const Object & update,
const Object & indices,
const Object & maxPoints ) const -> bool
inline

Extends existing traces with new data

Parameters
updateData to append to traces
indicesTrace indices to extend
maxPointsOptional maximum number of points to keep

◆ isOpen()

auto plotly::Figure::Impl::isOpen ( ) const -> bool
inline

◆ moveTraces()

auto plotly::Figure::Impl::moveTraces ( const Object & currentIndices,
const Object & newIndices ) const -> bool
inline

Moves traces to new positions

Parameters
currentIndicesCurrent indices of traces to move
newIndicesNew indices for the traces

◆ newPlot()

auto plotly::Figure::Impl::newPlot ( const Object & data,
const Object & layout,
const Object & config ) const -> bool
inline

◆ openBrowser()

auto plotly::Figure::Impl::openBrowser ( bool headless = false) -> bool
inline

◆ prependTraces()

auto plotly::Figure::Impl::prependTraces ( const Object & update,
const Object & indices ) const -> bool
inline

Prepends data to existing traces

Parameters
updateData to prepend to traces
indicesTrace indices to prepend to

◆ purge()

auto plotly::Figure::Impl::purge ( ) const -> bool
inline

Purges the plot, removing all data and layout.

◆ react()

auto plotly::Figure::Impl::react ( const Object & data,
const Object & layout,
const Object & config ) const -> bool
inline

React-style update of the plot

Parameters
dataNew data array
layoutOptional layout specification
configOptional configuration

◆ redraw()

auto plotly::Figure::Impl::redraw ( ) const -> bool
inline

Redraws the plot.

◆ relayout()

auto plotly::Figure::Impl::relayout ( const Object & layout) const -> bool
inline

Updates the figure layout

Parameters
layoutLayout updates to apply

◆ restyle()

auto plotly::Figure::Impl::restyle ( const Object & aobj,
const Object & traces ) const -> bool
inline

Restyles existing traces

Parameters
aobjStyle updates to apply
tracesOptional trace indices to target

◆ setDownloadDirectory()

auto plotly::Figure::Impl::setDownloadDirectory ( const std::filesystem::path & directory,
int remoteDebuggingPort = CHROME_DEVTOOLS_PORT ) -> bool
inline

Sets the download directory for the browser

Parameters
directoryPath to the directory where downloads should be saved
remoteDebuggingPortPort for Chrome DevTools remote debugging
Returns
true if successful, false otherwise

◆ update()

auto plotly::Figure::Impl::update ( const Object & traceUpdate,
const Object & layoutUpdate ) const -> bool
inline

Updates the figure with new trace and layout data

Parameters
traceUpdateUpdates to apply to trace data
layoutUpdateUpdates to apply to layout configuration

◆ waitClose()

void plotly::Figure::Impl::waitClose ( ) const
inline

◆ waitConnection()

void plotly::Figure::Impl::waitConnection ( ) const
inline

Member Data Documentation

◆ closeChromiumFunction

std::optional<std::function<void()> > plotly::Figure::Impl::closeChromiumFunction

◆ downloadDirectoryOfHeadlessMode

std::optional<std::filesystem::path> plotly::Figure::Impl::downloadDirectoryOfHeadlessMode

◆ eventCallbacks

std::unordered_map<std::string, std::function<void(plotly::Object)> > plotly::Figure::Impl::eventCallbacks

◆ eventNameToIds

std::unordered_map<std::string, std::vector<std::string> > plotly::Figure::Impl::eventNameToIds

◆ httpServer

std::unique_ptr<detail::HttpServer> plotly::Figure::Impl::httpServer

◆ isHeadless

bool plotly::Figure::Impl::isHeadless = false

◆ isOnceConnected

bool plotly::Figure::Impl::isOnceConnected = false
mutable

◆ jsonRpc

std::unique_ptr<detail::JsonRpc> plotly::Figure::Impl::jsonRpc

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