GithubHelp home page GithubHelp logo

Comments (13)

38 avatar 38 commented on August 29, 2024 1

That's something I have no chance to implement yet. But I am going to clean this up very soon.
Basically, both DateTime and Duration should be supported.

from plotters.

38 avatar 38 commented on August 29, 2024 1

And use chrono::DateTime instead of chrono::Date.

That is mostly right. But it will cause problem if the DateTime range is smaller than one day.

But we can add additional logic to the existing date handling code make it also produce, hourly, ...., etc.

Why not implement IntoMonthly, IntoYearly, Into Hours, Into Minutes, IntoSeconds for one DateTime struct?

And I would like to mention the reason why IntoMonthly and IntoYearly exists is because month and year aren't equally length. Thus, there's many weird things may happen when we want to have monthly or yearly granularity. Basically, you can not get real monthly or yearly granularity by simply splitting the range. And this is what those trait for, the reason for there's no IntoWeekly and IntoDaily is the same, because they always have the same length, and all those need should be fulfilled by tweaking the number of labels.

It seems some amount of work to do to support all those things. I will think about a concrete plan to support this. And I probably have time to address this in a day or two.

Please let me know if you have any other concerns.

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

It looks like Datetime require only Date not DateTime?
pub struct RangedDate<Z: TimeZone>(Date<Z>, Date<Z>);

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

In datetime mod there is RangedDateTime struct which is not developed.
Is it really needed to have two Date and DateTime coords structs? Why not implement
IntoMonthly, IntoYearly, Into Hours, Into Minutes, IntoSeconds for one DateTime struct?

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

And use chrono::DateTime instead of chrono::Date.

from plotters.

38 avatar 38 commented on August 29, 2024

@serzhiio Just a quick update, monthly and yearly coordinate should be able to accept DateTime now.

I've just refactored a little bit but still not tested it. And the next step should be add code that identify the granularity for a DateTime range. And if we need to use a granularity which is bigger than a day, we can simply reuse the code for Date.

I will let you know when this happen

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

This sounds sweet. I'd like to help, but your code a bit complicated for me (too many traits :))
I'm exploring ability to work with milliseconds, this is all i need now.

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024
error[E0277]: the trait bound `std::ops::Range<chrono::datetime::DateTime<chrono::offset::utc::Utc>>: plotters::coord::ranged::Ranged` is not satisfied
   --> src\scenes\instances\components\chart\mod.rs:173:14
    |
173 |             .build_ranged(from..to, min..max).unwrap();
    |              ^^^^^^^^^^^^ the trait `plotters::coord::ranged::Ranged` is not implemented for `std::ops::Range<chrono::datetime::DateTime<chrono::offset::utc::Utc>>`

from plotters.

38 avatar 38 commented on August 29, 2024

No, I mean it support :(a..b).monthly() , (a..b).yearly()

But now it supports datetime completely.

Finally get this dome ;)

Closing the issue, feel free to reopen it if you find anything is wrong.

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

Hmm.. it looks like working, but there are no labels at least on 3 minutes timespan?

from plotters.

38 avatar 38 commented on August 29, 2024

image

You mean this, it works on my side. Would you like to send a minimal code reproduce what you have seen?

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

Its working as supposed after latest bugfix.
Is it possible to format label to show only minutes+sec like ":30:15"?

from plotters.

serzhiio avatar serzhiio commented on August 29, 2024

Ive managed this via .x_lable_formatter().

from plotters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.