Comments (24)
That is not on the planning. The Timeline internally already uses moment.js here and there, so it may be relatively easy to implement moment-timezone.js.
from vis.
If anyone has successfully implemented this suggestion, please could they post the basic steps necessary, to help get me started - thanks :)
from vis.
For 3.7.1 version, changing the line (row 25600)
c._isUTC = false;
to
c._isUTC = true;
did the trick.
Using the minified version, search for o._isUTC=!1 and change it to o._isUTC=!0
Hope this helps
from vis.
That looks like a dangerous trick...
from vis.
Why?
However, dealing just with UTC dates created via epoch I see no side effect.
from vis.
It's generally a bad idea to change internal, private variables of an external library, there can easily be overlooked side effects. You will eventually shoot your self in the foot with these kind of hacks.
- With every update of the library, you need to be careful fixing this manually changed thing again (hopefully, the trick still can be applied in newer versions of the library having changed internals).
- Probably, after a couple of months you forgot about this manual change in the code, and after updating to a newer version of the library things break. Furthermore,
- Your colleagues probably don't know about this hook at all and assume the moment.js library works as described in the docs of the library, which isn't the case anymore. That can give weird, hard to track down situations.
- If your application happens to use multiple modules all relying on moment.js, these modules may act unexpectedly as they assume the default behavior as documented by moment.js itself.
Did you have a look at moment.utc()
? Docs: http://momentjs.com/docs/#/parsing/utc/
from vis.
Yep, I agree (strongly). But I need a "quick and dirty" solution and the timeline uses moment() in too many places to propose a change on your side.
Is there a way to vote for desired enhancements?
from vis.
This issues section is both for issues and feature requests.
But again, isn't moment.utc()
doing exactly what you need?
from vis.
I have the same problem i need that the timeline show me the time in the timezone that i configure, example. I am in Argentina (-3) y pass to setCursorTime the utc time and need that the timeline show me the date in timezone La_Paz that is (-4), Now if i pass a moment object or a Date object i see that the timeline convert to my locale.
from vis.
@jos
yes, it does... but the setting of moment.utc objects as items has no effect on the timeline labels.
Please, let us know
from vis.
Good point. Maybe as a solution the Timeline should allow to give your own moment constructor via the options, so that you can return moment.utc(...)
or some custom time zone instead of local time.
from vis.
Hi. Just wanted to add my vote to this feature request. We are using the Timeline in a web app that is used by people in multiple time zones, and it is very important to us to be able to all use UTC time. For now we are just adding 12 hours to items in the timeline to get the correct times. Thanks :)
from vis.
+1 for this, having a large amount of data and manipulating array timestamps from server or client side is not fast.
from vis.
+1
from vis.
This is something we need as well. We need to show graphs in the server timezone, not user timezone. We use Graph2D and we pass dates in ISO 8601 format. Any suggestions on how to 'force' vis js to that timezone?
Thanks,
Adam
from vis.
Our application also needs this fix. A simple setTimezoneUTC=true option would suffice for us.
We pass dates using UTC time and the Timeline rearranges them based on local time, so our points are inaccurate.
For example, if I add the date 2015-06-08T15:30:49.000Z to the Timeline and the user is in New York, it will show up in the Timeline as 11:30:49 EDT, which doesn't make sense and confuses the user. When I apply ftringali's hack of setting o._isUTC=!0 in vis.min.js, the point shows up where it should at 15:30:49 UTC.
Are there any plans to make this a setting?
Thanks.
from vis.
The same for our projects. Please add this soon +1:
from vis.
I've implemented support for time zones by means of a configuration option moment
. This is by default is date constructor of moment.js, but can be overloaded which allows applying a custom time zone:
// display in UTC
var options = {
moment: function(date) {
return vis.moment(date).utc();
}
};
// display in UTC +08:00
var options = {
moment: function(date) {
return vis.moment(date).utcOffset('+08:00');
}
};
See this example: https://github.com/almende/vis/blob/develop/examples/timeline/other/timezone.html
I would love to get some feedback on whether the current implementation works correctly and addresses these issues. You can checkout or download the develop
branch to give it a try.
from vis.
Just when I needed it. Thanks!
Seems to work fine for me with basic UTC usage.
from vis.
Is it possible to change the time zone dynamically after the timeline has already been constructed? I've tried modifying the options member, but that didn't seem to have any effect:
timeline.options.moment = function(date) {
return vis.moment(date).utc();
}
I'm working on a tool that displays data from around the globe and I'd like to be able to switch between local time zone and UTC time zone.
from vis.
You can update the options at any moment via Timeline.setOptions(options)
, so I guess you could provide a new moment instance with different time zone.
from vis.
That's what I tried, but it doesn't update the timeline.
On Apr 5, 2016 10:08, Jos de Jong [email protected] wrote:You can update the options at any moment via Timeline.setOptions(options), so I guess you could provide a new moment instance with different time zone.
—You are receiving this because you commented.Reply to this email directly or view it on GitHub
from vis.
I just figured that also utc
is itself a constructor, so you can simplify the 1st above example to:
// display in UTC
var options = {
moment: vis.moment.utc
};
With 2 less function calls this is also more efficient.
from vis.
I've been facing a common issue for a few days now, The scenario goes as follows.
- I receive the timezone of a user on Login and pass that param to the timeline.
- Now when i change the system timezone to a different zone, the chart still holds the timezone of the user which i provide and does not overwrite it with the system time zone (As Expected).
- But if i neglect the system timezone, and manually set a time and date, the chart immediately picks up that manually changed wrong data and overwrites my the user timezone.
Help me find a solution where under any circumstance, there cannot be any overwriting of timezone. The source can only be one.
from vis.
Related Issues (20)
- Overlapping Edges in Vis.js 4.20.0 and later HOT 1
- Timeline - how to dynamically change options value? HOT 3
- timeline - update tooltip on onMoving callback is not working HOT 2
- Cross-Site Scripting DOM Input Validation and Representation HOT 1
- how to change X-Axis data format in Vis.js
- Suggestion for showcase - museum-digital
- Select option list is not clickable in groups section
- Flicking a timeline element off of screen unable to drag other element
- Is it possible to have a single line be drawn with multiple colors based on the data?
- Timeline bug with safari “moveTo” HOT 1
- Github Pages site for visjs.org down HOT 3
- Update items or remove
- Shorthand option for edge color being ignored
- Every time you update the "network" shape always changes, how can you make the shape unchanged? HOT 2
- Connector title disappears when (re-)opening a cluster HOT 2
- Looking for a plugin to draw such this graph online HOT 1
- Edge label at 0,0 HOT 1
- can we have items on either side of timeline(up and down)
- Showcase suggestion: libcolgraph
- Mark Original Start in Timeline Bar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vis.