This code fails to compile, and will complain with the following:
error[E0599]: the method `configure_mesh` exists for struct `ChartContext<'_, BitMapBackend<'_>, Cartesian2d<WithKeyPoints<RangedCoordf32>, RangedCoordf32>>`, but its trait bounds were not satisfied
--> src/bin/plotting.rs:30:11
|
30 | chart.configure_mesh()
| ^^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
|
::: $HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.7/src/coord/ranged1d/combinators/ckps.rs:16:1
|
16 | pub struct WithKeyPoints<Inner: Ranged> {
| --------------------------------------- doesn't satisfy `<_ as Ranged>::FormatOption = DefaultFormatting` or `WithKeyPoints<RangedCoordf32>: ValueFormatter<f32>`
|
= note: the following trait bounds were not satisfied:
`<WithKeyPoints<RangedCoordf32> as plotters::prelude::Ranged>::FormatOption = DefaultFormatting`
which is required by `WithKeyPoints<RangedCoordf32>: ValueFormatter<f32>`
My change addresses the immediate issue, although I suspect there's a more elegant fix here. Couldn't find a quick fix for the issue of a default implementation not existing when T::FormatOption != DefaultFormatting, but it occurred to me that maybe a macro at least would be better? Although conversely it's only for f32 and f64 at the moment so I'm not sure.
Allow using
f32
key point ranges when constructing a Cartesian2d chart:This code fails to compile, and will complain with the following:
My change addresses the immediate issue, although I suspect there's a more elegant fix here. Couldn't find a quick fix for the issue of a default implementation not existing when
T::FormatOption != DefaultFormatting
, but it occurred to me that maybe a macro at least would be better? Although conversely it's only for f32 and f64 at the moment so I'm not sure.