Skip to content

Commit

Permalink
move criterion_plot into main crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Mar 16, 2024
1 parent 12382e6 commit 09cb348
Show file tree
Hide file tree
Showing 31 changed files with 74 additions and 141 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ cast = "0.3"
num-traits = { version = "0.2", default-features = false, features = ["std"] }
oorandom = "11.1"
regex = { version = "1.10", default-features = false, features = ["std"] }
criterion-plot = { path = "plot", version = "0.5.0" }

# Optional dependencies
rayon = { version = "1.9", optional = true }
Expand All @@ -73,6 +72,8 @@ approx = "0.5.1"
quickcheck = { version = "1.0", default-features = false }
rand = "0.8"
futures = { version = "0.3", default-features = false, features = ["executor"] }
itertools-num = "0.1"
num-complex = "0.4.5"

[features]
stable = [
Expand Down
3 changes: 0 additions & 3 deletions plot/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion plot/CONTRIBUTING.md

This file was deleted.

27 changes: 0 additions & 27 deletions plot/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion plot/LICENSE-APACHE

This file was deleted.

1 change: 0 additions & 1 deletion plot/LICENSE-MIT

This file was deleted.

38 changes: 0 additions & 38 deletions plot/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions plot/src/prelude.rs

This file was deleted.

8 changes: 4 additions & 4 deletions plot/src/axis.rs → src/criterion_plot/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use std::borrow::Cow;
use std::iter::IntoIterator;

use crate::map;
use crate::traits::{Configure, Data, Set};
use crate::{
use super::map;
use super::traits::{Configure, Data, Set};
use super::{
grid, Axis, Default, Display, Grid, Label, Range, Scale, ScaleFactor, Script, TicLabels,
};

Expand Down Expand Up @@ -191,7 +191,7 @@ impl<'a> Script for (Axis, &'a Properties) {
}
}

