Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump plotly version and edition to 2021 #256

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ jobs:
strategy:
fail-fast: false
matrix:
example: [ # missing jupyter
example: # missing jupyter
[
3d_charts,
basic_charts,
custom_controls,
Expand All @@ -103,7 +104,7 @@ jobs:
ndarray,
scientific_charts,
shapes,
subplots
subplots,
]
runs-on: ubuntu-latest
steps:
Expand All @@ -124,4 +125,3 @@ jobs:
with:
targets: wasm32-unknown-unknown
- run: cd ${{ github.workspace }}/examples/${{ matrix.example }} && cargo build --target wasm32-unknown-unknown

10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ All notable changes to this project will be documented in this file.

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).

## [0.11.0] - 2024-11-x
## [0.11.0] - 2024-12-06
### Changed
- [[#251](https://github.com/plotly/plotly.rs/pull/251)] Expose image data as String with `to_base64` and `to_svg` using Kaleido
- [[#245](https://github.com/plotly/plotly.rs/pull/245)] Change Contours size to be `f64` instead of `usize`
- [[#243](https://github.com/plotly/plotly.rs/pull/243)] Made `plotly_embed_js` embed all JS scripts when enabled.
Renamed `use_cdn_plotly` to `use_cdn_js`.

### Fixed
- [[#248]](https://github.com/plotly/plotly.rs/issues/248) Book recipes do not render graphs
- [[#247]](https://github.com/plotly/plotly.rs/issues/247) Add function to export image (with Kaleido) as a b64 string
- [[#246]](https://github.com/plotly/plotly.rs/pull/246) Expose pattern fill api for histograms and bar charts
- [[#248](https://github.com/plotly/plotly.rs/issues/248)] Book recipes do not render graphs
- [[#247](https://github.com/plotly/plotly.rs/issues/247)] Add function to export image (with Kaleido) as a b64 string
- [[#246](https://github.com/plotly/plotly.rs/pull/246)] Expose pattern fill api for histograms and bar charts
- [[#244](https://github.com/plotly/plotly.rs/pull/244)] Fix swapped x and y in the examples.
- [[#242](https://github.com/plotly/plotly.rs/issues/242)] Disable request for tex-svg.js file
- [[#237](https://github.com/plotly/plotly.rs/issues/237)] Add Categorical Axis ordering.
Expand All @@ -25,7 +25,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
### Fixed
- [[#230](https://github.com/plotly/plotly.rs/pull/230)] Make Bar chart `width` and `offset` use `f64` values.

## [0.10.0] - 2024-09-06
## [0.9.1] - 2024-09-06
### Added
- [[#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
- [[#227](https://github.com/plotly/plotly.rs/pull/227)] Switch from HTML template render from `askama` to `rinja`
Expand Down
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[workspace]
members = [
"plotly",
"plotly_derive",
"plotly_kaleido",
]
resolver = "2"
members = ["plotly", "plotly_derive", "plotly_kaleido"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
plotly = "0.10.0"
plotly = "0.11"
```

## Exporting a single Interactive Plot
Expand Down Expand Up @@ -103,7 +103,7 @@ To save a plot as a static image, the `kaleido` feature is required:
# Cargo.toml

[dependencies]
plotly = { version = "0.10.0", features = ["kaleido"] }
plotly = { version = "0.11", features = ["kaleido"] }
```

With this feature enabled, plots can be saved as any of `png`, `jpeg`, `webp`, `svg`, `pdf` and `eps`. Note that the plot will be a static image, i.e. they will be non-interactive.
Expand All @@ -130,7 +130,7 @@ Using `Plotly.rs` in a Wasm-based frontend framework is possible by enabling the
# Cargo.toml

[dependencies]
plotly = { version = "0.10.0", features = ["wasm"] }
plotly = { version = "0.11", features = ["wasm"] }
```

First, make sure that you have the Plotly JavaScript library in your base HTML template:
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/fundamentals/ndarray_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ var data = [trace_0,trace_1,trace_2,trace_3,trace_4,trace_5,trace_6,trace_7,trac
var layout = {};
Plotly.newPlot('multiple_ndarray_traces_over_rows', data, layout, {"responsive": true});
};
</script>
</script>
6 changes: 3 additions & 3 deletions docs/book/src/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To start using [plotly.rs](https://github.com/plotly/plotly.rs) in your project

```toml
[dependencies]
plotly = "0.10.0"
plotly = "0.11"
```

[Plotly.rs](https://github.com/plotly/plotly.rs) is ultimately a thin wrapper around the `plotly.js` library. The main job of this library is to provide `structs` and `enums` which get serialized to `json` and passed to the `plotly.js` library to actually do the heavy lifting. As such, if you are familiar with `plotly.js` or its derivatives (e.g. the equivalent Python library), then you should find [`plotly.rs`](https://github.com/plotly/plotly.rs) intuitive to use.
Expand Down Expand Up @@ -97,7 +97,7 @@ To add the ability to save plots in the following formats: png, jpeg, webp, svg,

```toml
[dependencies]
plotly = { version = "0.10.0", features = ["kaleido"] }
plotly = { version = "0.11", features = ["kaleido"] }
```

## WebAssembly Support
Expand Down Expand Up @@ -152,4 +152,4 @@ pub fn plot(props: &PlotProps) -> Html {
<div id={id.clone()} class={class.clone()}></div>
}
}
```
```
4 changes: 2 additions & 2 deletions examples/3d_charts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
ndarray = "0.16.0"
rand = "0.8.5"
ndarray = "0.16"
rand = "0.8"
plotly = { path = "../../plotly" }
3 changes: 2 additions & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[workspace]
members = ["*"]
exclude = ["jupyter", "target"]
resolver = "2"
exclude = ["jupyter", "target"]
6 changes: 3 additions & 3 deletions examples/basic_charts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
ndarray = "0.16.0"
ndarray = "0.16"
plotly = { path = "../../plotly" }
rand = "0.8.5"
rand_distr = "0.4.3"
rand = "0.8"
rand_distr = "0.4"
4 changes: 2 additions & 2 deletions examples/custom_controls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
itertools = "0.10.3"
plotly = { path = "../../plotly" }
itertools = "0.10"
plotly = { path = "../../plotly" }
4 changes: 2 additions & 2 deletions examples/financial_charts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
csv = "1.1.6"
csv = "1.1"
plotly = { path = "../../plotly" }
serde = "1.0.147"
serde = "1.0"
7 changes: 5 additions & 2 deletions examples/images/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ edition = "2021"

[dependencies]
image = "0.25"
ndarray = "0.16.0"
plotly = { path = "../../plotly", features = ["plotly_image", "plotly_ndarray"] }
ndarray = "0.16"
plotly = { path = "../../plotly", features = [
"plotly_image",
"plotly_ndarray",
] }
2 changes: 1 addition & 1 deletion examples/ndarray/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
ndarray = "0.16.0"
ndarray = "0.16"
plotly = { path = "../../plotly", features = ["plotly_ndarray"] }
6 changes: 3 additions & 3 deletions examples/shapes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
ndarray = "0.16.0"
ndarray = "0.16"
plotly = { path = "../../plotly" }
rand = "0.8.5"
rand_distr = "0.4.3"
rand = "0.8"
rand_distr = "0.4"
6 changes: 3 additions & 3 deletions examples/statistical_charts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Michael Freeborn <[email protected]>"]
edition = "2021"

[dependencies]
ndarray = "0.16.0"
ndarray = "0.16"
plotly = { path = "../../plotly" }
rand = "0.8.5"
rand_distr = "0.4.3"
rand = "0.8"
rand_distr = "0.4"
11 changes: 7 additions & 4 deletions examples/wasm-yew-minimal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[package]
name = "wasm-yew-minimal"
version = "0.1.0"
authors = ["Michael Freeborn <[email protected]>", "Yuichi Nakamura <[email protected]>"]
authors = [
"Michael Freeborn <[email protected]>",
"Yuichi Nakamura <[email protected]>",
]
edition = "2021"

[dependencies]
plotly = { path = "../../plotly", features = ["wasm"] }
yew = "0.21.0"
yew-hooks = "0.3.2"
log = "0.4.6"
yew = "0.21"
yew-hooks = "0.3"
log = "0.4"
wasm-logger = "0.2"
24 changes: 12 additions & 12 deletions plotly/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "plotly"
version = "0.10.0"
version = "0.11.0"
description = "A plotting library powered by Plotly.js"
authors = ["Ioannis Giagkiozis <[email protected]>"]
license = "MIT"
readme = "../README.md"
homepage = "https://github.com/plotly/plotly.rs"
documentation = "https://docs.rs/plotly"
repository = "https://github.com/plotly/plotly.rs"
edition = "2018"
edition = "2021"
keywords = ["plot", "chart", "plotly"]

exclude = ["target/*"]
Expand All @@ -24,30 +24,30 @@ with-axum = ["rinja/with-axum", "rinja_axum"]

[dependencies]
rinja = { version = "0.3", features = ["serde_json"] }
rinja_axum = { version = "0.3.0", optional = true }
rinja_axum = { version = "0.3", optional = true }
dyn-clone = "1"
erased-serde = "0.4"
getrandom = { version = "0.2", features = ["js"], optional = true }
image = { version = "0.25", optional = true }
js-sys = { version = "0.3", optional = true }
plotly_derive = { version = "0.10.0", path = "../plotly_derive" }
plotly_kaleido = { version = "0.10.0", path = "../plotly_kaleido", optional = true }
ndarray = { version = "0.16.0", optional = true }
plotly_derive = { version = "0.11", path = "../plotly_derive" }
plotly_kaleido = { version = "0.11", path = "../plotly_kaleido", optional = true }
ndarray = { version = "0.16", optional = true }
once_cell = "1"
serde = { version = "1.0.132", features = ["derive"] }
serde_json = "1.0.73"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_repr = "0.1"
serde_with = ">=2, <4"
rand = "0.8"
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }

[dev-dependencies]
csv = "1.1.6"
csv = "1.1"
image = "0.25"
itertools = ">=0.10, <0.14"
itertools-num = "0.1.3"
ndarray = "0.16.0"
plotly_kaleido = { version = "0.10.0", path = "../plotly_kaleido" }
itertools-num = "0.1"
ndarray = "0.16"
plotly_kaleido = { version = "0.11", path = "../plotly_kaleido" }
rand_distr = "0.4"
base64 = "0.22"
5 changes: 3 additions & 2 deletions plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,9 @@ mod tests {
assert!(!image_svg.is_empty());

let expected = "<svg class=\"main-svg\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"200\" height=\"150\" style=\"\" viewBox=\"0 0 200 150\"><rect x=\"0\" y=\"0\" width=\"200\" height=\"150\" style=\"fill: rgb(255, 255, 255); fill-opacity: 1;\"/><defs id=\"defs-2dc70a\"><g class=\"clips\"><clipPath id=\"clip2dc70axyplot\" class=\"plotclip\"><rect width=\"40\" height=\"2\"/></clipPath><clipPath class=\"axesclip\" id=\"clip2dc70ax\"><rect x=\"80\" y=\"0\" width=\"40\" height=\"150\"/></clipPath><clipPath class=\"axesclip\" id=\"clip2dc70ay\"><rect x=\"0\" y=\"82\" width=\"200\" height=\"2\"/></clipPath><clipPath class=\"axesclip\" id=\"clip2dc70axy\"><rect x=\"80\" y=\"82\" width=\"40\" height=\"2\"/></clipPath></g><g class=\"gradients\"/></defs><g class=\"bglayer\"/><g class=\"layer-below\"><g class=\"imagelayer\"/><g class=\"shapelayer\"/></g><g class=\"cartesianlayer\"><g class=\"subplot xy\"><g class=\"layer-subplot\"><g class=\"shapelayer\"/><g class=\"imagelayer\"/></g><g class=\"gridlayer\"><g class=\"x\"><path class=\"xgrid crisp\" transform=\"translate(100,0)\" d=\"M0,82v2\" style=\"stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;\"/><path class=\"xgrid crisp\" transform=\"translate(114.25,0)\" d=\"M0,82v2\" style=\"stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;\"/></g><g class=\"y\"/></g><g class=\"zerolinelayer\"><path class=\"xzl zl crisp\" transform=\"translate(85.75,0)\" d=\"M0,82v2\" style=\"stroke: rgb(68, 68, 68); stroke-opacity: 1; stroke-width: 1px;\"/></g><path class=\"xlines-below\"/><path class=\"ylines-below\"/><g class=\"overlines-below\"/><g class=\"xaxislayer-below\"/><g class=\"yaxislayer-below\"/><g class=\"overaxes-below\"/><g class=\"plot\" transform=\"translate(80,82)\" clip-path=\"url('#clip2dc70axyplot')\"><g class=\"scatterlayer mlayer\"><g class=\"trace scatter trace86f735\" style=\"stroke-miterlimit: 2; opacity: 1;\"><g class=\"fills\"/><g class=\"errorbars\"/><g class=\"lines\"><path class=\"js-line\" d=\"M5.75,1L20,0L34.25,2\" style=\"vector-effect: non-scaling-stroke; fill: none; stroke: rgb(31, 119, 180); stroke-opacity: 1; stroke-width: 2px; opacity: 1;\"/></g><g class=\"points\"><path class=\"point\" transform=\"translate(5.75,1)\" d=\"M3,0A3,3 0 1,1 0,-3A3,3 0 0,1 3,0Z\" style=\"opacity: 1; stroke-width: 0px; fill: rgb(31, 119, 180); fill-opacity: 1;\"/><path class=\"point\" transform=\"translate(20,0)\" d=\"M3,0A3,3 0 1,1 0,-3A3,3 0 0,1 3,0Z\" style=\"opacity: 1; stroke-width: 0px; fill: rgb(31, 119, 180); fill-opacity: 1;\"/><path class=\"point\" transform=\"translate(34.25,2)\" d=\"M3,0A3,3 0 1,1 0,-3A3,3 0 0,1 3,0Z\" style=\"opacity: 1; stroke-width: 0px; fill: rgb(31, 119, 180); fill-opacity: 1;\"/></g><g class=\"text\"/></g></g></g><g class=\"overplot\"/><path class=\"xlines-above crisp\" d=\"M0,0\" style=\"fill: none;\"/><path class=\"ylines-above crisp\" d=\"M0,0\" style=\"fill: none;\"/><g class=\"overlines-above\"/><g class=\"xaxislayer-above\"><g class=\"xtick\"><text text-anchor=\"middle\" x=\"0\" y=\"97\" transform=\"translate(85.75,0)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">0</text></g><g class=\"xtick\"><text text-anchor=\"middle\" x=\"0\" y=\"97\" transform=\"translate(100,0)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">1</text></g><g class=\"xtick\"><text text-anchor=\"middle\" x=\"0\" y=\"97\" transform=\"translate(114.25,0)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">2</text></g></g><g class=\"yaxislayer-above\"><g class=\"ytick\"><text text-anchor=\"end\" x=\"79\" y=\"4.199999999999999\" transform=\"translate(0,84)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">2</text></g><g class=\"ytick\"><text text-anchor=\"end\" x=\"79\" y=\"4.199999999999999\" transform=\"translate(0,83.5)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">4</text></g><g class=\"ytick\"><text text-anchor=\"end\" x=\"79\" y=\"4.199999999999999\" transform=\"translate(0,83)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">6</text></g><g class=\"ytick\"><text text-anchor=\"end\" x=\"79\" y=\"4.199999999999999\" transform=\"translate(0,82.5)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">8</text></g><g class=\"ytick\"><text text-anchor=\"end\" x=\"79\" y=\"4.199999999999999\" transform=\"translate(0,82)\" style=\"font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;\">10</text></g></g><g class=\"overaxes-above\"/></g></g><g class=\"polarlayer\"/><g class=\"ternarylayer\"/><g class=\"geolayer\"/><g class=\"funnelarealayer\"/><g class=\"pielayer\"/><g class=\"treemaplayer\"/><g class=\"sunburstlayer\"/><g class=\"glimages\"/><defs id=\"topdefs-2dc70a\"><g class=\"clips\"/></defs><g class=\"layer-above\"><g class=\"imagelayer\"/><g class=\"shapelayer\"/></g><g class=\"infolayer\"><g class=\"g-gtitle\"/><g class=\"g-xtitle\"/><g class=\"g-ytitle\"/></g></svg>";
// Limit the test to the first LEN characters
const LEN: usize = 100;
// Limit the test to the first LEN characters as generated SVGs
// seem to contain uniquely generated IDs
const LEN: usize = 10;
assert_eq!(expected[..LEN], image_svg[..LEN]);
}
}
4 changes: 2 additions & 2 deletions plotly_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "plotly_derive"
version = "0.10.0"
version = "0.11.0"
description = "Internal proc macro crate for Plotly-rs."
authors = ["Ioannis Giagkiozis <[email protected]>"]
license = "MIT"
homepage = "https://github.com/plotly/plotly.rs"
documentation = "https://docs.rs/plotly"
repository = "https://github.com/plotly/plotly.rs"
edition = "2018"
edition = "2021"
keywords = ["plot", "chart", "plotly"]

[dependencies]
Expand Down
10 changes: 5 additions & 5 deletions plotly_kaleido/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "plotly_kaleido"
version = "0.10.0"
version = "0.11.0"
description = "Additional output format support for plotly using Kaleido"
authors = ["Ioannis Giagkiozis <[email protected]>"]
license = "MIT"
Expand All @@ -9,16 +9,16 @@ workspace = ".."
homepage = "https://github.com/plotly/plotly.rs"
documentation = "https://docs.rs/plotly_kaleido"
repository = "https://github.com/plotly/plotly.rs"
edition = "2018"
edition = "2021"
keywords = ["plot", "chart", "plotly", "ndarray"]

exclude = ["target/*", "kaleido/*", "examples/*"]

[dependencies]
serde = { version = "1.0.132", features = ["derive"] }
serde_json = "1.0.73"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
base64 = "0.22"
dunce = "1.0.2"
dunce = "1.0"
directories = ">=4, <6"

[build-dependencies]
Expand Down
1 change: 1 addition & 0 deletions plotly_kaleido/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ impl Kaleido {
let p = p.to_str().unwrap();
let p = String::from(p);

#[allow(clippy::zombie_processes)]
let mut process = Command::new(p.as_str())
.current_dir(self.cmd_path.parent().unwrap())
.args([
Expand Down
Loading