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: CHANGELOG.md
+4
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
3
3
4
4
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).
5
5
6
+
## [0.10.0] - 2024-xx-xx
7
+
### Added
8
+
-[[#231](https://github.com/plotly/plotly.rs/pull/231)] Added new `plotly_embed_js` feature to reduce binary sizes by not embedding `plotly.min.js` in the library unless explicitly enabled via the feature flag. Deprecates `use_local_plotly` in favor of explicit opt-in via the feature flag and introduce method `use_cdn_plotly` to allow users to use CDN version even behind the `plotly_embed_js` feature flag.
9
+
6
10
## [0.9.1] - 2024-09-06
7
11
### Added
8
12
-[[#217](https://github.com/plotly/plotly.rs/pull/217)] Added show_html(filename) method to bypass situations where accessing default `/tmp` is not possible, e.g., with in SNAP Firefox
Copy file name to clipboardExpand all lines: README.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -78,12 +78,12 @@ plot.add_trace(trace);
78
78
plot.write_html("out.html");
79
79
```
80
80
81
-
By default, the Plotly JavaScript library will be included via CDN, which results in a smaller filesize, but slightly slower first load as the JavaScript library has to be downloaded first. To instead embed the JavaScript library (several megabytes in size) directly into the HTML file, the following can be done:
81
+
By default, the Plotly JavaScript library will be included via CDN, which results in a smaller filesize, but slightly slower first load as the JavaScript library has to be downloaded first. To instead embed the JavaScript library (several megabytes in size) directly into the HTML file, the library must be compiled with the feature flag `plotly_embed_js`. Once enabled, by default the JavaScript library is directly embedded in the generated HTML file. It is still possible to use the CDN version, by using the `use_cdn_plotly` method.
82
82
83
83
```rust
84
84
// <-- Create a `Plot` -->
85
85
86
-
plot.use_local_plotly();
86
+
plot.use_cdn_plotly();
87
87
plot.write_html("out.html");
88
88
```
89
89
@@ -201,6 +201,16 @@ Adds trait implementations so that `image::RgbImage` and `image::RgbaImage` can
201
201
202
202
Adds support for creating plots directly using [ndarray](https://github.com/rust-ndarray/ndarray) types.
203
203
204
+
### `plotly_embed_js`
205
+
206
+
By default, the CDN version of `plotly.js` is used in the library and in the generated HTML files. This feature can be used to opt in for embedding `plotly.min.js` in the generated HTML files. The benefit is that the plot will load faster in the browser.
207
+
208
+
However, there are two downsides of using this feature flag, one is that the resulting html will be much larger, as a copy of the `plotly.min.js` library is embedded in each HTML file. The second, more relevant, is that a copy of the `plotly.min.js` library needs to be compiled in the `plotly-rs` library itself which increases the size by approx `3.5 Mb`.
209
+
210
+
When the feature is enabled, users can still opt in for the CDN version by using the method `use_cdn_plotly`.
211
+
212
+
Note that when using `Plot::to_inline_html()`, it is assumed that the `plotly.js` library is already in scope within the HTML file, so enabling this feature flag will have no effect.
213
+
204
214
### `wasm`
205
215
206
216
Enables compilation for the `wasm32-unknown-unknown` target and provides access to a `bindings` module containing wrappers around functions exported by the plotly.js library.
0 commit comments