impl crate::ScaleFactorTrait for Properties {
impl super::ScaleFactorTrait for Properties {
fn scale_factor(&self) -> f64 {
self.scale_factor
}
Expand Down
8 changes: 4 additions & 4 deletions plot/src/candlestick.rs → src/criterion_plot/candlestick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::iter::IntoIterator;

use itertools::izip;

use crate::data::Matrix;
use crate::traits::{self, Data, Set};
use crate::{Color, Default, Display, Figure, Label, LineType, LineWidth, Plot, Script};
use super::data::Matrix;
use super::traits::{self, Data, Set};
use super::{Color, Default, Display, Figure, Label, LineType, LineWidth, Plot, Script};

/// Properties common to candlestick plots
pub struct Properties {
Expand Down Expand Up @@ -128,7 +128,7 @@ where
where
F: FnOnce(&mut Properties) -> &mut Properties,
{
let (x_factor, y_factor) = crate::scale_factor(&self.axes, crate::Axes::BottomXLeftY);
let (x_factor, y_factor) = super::scale_factor(&self.axes, super::Axes::BottomXLeftY);
let Candlesticks { x, whisker_min, box_min, box_high, whisker_high } = candlesticks;

let data = Matrix::new(
Expand Down
8 changes: 4 additions & 4 deletions plot/src/curve.rs → src/criterion_plot/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::iter::IntoIterator;

use itertools::izip;

use crate::data::Matrix;
use crate::traits::{self, Data, Set};
use crate::{
use super::data::Matrix;
use super::traits::{self, Data, Set};
use super::{
Axes, Color, CurveDefault, Display, Figure, Label, LineType, LineWidth, Plot, PointSize,
PointType, Script,
};
Expand Down Expand Up @@ -263,7 +263,7 @@ where
configure(&mut props);

let (x_factor, y_factor) =
crate::scale_factor(&self.axes, props.axes.unwrap_or(crate::Axes::BottomXLeftY));
super::scale_factor(&self.axes, props.axes.unwrap_or(super::Axes::BottomXLeftY));

let data = Matrix::new(izip!(x, y), (x_factor, y_factor));
self.plots.push(Plot::new(data, &props));
Expand Down
2 changes: 1 addition & 1 deletion plot/src/data.rs → src/criterion_plot/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::mem;

use cast::From as _0;

use crate::traits::Data;
use super::traits::Data;

macro_rules! impl_data {
($($ty:ty),+) => {
Expand Down
4 changes: 2 additions & 2 deletions plot/src/display.rs → src/criterion_plot/display.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::borrow::Cow;

use crate::key::{Horizontal, Justification, Order, Stacked, Vertical};
use crate::{Axes, Axis, Color, Display, Grid, LineType, PointType, Terminal};
use super::key::{Horizontal, Justification, Order, Stacked, Vertical};
use super::{Axes, Axis, Color, Display, Grid, LineType, PointType, Terminal};

impl Display<&'static str> for Axis {
fn display(&self) -> &'static str {
Expand Down
8 changes: 4 additions & 4 deletions plot/src/errorbar.rs → src/criterion_plot/errorbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::iter::IntoIterator;

use itertools::izip;

use crate::data::Matrix;
use crate::traits::{self, Data, Set};
use crate::{
use super::data::Matrix;
use super::traits::{self, Data, Set};
use super::{
Color, Display, ErrorBarDefault, Figure, Label, LineType, LineWidth, Plot, PointSize,
PointType, Script,
};
Expand Down Expand Up @@ -232,7 +232,7 @@ where
where
F: FnOnce(&mut Properties) -> &mut Properties,
{
let (x_factor, y_factor) = crate::scale_factor(&self.axes, crate::Axes::BottomXLeftY);
let (x_factor, y_factor) = super::scale_factor(&self.axes, super::Axes::BottomXLeftY);

let style = e.style();
let (x, y, length, height, e_factor) = match e {
Expand Down
8 changes: 4 additions & 4 deletions plot/src/filledcurve.rs → src/criterion_plot/filledcurve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::iter::IntoIterator;

use itertools::izip;

use crate::data::Matrix;
use crate::traits::{self, Data, Set};
use crate::{Axes, Color, Default, Display, Figure, Label, Opacity, Plot, Script};
use super::data::Matrix;
use super::traits::{self, Data, Set};
use super::{Axes, Color, Default, Display, Figure, Label, Opacity, Plot, Script};

/// Properties common to filled curve plots
pub struct Properties {
Expand Down Expand Up @@ -128,7 +128,7 @@ where
configure(&mut props);

let (x_factor, y_factor) =
crate::scale_factor(&self.axes, props.axes.unwrap_or(crate::Axes::BottomXLeftY));
super::scale_factor(&self.axes, props.axes.unwrap_or(super::Axes::BottomXLeftY));

let data = Matrix::new(izip!(x, y1, y2), (x_factor, y_factor, y_factor));
self.plots.push(Plot::new(data, &props));
Expand Down
2 changes: 1 addition & 1 deletion plot/src/grid.rs → src/criterion_plot/grid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Gridline
use crate::{Axis, Default, Display, Grid, Script};
use super::{Axis, Default, Display, Grid, Script};

/// Gridline properties
#[derive(Clone, Copy)]
Expand Down
4 changes: 2 additions & 2 deletions plot/src/key.rs → src/criterion_plot/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
use std::borrow::Cow;

use crate::traits::Set;
use crate::{Default, Display, Script, Title};
use super::traits::Set;
use super::{Default, Display, Script, Title};

/// Properties of the key
#[derive(Clone)]
Expand Down
4 changes: 2 additions & 2 deletions plot/src/map.rs → src/criterion_plot/map.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Enum Maps
pub mod axis {
use crate::Axis;
use super::super::Axis;

const LENGTH: usize = 4;

Expand Down Expand Up @@ -79,7 +79,7 @@ pub mod axis {
}

pub mod grid {
use crate::Grid;
use super::super::Grid;

const LENGTH: usize = 2;

Expand Down
Loading

0 comments on commit 09cb348

Please sign in to comment.