Skip to content

Commit 29e2816

Browse files
committed
Add ReversibleRanged support for LogCoord.
1 parent 3ad52da commit 29e2816

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

plotters/src/coord/ranged1d/combinators/logarithmic.rs

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ impl<T: LogScalable> IntoLogRange for Range<T> {
7878
}
7979
}
8080

81+
impl<V: LogScalable> ReversibleRanged for LogCoord<V> {
82+
fn unmap(&self, input: i32, limit: (i32, i32)) -> Option<V> {
83+
self.linear.unmap(input, limit).and_then(|value_ln| {
84+
let fv = value_ln.exp();
85+
let value = self.f64_to_value(fv);
86+
Some(value)
87+
})
88+
}
89+
}
90+
8191
/// The logarithmic coordinate decorator.
8292
/// This decorator is used to make the axis rendered as logarithmically.
8393
#[derive(Clone)]

0 commit comments

Comments
 (0)