Skip to content

Commit

Permalink
Fix missing WithKeyPoints<T> default impl when T::Formatter is not De…
Browse files Browse the repository at this point in the history
…faultFormatting
  • Loading branch information
oldgalileo committed Oct 23, 2024
1 parent 1f174c8 commit 6268a7f
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions plotters/src/coord/ranged1d/types/numeric.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::convert::TryFrom;
use std::ops::Range;

use crate::coord::ranged1d::{
use crate::coord::{combinators::WithKeyPoints, ranged1d::{
AsRangedCoord, DefaultFormatting, DiscreteRanged, KeyPointHint, NoDefaultFormatting, Ranged,
ReversibleRanged, ValueFormatter,
};
}};

macro_rules! impl_discrete_trait {
($name:ident) => {
Expand Down Expand Up @@ -268,6 +268,17 @@ impl ValueFormatter<f32> for RangedCoordf32 {
.print(*value as f64)
}
}
impl ValueFormatter<f32> for WithKeyPoints<RangedCoordf32> {
fn format(value: &f32) -> String {
crate::data::float::FloatPrettyPrinter {
allow_scientific: false,
min_decimal: 1,
max_decimal: 5,
}
.print(*value as f64)
}
}

make_numeric_coord!(
f64,
RangedCoordf64,
Expand All @@ -286,6 +297,16 @@ impl ValueFormatter<f64> for RangedCoordf64 {
.print(*value)
}
}
impl ValueFormatter<f64> for WithKeyPoints<RangedCoordf64> {
fn format(value: &f64) -> String {
crate::data::float::FloatPrettyPrinter {
allow_scientific: false,
min_decimal: 1,
max_decimal: 5,
}
.print(*value)
}
}
make_numeric_coord!(
u32,
RangedCoordu32,
Expand Down

0 comments on commit 6268a7f

Please sign in to comment.