plotters-rs / plotters

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely 🦀 📈🚀
https://plotters-rs.github.io/home/
MIT License
3.89k stars 281 forks source link

[BUG] AsRangedCoord not implemented for Range<NaiveDateTime> #605

Open DCNick3 opened 4 months ago

DCNick3 commented 4 months ago

Describe the bug

I am trying to call ChartBuilder::build_cartesian_2d with Range<chrono::NaiveDateTime> as an argument, but it fails due to unsatisfied AsRangedCoord trait. If I construct RangedDateTime object manually with RangedDateTime::from(min_date..max_date) it works, so I feel this was just an oversight.

To Reproduce

let min_date = NaiveDateTime::UNIX_EPOCH;
let max_date = NaiveDateTime::UNIX_EPOCH.add(TimeDelta::seconds(64));

let mut chart = ChartBuilder::on(&root)
    .build_cartesian_2d(min_date..max_date, -0.1f32..1f32)
    .unwrap();

// ...

Version Information plotters = "0.3.6"