You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,8 @@ let svg_string = plot.to_svg(800, 600, 1.0)?;
121
121
122
122
**Note:** This feature requires a WebDriver-compatible browser (Chrome or Firefox) as well as a Webdriver (chromedriver/geckodriver) to be available on the system. For advanced usage, see the [`plotly_static` crate documentation](https://docs.rs/plotly_static/).
123
123
124
+
> Enabling any of the `plotly` features `static_export_chromedriver`, `static_export_geckodriver`, or `static_export_default` gives access to both the synchronous `StaticExporter` and the asynchronous `AsyncStaticExporter` (available via `plotly::plotly_static`). Use the async API in async contexts; avoid calling the sync API from async code.
125
+
124
126
## Exporting Static Images with Kaleido (legacy)
125
127
126
128
Enable the `kaleido` feature and opt in for automatic downloading of the `kaleido` binaries by doing the following
Copy file name to clipboardExpand all lines: docs/book/src/fundamentals/static_image_export.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ plotly = { version = "0.13", features = ["static_export_chromedriver", "static_e
34
34
plotly = { version = "0.13", features = ["static_export_default"] }
35
35
```
36
36
37
+
> Enabling any of the static export features in `plotly` (`static_export_chromedriver`, `static_export_geckodriver`, or `static_export_default`) enables both APIs from `plotly_static`: the sync `StaticExporter` and the async `AsyncStaticExporter` (reachable as `plotly::plotly_static::AsyncStaticExporter`). Prefer the async API inside async code.
38
+
37
39
## Prerequisites
38
40
39
41
1.**WebDriver Installation**: You need either chromedriver or geckodriver installed
@@ -74,6 +76,7 @@ For better performance when exporting multiple plots, reuse a single `StaticExpo
// Always close the exporter to ensure proper release of WebDriver resources
@@ -191,7 +195,9 @@ exporter.close();
191
195
192
196
### Async support
193
197
194
-
`plotly_static` package offers an `async` API which can is exposed in `plotly` as well but only if the user passes an `AsyncStaticExporter` to the `write_image_async`, `to_base64_async` and `to_svg_async` functions. The `AsyncStaticExporter` can be built using the `StaticExportBuilder`'s `build_async` method.
198
+
`plotly_static` package offers an `async` API which is exposed in `plotly` via the `write_image_async`, `to_base64_async` and `to_svg_async` functions. However, the user must pass an `AsyncStaticExporter` asynchronous exporter insted of a synchronous one by building it via `StaticExportBuilder`'s `build_async` method.
199
+
200
+
> Note: Both sync and async exporters are available whenever a `static_export_*` feature is enabled in `plotly`.
195
201
196
202
For more details check the [`plotly_static` API Documentation](https://docs.rs/plotly_static/)
Copy file name to clipboardExpand all lines: examples/static_export/README.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ The `plotly_static` provides a interface for converting Plotly plots into variou
6
6
7
7
In this example it is shown how to use the `StaticExporter` with the old style Kaleido API and also with the new style API. Using the former API is fine for one time static exports, but that API will crate an instance of the `StaticExporter` for each `write_image` call. The new style API is recommended for performance as the same instance of the `StaticExporter` can be reused across multiple exports.
8
8
9
-
There are both a sync and an async StaticExporter version which can be build with `build` and `build_async` methods.
10
-
11
-
Refer to the [`plotly_static` API Documentation](https://docs.rs/plotly_static/) a more detailed description.
9
+
When any of the `plotly` static export features are enabled (`static_export_chromedriver`, `static_export_geckodriver`, or `static_export_default`), both `StaticExporter` (sync) and `AsyncStaticExporter` (async) are available via `plotly::plotly_static`. This example includes separate `sync` and `async` bins demonstrating both. Refer to the [`plotly_static` API Documentation](https://docs.rs/plotly_static/) a more detailed description.
0 commit comments