Giter Site home page Giter Site logo

Comments (26)

jgorene avatar jgorene commented on July 26, 2024 1

@mojoaxel Thank you so πŸ˜‰
By the way, thanks a lot for your involment here πŸ‘

That said, I just updated "the bin" to try to get something a little more user friendly.
Nevertheless, it's still some tinkering for now...

from vis.

josdejong avatar josdejong commented on July 26, 2024

Thanks.

There are other similar feature requests like these: for example give all weekends (sat, sun) a distinct background color. Or give all days in the past a different color. I think we could add some css classes to denote these special days. We need to think about all kind of patterns that you may want to use.

See also the new feature showCurrentTime just implemented by @fi0dor: #17

from vis.

MojoDK avatar MojoDK commented on July 26, 2024

Hi all,

Anybody knows if and when it's going to be possible to give weekends a distinct background color?

thx

from vis.

josdejong avatar josdejong commented on July 26, 2024

I have to be careful with these kind of predictions, but a rough estimation is within 2 weeks to 2 months.

from vis.

AlexDM0 avatar AlexDM0 commented on July 26, 2024

To wrap up, you can use the backgroundItem for this. With that I'll assume this issue is closed.

Regards,

Alex

from vis.

josdejong avatar josdejong commented on July 26, 2024

I don't agree. Yes, you can add background items for things like today, weekend, day/night, etc. but that is relatively much work. It will be way more convenient if all you would have to do is set some css style like

.vis.timeline .grid.saturday, 
.vis.timeline .grid.sunday {
  background: #f5f5f5f;
}

.vis.timeline .grid.today {
  background: #ffffe0;
}

Ok to re-open?

from vis.

gigi81 avatar gigi81 commented on July 26, 2024

Despite the background area being a good solution, I have to agree with Jos. It would be much more convenient if could be done with css.

To be fair, anyway, I would consider closed this issue because there is now a way to do it and open a different feature request for the css solution.

Thanks guys for the good work.

from vis.

AlexDM0 avatar AlexDM0 commented on July 26, 2024

I see, given this was such an old issue I figured this was the solution for this and that this issue was forgotten. The downside is that the blocks are dynamic. If you want to color nights but the blocks are only days then we have a problem that would not occur with backgrounds.

How do you think to fix this? The same would hold true for hours, minutes, seconds etc. Really depends on the usecase what scale is being used. Maybe years, months, etc. Zooming is not your friend with the css approach.

Regards

from vis.

gigi81 avatar gigi81 commented on July 26, 2024

I think supporting a list of css classes will cover most of the use case. Some examples:

  • days of week (monday to sunday)
  • months (january to december)
  • current day (today), week, month, year
  • previous/next day, month, year
  • first/last day of the month/year
  • also if the days had an id they could be easily styled with jquery/javascript.

from vis.

AlexDM0 avatar AlexDM0 commented on July 26, 2024

Hi Gigi,

I agree that would be easy but my point is that depending on the zoom level, there might not be divs to allocate those classes to.

Regards,

Alex

from vis.

josdejong avatar josdejong commented on July 26, 2024

@alex, indeed, say you style Saturday and Sunday with a gray background color, you will only see this when zoomed in at week level, not when zoomed in or out. But I think that's no problem in practice, as this distinction will not be needed (or even unwanted) when looking at month, year, or hour level.

In addition to @gigi81's ideas:

  • hours of day (so you can distinct a working day from say 9:00 to 18:00).

from vis.

AlexDM0 avatar AlexDM0 commented on July 26, 2024

True, Jos, could you place put this in the timeline? I could use it with the demo's instead of using the backgrounds as I am now. This would work really well with the hiddenDates feature I'm building.

from vis.

josdejong avatar josdejong commented on July 26, 2024

@AlexDM0 yes it's on my list

from vis.

AlexDM0 avatar AlexDM0 commented on July 26, 2024

