|
| | Figure (const std::filesystem::path &webappPath=std::filesystem::path(PLOTLY_CPP_WEBAPP_PATH)) |
| | Construct a new Figure instance.
|
| | Figure (const Figure &)=delete |
| | Copy construction is disabled.
|
| auto | operator= (const Figure &) -> Figure &=delete |
| | Copy assignment is disabled.
|
| | ~Figure () |
| | Destructor.
|
| auto | openBrowser (bool headless=false) -> bool |
| | Open the figure in the browser.
|
| auto | isOpen () const -> bool |
| | Check whether the figure is currently open.
|
| void | waitClose () const |
| | Wait until the figure is closed (no client connected).
|
| auto | downloadImage (const Object &opts=Object()) -> bool |
| | Download the figure as an image.
|
| auto | newPlot (const Object &data, const Object &layout=Object(), const Object &config=Object()) -> bool |
| | Create and render a new plot.
|
| auto | update (const Object &traceUpdate, const Object &layoutUpdate=Object()) -> bool |
| | Update an existing plot.
|
| auto | relayout (const Object &layout=Object()) -> bool |
| | Apply layout-only changes to the plot.
|
| auto | redraw () -> bool |
| | Redraw the plot.
|
| auto | purge () -> bool |
| | Purge the plot, removing all data and layout.
|
| auto | restyle (const Object &aobj, const Object &traces=Object()) -> bool |
| | Restyle existing traces.
|
| auto | addTraces (const Object &traces, const Object &newIndices=Object()) -> bool |
| | Add new traces to the plot.
|
| auto | deleteTraces (const Object &indices) -> bool |
| | Delete traces from the plot.
|
| auto | moveTraces (const Object ¤tIndices, const Object &newIndices) -> bool |
| | Move traces to new positions.
|
| auto | extendTraces (const Object &update, const Object &indices, const Object &maxPoints=Object()) -> bool |
| | Extend existing traces with new data.
|
| auto | prependTraces (const Object &update, const Object &indices) -> bool |
| | Prepend data to existing traces.
|
| auto | react (const Object &data, const Object &layout=Object(), const Object &config=Object()) -> bool |
| | React-style update of the plot.
|
| auto | addFrames (const Object &frames) -> bool |
| | Add animation frames to the plot.
|
| auto | deleteFrames (const Object &frames) -> bool |
| | Delete animation frames from the plot.
|
| auto | animate (const Object &frameOrGroupNameOrFrameList, const Object &opts=Object()) -> bool |
| | Animate the plot.
|
| auto | on (const std::string &event, const std::function< void(plotly::Object)> &callback) -> bool |
| | Register a listener for a Plotly event.
|
| auto | removeAllListeners (const std::string &event) -> bool |
| | Remove all listeners for a specific Plotly event.
|
| auto | setDownloadDirectory (const std::filesystem::path &directory, int remoteDebuggingPort=9222) -> bool |
| | Set the download directory for the browser.
|
Handle for creating and manipulating a Plotly figure.
- Non-copyable (copy constructor and assignment are disabled)
- Some operations are asynchronous and return std::future<plotly::Object>
- Returned plotly::Object values carry Plotly.js responses and event payloads in a JSON-compatible structure
Typical usage:
- Construct a Figure (optionally auto-opening the viewer/frontend)
- Call newPlot to render the initial chart
- Call update and/or relayout to modify the chart
- Optionally call downloadImage to export an image
- Register event listeners with on
- Note
- Thread-safety characteristics depend on the implementation. If multiple threads will operate on the same instance, coordinate access appropriately.
- Examples
- gallery_2x2_subplots.cpp, gallery_3d_surface.cpp, gallery_animate_sin_wave.cpp, gallery_box_violin_plots.cpp, gallery_clustering_animation.cpp, gallery_double_pendulum.cpp, gallery_duffing.cpp, gallery_event_handling.cpp, gallery_financial_candlestick.cpp, gallery_fractal.cpp, gallery_game_of_life.cpp, gallery_geographic_choropleth.cpp, gallery_golden_ratio.cpp, gallery_heatmap_correlation.cpp, gallery_hello_world.cpp, gallery_multi_trace_styling.cpp, gallery_parallel_coordinates.cpp, gallery_particle_physics_sim.cpp, gallery_polar_radar_chart.cpp, gallery_sankey_flow_diagram.cpp, gallery_scatter_bubble_chart.cpp, gallery_sin_curve.cpp, gallery_star.cpp, gallery_statistical_distributions.cpp, and gallery_treemap_hierarchy.cpp.