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

Fix histogram feature grouping on next-release-devel #646

Open
wants to merge 5 commits into
base: next-release-devel
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ updates:
- dependency-name: gif
versions:
- 0.11.1
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion .github/workflows/plotters-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plotters-bitmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/plotters-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/plotters-svg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 30 additions & 19 deletions plotters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"]
Expand Down Expand Up @@ -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"
Expand Down
82 changes: 42 additions & 40 deletions plotters/examples/stock.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
use chrono::{DateTime, Duration, NaiveDate};
use chrono::offset::{Local, TimeZone};
use chrono::{Date, Duration};
use plotters::prelude::*;
fn parse_time(t: &str) -> NaiveDate {
DateTime::parse_from_str(&format!("{} 0:0", t), "%Y-%m-%d %H:%M")
fn parse_time(t: &str) -> Date<Local> {
Local
.datetime_from_str(&format!("{} 0:0", t), "%Y-%m-%d %H:%M")
.unwrap()
.date_naive()
.date()
}
const OUT_FILE_NAME: &'static str = "plotters-doc-data/stock.png";
const OUT_FILE_NAME: &str = "plotters-doc-data/stock.png";
fn main() -> Result<(), Box<dyn std::error::Error>> {
let data = get_data();
let root = BitMapBackend::new(OUT_FILE_NAME, (1024, 768)).into_drawing_area();
root.fill(&WHITE)?;

let (to_date, from_date) = (
parse_time(&data[0].0) + Duration::days(1),
parse_time(&data[29].0) - Duration::days(1),
parse_time(data[0].0) + Duration::days(1),
parse_time(data[29].0) - Duration::days(1),
);

let mut chart = ChartBuilder::on(&root)
Expand All @@ -22,7 +24,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.caption("MSFT Stock Price", ("sans-serif", 50.0).into_font())
.build_cartesian_2d(from_date..to_date, 110f32..135f32)?;

chart.configure_mesh().light_line_style(&WHITE).draw()?;
chart.configure_mesh().light_line_style(WHITE).draw()?;

chart.draw_series(
data.iter().map(|x| {
Expand All @@ -38,38 +40,38 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}

fn get_data() -> Vec<(&'static str, f32, f32, f32, f32)> {
return vec![
("2019-04-25", 130.0600, 131.3700, 128.8300, 129.1500),
("2019-04-24", 125.7900, 125.8500, 124.5200, 125.0100),
("2019-04-23", 124.1000, 125.5800, 123.8300, 125.4400),
("2019-04-22", 122.6200, 124.0000, 122.5700, 123.7600),
("2019-04-18", 122.1900, 123.5200, 121.3018, 123.3700),
("2019-04-17", 121.2400, 121.8500, 120.5400, 121.7700),
("2019-04-16", 121.6400, 121.6500, 120.1000, 120.7700),
("2019-04-15", 120.9400, 121.5800, 120.5700, 121.0500),
("2019-04-12", 120.6400, 120.9800, 120.3700, 120.9500),
("2019-04-11", 120.5400, 120.8500, 119.9200, 120.3300),
("2019-04-10", 119.7600, 120.3500, 119.5400, 120.1900),
("2019-04-09", 118.6300, 119.5400, 118.5800, 119.2800),
("2019-04-08", 119.8100, 120.0200, 118.6400, 119.9300),
("2019-04-05", 119.3900, 120.2300, 119.3700, 119.8900),
("2019-04-04", 120.1000, 120.2300, 118.3800, 119.3600),
("2019-04-03", 119.8600, 120.4300, 119.1500, 119.9700),
("2019-04-02", 119.0600, 119.4800, 118.5200, 119.1900),
("2019-04-01", 118.9500, 119.1085, 118.1000, 119.0200),
("2019-03-29", 118.0700, 118.3200, 116.9600, 117.9400),
("2019-03-28", 117.4400, 117.5800, 116.1300, 116.9300),
("2019-03-27", 117.8750, 118.2100, 115.5215, 116.7700),
("2019-03-26", 118.6200, 118.7050, 116.8500, 117.9100),
("2019-03-25", 116.5600, 118.0100, 116.3224, 117.6600),
("2019-03-22", 119.5000, 119.5900, 117.0400, 117.0500),
("2019-03-21", 117.1350, 120.8200, 117.0900, 120.2200),
("2019-03-20", 117.3900, 118.7500, 116.7100, 117.5200),
("2019-03-19", 118.0900, 118.4400, 116.9900, 117.6500),
("2019-03-18", 116.1700, 117.6100, 116.0500, 117.5700),
("2019-03-15", 115.3400, 117.2500, 114.5900, 115.9100),
("2019-03-14", 114.5400, 115.2000, 114.3300, 114.5900),
];
vec![
("2019-04-25", 130.06, 131.37, 128.83, 129.15),
("2019-04-24", 125.79, 125.85, 124.52, 125.01),
("2019-04-23", 124.1, 125.58, 123.83, 125.44),
("2019-04-22", 122.62, 124.0000, 122.57, 123.76),
("2019-04-18", 122.19, 123.52, 121.3018, 123.37),
("2019-04-17", 121.24, 121.85, 120.54, 121.77),
("2019-04-16", 121.64, 121.65, 120.1, 120.77),
("2019-04-15", 120.94, 121.58, 120.57, 121.05),
("2019-04-12", 120.64, 120.98, 120.37, 120.95),
("2019-04-11", 120.54, 120.85, 119.92, 120.33),
("2019-04-10", 119.76, 120.35, 119.54, 120.19),
("2019-04-09", 118.63, 119.54, 118.58, 119.28),
("2019-04-08", 119.81, 120.02, 118.64, 119.93),
("2019-04-05", 119.39, 120.23, 119.37, 119.89),
("2019-04-04", 120.1, 120.23, 118.38, 119.36),
("2019-04-03", 119.86, 120.43, 119.15, 119.97),
("2019-04-02", 119.06, 119.48, 118.52, 119.19),
("2019-04-01", 118.95, 119.1085, 118.1, 119.02),
("2019-03-29", 118.07, 118.32, 116.96, 117.94),
("2019-03-28", 117.44, 117.58, 116.13, 116.93),
("2019-03-27", 117.875, 118.21, 115.5215, 116.77),
("2019-03-26", 118.62, 118.705, 116.85, 117.91),
("2019-03-25", 116.56, 118.01, 116.3224, 117.66),
("2019-03-22", 119.5, 119.59, 117.04, 117.05),
("2019-03-21", 117.135, 120.82, 117.09, 120.22),
("2019-03-20", 117.39, 118.75, 116.71, 117.52),
("2019-03-19", 118.09, 118.44, 116.99, 117.65),
("2019-03-18", 116.17, 117.61, 116.05, 117.57),
("2019-03-15", 115.34, 117.25, 114.59, 115.91),
("2019-03-14", 114.54, 115.2, 114.33, 114.59),
]
}
#[test]
fn entry_point() {
Expand Down
Loading
Loading