this has been added by Jos in 3.8.0

from vis.

gigi81 avatar gigi81 commented on July 26, 2024

Well done!

from vis.

nunks avatar nunks commented on July 26, 2024

I'm sorry if this is a stupid question, but where are the css classes for the days of the week? I searched the repository for "vis-saturday" and all I found is the documentation saying that they exist. Shouldn't they be found on vis.css?

from vis.

josdejong avatar josdejong commented on July 26, 2024

These css styles like vis-saturday are dynamically created from JavaScript. The default styling of the Timeline doesn't utilize these css styles, so you will not find them in vis.css.

from vis.

daniel-pfeiffer avatar daniel-pfeiffer commented on July 26, 2024

They work nicely but with a kind of flaw as you change the zoom level. E.g. if I zoom out to a whole month, day names stop to be displayed, and at the same time their css-class disappears. But 2015-10-24 is still a saturday, no matter the zoom level.
Zooming in, the same is true, e.g. if I only display 2 days, I'll have hour classes, but no longer the day classes. It would be great to combine them. I.e. I use rgba (transparent) background colours that the browser can merge easily.
There should probably be thresholds for that, e.g. when zoomed out to a year, it would no longer make sence to have thousands of divs with hour classes, each less than a pixel wide. ;-)

from vis.

josdejong avatar josdejong commented on July 26, 2024

Yes that's intended behavior. It would be technically very expensive to keep rendering all different scales on every zoom level, which would be required if you want to do this sort of stuff. Imagine you've zoomed out to see more than a year at once. The Timeline would have to render all days, hours, etc, as it can't know if you want to colorize all Saturdays and Sundays, or all time blocks between 9:00 and 17:00. Besides that, I think it could easily result in a very noisy, chaotic view. I think it's best to keep the styling of the days/hours/etc per scale. A smooth transition would be cool, but is technically very hard to achieve.

from vis.

lbrdar avatar lbrdar commented on July 26, 2024

Hi all,

did anyone manage to highlight a specific day? Let's say that I want to highlight Christmas or any holiday, how would I be able to do it?

I see that custom classes were added to control for example day of the week or specific hour. But using those classes for highlighting a holiday wouldn't really work.

Can someone please help me with this?

Thank you,
Leo

from vis.

Jogai avatar Jogai commented on July 26, 2024

Highlighting christmas is as easy as:

.vis-day25.vis-december {
    background: red;
}

from vis.

lbrdar avatar lbrdar commented on July 26, 2024

@Jogai

Not really, as vis classes are added and removed dynamically, that will work only in case of a certain zoom level where those classes are applied.
If I zoom in, let's say, to a week level - Christmas won't be highlighted.

from vis.

Jogai avatar Jogai commented on July 26, 2024

That is true, but technically it is not visible anyway.

from vis.

leobrdar avatar leobrdar commented on July 26, 2024

@Jogai It's still visible, though. Maybe it's not displayed as a date on the axis, but it's still visible.

However, my specific use case is - I want to highlight the non-working hours and weekends. But, since weekday classes are removed on zoom, it looks like this:

screen shot 2018-07-10 at 15 13 55

The correct display would be that all hours on Saturday and Sunday are highlighted. Is there any way to do this?

Why are classes removed anyway? Why not keep all higher classes on all zoom levels? For example on zoom where days are displayed, keep week, month and year?

from vis.

jgorene avatar jgorene commented on July 26, 2024

@leobrdar I also encountered this problem and after working for a while, I finally found a solution to my needs. Even if it's a little far-fetched, it still works pretty well...

Anyway, it's only a workaround because I haven't found any other way to do that yet, indeed.
In any case, it must be adapted to your needs, of course.

Here a working example https://output.jsbin.com/xatuxeq

from vis.

mojoaxel avatar mojoaxel commented on July 26, 2024

@jgorene 😍 Thanks for sharing!

from vis.

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.