Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start with zoom (custom granularity) on "now" #13

Closed
felixhayashi opened this issue Jul 7, 2015 · 5 comments
Closed

Start with zoom (custom granularity) on "now" #13

felixhayashi opened this issue Jul 7, 2015 · 5 comments
Labels

Comments

@felixhayashi
Copy link

Hi @kixam

I would really like to start with "now" being focussed and have a certain zoom level at the same time.

E.g. start with "now" and granularity "hours". I had a look at the vis options and this is not possible out of the box. The only way to achieve it is by setting start and end dates of the window (see almende/vis#144). Would it be possbile to have a TW5-visjsTimeline
option where I can do the following:

<$visjstimeline startDateField="modified" boxing="static" config="Timeline/config" customTime="now" granularity="hours" navpad />

Thanks
-Felix

@kixam
Copy link
Owner

kixam commented Jul 7, 2015

Hi @felixhayashi ,

his is not possible out of the box

Do you mean I should develop a feature not available in a backend library, into the frontend library ?? This is against by developing beliefs and code of good programming.

This is unfortunate you cannot do maths, and in this case date maths, with TW5. I think you will have to write a small javascript macro for your need.

However, I might take this need into account for the development of my datePicker plugin. I know moment.js provides very deep date maths, and TW5 could take great benefit from this.

@kixam kixam added the wontfix label Jul 7, 2015
@felixhayashi
Copy link
Author

This is against by developing beliefs and code of good programming.

Noo, its very available in a backend library! But it requires javascript which I cannot use as a widget user. E.g. setting granularity to "hour" would require you to create a startdate=now-1hour and enddate=now+1hour.

This is unfortunate you cannot do maths, and in this case date maths, with TW5.

Yes, this would be a solution as well. I could write a macro that calculates start and end dates based on "now". I just thought it is a common feature that makes sense being supported by your plugin...

@kixam
Copy link
Owner

kixam commented Jul 7, 2015

it requires javascript which I cannot use as a widget user

What about as a macro writer and user? I mean javascript macros. With access to moment.js. Which I load globally for another purpose (in browser mode only for now). It has to be tried.

@kixam kixam added question and removed wontfix labels Jul 7, 2015
@kixam kixam closed this as completed in a372194 Oct 14, 2015
kixam added a commit that referenced this issue Oct 14, 2015
@felixhayashi
Copy link
Author

What a nice idea @kixam to expose it like this moment(2015-10-14).add(1,days) and secure it with a regex!

I'll test it the next time. Thanks!

@kixam
Copy link
Owner

kixam commented Oct 14, 2015

well, the persistent option does not accept empty timeline.start/.end fields now as I introduced a new bug (corrected only on my local copy for now)... Seems it needs further testing... Anyway, I'm working on #12 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants