Skip to content

Commit a49f80d

Browse files
committed
re-export ImageFormat from plotly_static into plotly package
- fix plotly_static example - bump plotly_static and remove patch version from plotly_static when used in plotly crate Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent 34875fa commit a49f80d

File tree

9 files changed

+32
-24
lines changed

9 files changed

+32
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [0.13.5] - 2025-07-30
7+
8+
### Fixed
9+
10+
- [[#345](https://github.com/plotly/plotly.rs/pull/345)] Re-export `ImageFormat` from `plotly_static` into `plotly`
11+
612
## [0.13.4] - 2025-07-17
713

814
### Fixed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ plotly = { version = "0.13", features = ["static_export_default"] }
108108
This supports PNG, JPEG, WEBP, SVG, and PDF formats:
109109

110110
```rust
111-
use plotly::{Plot, Scatter, ImageFormat};
111+
use plotly::{Plot, Scatter,ImageFormat};
112112

113113
let mut plot = Plot::new();
114114
plot.add_trace(Scatter::new(vec![0, 1, 2], vec![2, 1, 0]));
@@ -164,7 +164,9 @@ Kaleido binaries are available on Github [release page](https://github.com/plotl
164164

165165
## Usage Within a WASM Environment
166166

167-
`Plotly.rs` can be used with a WASM-based frontend framework. The needed dependencies are automatically enabled for `wasm32` targets at compile time and there is no longer a need for the custom `wasm` flag in this crate. Note that the `kaleido` and `plotly_static` features are not supported in WASM environments and will throw a compilation error if enabled.
167+
`Plotly.rs` can be used with a WASM-based frontend framework. Note that the `kaleido` and `plotly_static` static export features are not supported in WASM environments and will throw a compilation error if used.
168+
169+
The needed dependencies are automatically enabled for `wasm32` targets at compile time and there is no longer a need for the custom `wasm` flag in this crate.
168170

169171
First, make sure that you have the Plotly JavaScript library in your base HTML template:
170172

docs/book/src/fundamentals/static_image_export.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ plotly = { version = "0.13", features = ["static_export_default"] }
5757
### Simple Export
5858

5959
```rust
60-
use plotly::{Plot, Scatter};
61-
use plotly::plotly_static::ImageFormat;
60+
use plotly::{Plot, Scatter, ImageFormat};
6261

6362
let mut plot = Plot::new();
6463
plot.add_trace(Scatter::new(vec![1, 2, 3], vec![4, 5, 6]));

plotly/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dyn-clone = "1"
5252
erased-serde = "0.4"
5353
image = { version = "0.25", optional = true }
5454
plotly_derive = { version = "0.13", path = "../plotly_derive" }
55-
plotly_static = { version = "0.0.3", path = "../plotly_static", optional = true }
55+
plotly_static = { version = "0.0", path = "../plotly_static", optional = true }
5656
plotly_kaleido = { version = "0.13", path = "../plotly_kaleido", optional = true }
5757
ndarray = { version = "0.16", optional = true }
5858
once_cell = "1"

plotly/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ pub use common::color;
5757
pub use configuration::Configuration;
5858
pub use layout::Layout;
5959
pub use plot::{Plot, Trace, Traces};
60-
#[cfg(feature = "kaleido")]
61-
pub use plotly_kaleido::ImageFormat;
62-
#[cfg(feature = "plotly_static")]
63-
pub use plotly_static;
6460
// Also provide easy access to modules which contain additional trace-specific types
6561
pub use traces::{
6662
box_plot, contour, heat_map, histogram, image, mesh3d, sankey, scatter, scatter3d,
@@ -75,6 +71,11 @@ pub use traces::{
7571
pub trait Restyle: serde::Serialize {}
7672
pub trait Relayout {}
7773

74+
#[cfg(feature = "kaleido")]
75+
pub use plotly_kaleido::ImageFormat;
76+
#[cfg(feature = "plotly_static")]
77+
pub use plotly_static::{self, ImageFormat};
78+
7879
// Not public API.
7980
#[doc(hidden)]
8081
mod private;

plotly_static/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotly_static"
3-
version = "0.0.3"
3+
version = "0.0.4"
44
description = "Export Plotly graphs to static images using WebDriver"
55
authors = ["Andrei Gherghescu [email protected]"]
66
license = "MIT"

plotly_static/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Add to your `Cargo.toml`:
5656

5757
```toml
5858
[dependencies]
59-
plotly_static = { version = "0.0.3", features = ["chromedriver", "webdriver_download"] }
59+
plotly_static = { version = "0.0.4", features = ["chromedriver", "webdriver_download"] }
6060
serde_json = "1.0"
6161
```
6262

@@ -155,4 +155,4 @@ Similar examples are available in the [Plotly.rs package](https://github.com/plo
155155

156156
## License
157157

158-
This package is licensed under the MIT License.
158+
This package is licensed under the MIT License.

plotly_static/examples/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ This example demonstrates how to use the `plotly_static` crate with `clap` to cr
88

99
Export a plot from a JSON file (using Chrome driver):
1010
```bash
11-
cargo run --example main --features chromedriver -- -i sample_plot.json -o my_plot -f png
11+
cargo run --example generate_static --features chromedriver -- -i sample_plot.json -o my_plot -f png
1212
```
1313

1414
Export a plot from a JSON file (using Firefox/Gecko driver):
1515
```bash
16-
cargo run --example main --features geckodriver -- -i sample_plot.json -o my_plot -f png
16+
cargo run --example generate_static --features geckodriver -- -i sample_plot.json -o my_plot -f png
1717
```
1818

1919
Export a plot from stdin:
2020
```bash
21-
cat sample_plot.json | cargo run --example main --features chromedriver -- -f svg -o output
21+
cat sample_plot.json | cargo run --example generate_static --features chromedriver -- -f svg -o output
2222
```
2323

2424
### Web Driver Options
@@ -31,10 +31,10 @@ The example supports two different web drivers for rendering plots:
3131
You must specify one of these features when running the example. For example:
3232
```bash
3333
# Use Chrome driver
34-
cargo run --example main --features chromedriver -- -i plot.json -o output.png
34+
cargo run --example generate_static --features chromedriver -- -i plot.json -o output.png
3535

3636
# Use Firefox driver
37-
cargo run --example main --features geckodriver -- -i plot.json -o output.png
37+
cargo run --example generate_static --features geckodriver -- -i plot.json -o output.png
3838
```
3939

4040
### Logging
@@ -43,13 +43,13 @@ The example uses `env_logger` for logging. You can enable different log levels u
4343

4444
```bash
4545
# Enable info level logging
46-
RUST_LOG=info cargo run --example main --features chromedriver -- -i sample_plot.json -o my_plot -f png
46+
RUST_LOG=info cargo run --example generate_static --features chromedriver -- -i sample_plot.json -o my_plot -f png
4747

4848
# Enable debug level logging for more verbose output
49-
RUST_LOG=debug cargo run --example main --features geckodriver -- -i sample_plot.json -o my_plot -f png
49+
RUST_LOG=debug cargo run --example generate_static --features geckodriver -- -i sample_plot.json -o my_plot -f png
5050

5151
# Enable all logging levels
52-
RUST_LOG=trace cargo run --example main --features chromedriver -- -i sample_plot.json -o my_plot -f png
52+
RUST_LOG=trace cargo run --example generate_static --features chromedriver -- -i sample_plot.json -o my_plot -f png
5353
```
5454

5555
### Command Line Options
@@ -66,18 +66,18 @@ RUST_LOG=trace cargo run --example main --features chromedriver -- -i sample_plo
6666

6767
Export to PNG with custom dimensions:
6868
```bash
69-
cargo run --example main --features chromedriver -- -i sample_plot.json -o plot -f png --width 1200 --height 800
69+
cargo run --example generate_static --features chromedriver -- -i sample_plot.json -o plot -f png --width 1200 --height 800
7070
```
7171

7272
Export to SVG from stdin:
7373
```bash
7474
echo '{"data":[{"type":"scatter","x":[1,2,3],"y":[4,5,6]}],"layout":{}}' | \
75-
cargo run --example main --features geckodriver -- -f svg -o scatter_plot
75+
cargo run --example generate_static --features geckodriver -- -f svg -o scatter_plot
7676
```
7777

7878
Export to PDF with high resolution:
7979
```bash
80-
cargo run --example main --features chromedriver -- -i sample_plot.json -o report -f pdf --width 1600 --height 1200 -s 2.0
80+
cargo run --example generate_static --features chromedriver -- -i sample_plot.json -o report -f pdf --width 1600 --height 1200 -s 2.0
8181
```
8282

8383
### JSON Format

plotly_static/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
//!
7575
//! ```toml
7676
//! [dependencies]
77-
//! plotly_static = { version = "0.0.3", features = ["chromedriver", "webdriver_download"] }
77+
//! plotly_static = { version = "0.0.4", features = ["chromedriver", "webdriver_download"] }
7878
//! ```
7979
//!
8080
//! ## Advanced Usage

0 commit comments

Comments
 (0)