diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f989eef4..a8fdcc59 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -14,3 +14,7 @@ updates: - dependency-name: gif versions: - 0.11.1 +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/plotters-backend.yml b/.github/workflows/plotters-backend.yml index e6a5e37d..556f39b8 100644 --- a/.github/workflows/plotters-backend.yml +++ b/.github/workflows/plotters-backend.yml @@ -9,7 +9,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/plotters-bitmap.yml b/.github/workflows/plotters-bitmap.yml index 6cb86b02..79b4f259 100644 --- a/.github/workflows/plotters-bitmap.yml +++ b/.github/workflows/plotters-bitmap.yml @@ -9,7 +9,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/plotters-core.yml b/.github/workflows/plotters-core.yml index 2f53410a..1e9a952c 100644 --- a/.github/workflows/plotters-core.yml +++ b/.github/workflows/plotters-core.yml @@ -7,7 +7,7 @@ jobs: name: cargo-doc runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -20,7 +20,7 @@ jobs: msrv: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/toolchain@v1 @@ -34,7 +34,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/toolchain@v1 @@ -52,7 +52,7 @@ jobs: test_all_features: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/toolchain@v1 @@ -66,7 +66,7 @@ jobs: run_all_examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/cargo@v1 @@ -81,7 +81,7 @@ jobs: ../target/release/examples/$(basename ${example} .rs) done tar -czvf example-outputs.tar.gz plotters-doc-data - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v4 with: name: example-outputs path: plotters/example-outputs.tar.gz diff --git a/.github/workflows/plotters-svg.yml b/.github/workflows/plotters-svg.yml index d81e98f7..d44a400c 100644 --- a/.github/workflows/plotters-svg.yml +++ b/.github/workflows/plotters-svg.yml @@ -9,7 +9,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index ca1732c8..8536ab98 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -27,7 +27,7 @@ jobs: security-events: write steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Rust toolchain uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 @@ -48,7 +48,7 @@ jobs: continue-on-error: true - name: Upload analysis results to GitHub - uses: github/codeql-action/upload-sarif@v1 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: rust-clippy-results.sarif wait-for-processing: true diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 35166ecc..e9ae4ad3 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: submodules: recursive - name: Install WASM tool chain diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 00000000..6e7feccc --- /dev/null +++ b/Cross.toml @@ -0,0 +1,5 @@ +[target.x86_64-unknown-linux-gnu] +pre-build = [ + "apt-get update", + "apt-get install --assume-yes libfontconfig-dev:$CROSS_DEB_ARCH", +] diff --git a/plotters/Cargo.toml b/plotters/Cargo.toml index 053af3dd..4489f0ed 100644 --- a/plotters/Cargo.toml +++ b/plotters/Cargo.toml @@ -32,7 +32,7 @@ path = "../plotters-svg" ttf-parser = { version = "0.15.0", optional = true } lazy_static = { version = "1.4.0", optional = true } pathfinder_geometry = { version = "0.5.1", optional = true } -font-kit = { version = "0.11.0", optional = true } +font-kit = { version = "0.14.2", optional = true } [target.'cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))'.dependencies.image] version = "0.24.2" @@ -46,28 +46,38 @@ version = "0.2.62" [target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies.web-sys] version = "0.3.51" features = [ - "Document", - "DomRect", - "Element", - "HtmlElement", - "Node", - "Window", - "HtmlCanvasElement", - "CanvasRenderingContext2d", + "Document", + "DomRect", + "Element", + "HtmlElement", + "Node", + "Window", + "HtmlCanvasElement", + "CanvasRenderingContext2d", ] [features] default = [ - "bitmap_backend", "bitmap_encoder", "bitmap_gif", - "svg_backend", - "chrono", - "ttf", - "image", - "deprecated_items", "all_series", "all_elements", - "full_palette" + "bitmap_backend", + "bitmap_encoder", + "bitmap_gif", + "svg_backend", + "chrono", + "ttf", + "image", + "deprecated_items", + "all_series", + "all_elements", + "full_palette", ] -all_series = ["area_series", "line_series", "point_series", "surface_series"] -all_elements = ["errorbar", "candlestick", "boxplot", "histogram"] +all_series = [ + "area_series", + "line_series", + "point_series", + "surface_series", + "histogram", +] +all_elements = ["errorbar", "candlestick", "boxplot"] # Tier 1 Backends bitmap_backend = ["plotters-bitmap", "ttf"] @@ -99,7 +109,8 @@ fontconfig-dlopen = ["font-kit/source-fontconfig-dlopen"] # Misc datetime = ["chrono"] evcxr = ["svg_backend"] -deprecated_items = [] # Keep some of the deprecated items for backward compatibility +deprecated_items = [ +] # Keep some of the deprecated items for backward compatibility [dev-dependencies] itertools = "0.10.0" diff --git a/plotters/examples/stock.rs b/plotters/examples/stock.rs index 29939a69..4bfd8759 100644 --- a/plotters/examples/stock.rs +++ b/plotters/examples/stock.rs @@ -1,9 +1,7 @@ -use chrono::{DateTime, Duration, NaiveDate}; +use chrono::{Duration, NaiveDate}; use plotters::prelude::*; fn parse_time(t: &str) -> NaiveDate { - DateTime::parse_from_str(&format!("{} 0:0", t), "%Y-%m-%d %H:%M") - .unwrap() - .date_naive() + NaiveDate::parse_from_str(&format!("{} 0:0", t), "%Y-%m-%d %H:%M").unwrap() } const OUT_FILE_NAME: &'static str = "plotters-doc-data/stock.png"; fn main() -> Result<(), Box> { diff --git a/plotters/src/element/pie.rs b/plotters/src/element/pie.rs index 7994d2f5..efc828f2 100644 --- a/plotters/src/element/pie.rs +++ b/plotters/src/element/pie.rs @@ -69,7 +69,8 @@ impl<'a, Label: Display> Pie<'a, (i32, i32), Label> { /// Default is set to start at 0, which is aligned on the x axis. /// ``` /// use plotters::prelude::*; - /// let mut pie = Pie::new(&(50,50), &10.0, &[50.0, 25.25, 20.0, 5.5], &[RED.to_rgba(), BLUE.to_rgba(), GREEN.to_rgba(), WHITE.to_rgba()], &["Red", "Blue", "Green", "White"]); + /// let colors = [RED.to_rgba(), BLUE.to_rgba(), GREEN.to_rgba(), WHITE.to_rgba()]; + /// let mut pie = Pie::new(&(50,50), &10.0, &[50.0, 25.25, 20.0, 5.5], &colors, &["Red", "Blue", "Green", "White"]); /// pie.start_angle(-90.0); // retract to a right angle, so it starts aligned to a vertical Y axis. /// ``` pub fn start_angle(&mut self, start_angle: f64) {