Coder Social home page Coder Social logo

visjs / vis-timeline Goto Github PK

View Code? Open in Web Editor NEW
1.8K 1.8K 303.0 1.42 GB

📅 Create a fully customizable, interactive timelines and 2d-graphs with items and ranges.

Home Page: https://visjs.github.io/vis-timeline/

License: Other

JavaScript 93.83% HTML 2.57% CSS 3.59% Shell 0.01%
chart hacktoberfest timeline vis

vis-timeline's People

Contributors

alexdm0 avatar areson avatar bradh avatar brendon1982 avatar btmorton avatar cdjackson avatar dennissterzenbach avatar dturkenk avatar dude9177 avatar felixhayashi avatar gillingham avatar hansmaulwurf23 avatar jasonex7 avatar jczacharia avatar josdejong avatar kannonboy avatar knokit avatar lewisjb avatar ludost avatar macleodbroad-wf avatar mojoaxel avatar renovate-bot avatar renovate[bot] avatar ryamaguchi0220 avatar smee avatar thomaash avatar tooa avatar wimrijnders avatar yoshiwalsh avatar yotamberk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vis-timeline's Issues

[Graph2d] Add markers which indicate what happened at the time to graphs

Feature Request


description

I think it's nice to be able to add markers which indicate what happened at the time to graphs.
This is useful, e.g, to supplement why the graph has been changed.

Current

We can do almost the same thing by using addCustomTime and setCustomTimeTitle but, It's inconvenient in the use case since the title is displayed only when the time bar is hovered.

スクリーンショット 2019-09-10 14 42 49

adopt code styling with Prettier

Before releasing the v6 we should discuss introduce code-styling with Prettier like we did in vis-network and the other libraries.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

'initialDrawDone' of undefined

Hi :)

thanks for plugin, good job!

I found in Graph2d.js file a redundant assignment in line 153. You try to set me.itemSet.initialDrawDone = true; but one line above You assigned the 'initialDrawDone' property to 'me' object. That 'itemSet' object is not exist in script. Please check this and give me a feedback :)

Dynamic Attributes on events

Hi,

Is there a way to pass an attribute to item so I can get it on an event?
I mean, in my project, I have to check if an item is a boolean value or not but when I added a listener to check that, an obj has some default properties but no dynamic properties.

I added a click event with on method like so:

timeline.on('click', (e) => {
      console.log(e)
 })

I want to know or suggest that could be possible to add dynamic properties to events so it could be possible to handle every item click.

Thanks and regards

vis-timeline not as performant as timeline-plus

Since deprecation of timeline-plus and its merge into the vis-timeline repo, I ported my project to use this repo, but I am experiencing major performance issues that are not present in timeline-plus.

My project containing about 100 groups and each group around 10-20 nodes. I have all my groups load asynchronously such that the UI is not blocked when loading the groups. Using timeline-plus, each group takes around a quarter of a second to load, no problems once everything is loaded into memory; the UI is as smooth as butter. With vis-timeline, the first 10 groups take the same time but after that, each one group dramatically needs more time. The 100th group can take almost a minute to load. Then once everything is loaded, navigating around the timeline is severely laggy. I would say unusable.

With timeline-plus, the timeline's UI is like butter. But unusable with this repo. I am concerned that the performance improvements made in timeline-plus were not correctly ported over to this timeline.

Start at "topmost" group/move to group name

Hello,

I am using timeline with a significant amount of groups (Names sorted by Alphabet) that cannot be displayed on the screen at once. By default, when timeline is created, it starts out the very bottom (so Names starting with Z are in view). Is there a way to change this behaviour so timeline starts at the top instead?

Both groups and items are populated via ajax.

Item focus is not really a solution, since the first item does not necesseraly belong to the first Group (and in fact since I don't need them at the moment, my items don't have id's at all currently, allthough I could add some if that somehow helps).

Also, related, is there a way to make timeline jump to a group by name? So I can have like a search field and once executed, the view centers on that group?

Error in Graph2.js in 06_interpolation.js sample

Hi all,
I've just downloaded the last vis-timeline repo by git tool.
I'm taking a look to this sample and running on Firefox I see an error on the browser console:

TypeError: a.itemSet is undefined[Ulteriori informazioni] Graph2d.js:141:8

PS: I'm looking for a library to draw a chart that allows to drag every point of a chart; is there a sample that does it?

Moveable, zoomable, showMajorLabels are not read from options argument

When creating a new timeline with the options object, moveable, zoomable and showMajorLabels values even though are set to false are not taken in consideration. Other attributes like orientation: 'top' for i.e work fine. Also tested setting this attributes in the example provided in the readme of this repo.

attribute d: Expected number

I'm using Graph2d. Not sure if this is an issue or my own stupidity but I get the following error:

Error: attribute d: Expected number, "M522,NaN CNaN,NaN NaN…".

My code looks like:

this.data = {
  groups: new V.DataSet([]),
  items: new V.DataSet([])
};
this.data.groups.update([
  { id: 1, content: 'A', options: {
    drawPoints: false
}},
{ id: 2, content: 'B', options: {
    drawPoints: false
  }}
]);
this.data.items.update([
  { x: new Date('2014-06-13'), y: 10, group: 1 },
  { x: new Date('2014-06-14'), y: 20, group: 1 },
  { x: new Date('2014-06-21'), y: 20, group: 2 },
  { x: new Date('2014-06-25'), y: 30, group: 2 }
]);
let container = document.getElementById("chart");
let options = {
  start: new Date('2014-06-10'),
  end: new Date('2014-07-04'),
  legend: true,
  height: '100%',
  autoResize: true,
  clickToUse: true
};
this.c = new V.Graph2d(container, this.data.items, this.data.groups, options);

Any ideas?

Group performance by clustering

I've noticed that having many timeline items drastically decreases performance.

I was attempting to solve this issue and I came across either a forked or different version of Vis.js timeline.

http://almende.github.io/chap-links-library/js/timeline/examples/example16_performance_grouping.html

performance_grouping

It appears to be combing or clustering the items to give better performance.

I want to throw this out there because it definitely exists and it would be awesome to see this implemented. I will happily aid in the contribution of this feature.

Here's the main page.
http://almende.github.io/chap-links-library/timeline.html

Zoomable false is ignored in 5.0.0

In my angular component i have working timeline with the old [email protected] library with the options below which works as expected, but when i change to the vis-timeline 5.0.0 library it totaly ignores those settings and always zooms instead of scrolls when using the mouse wheel.
const options = { width: '100%', zoomable: false, zoomKey: 'ctrlKey', horizontalScroll: true };

Is this a bug in the new library or am i missing something the disable zoom and enable horizontal scroll?

Items not placed correctly in rows after update.

I updated VIS this morning to get the translations working. This is working very well now, but the items are misplaced in the rows. I switched between the previous version and the latest update and it's indeed working correctly in the previous version. Please see pictures below. (they are placed correctly if it starts all folded out / showNested: true; But not when collapsed and open them one by one)

Previous Version:
gantRowissue

Current Version:
gantRowissueWrong

Align property of item doesn't override timeline align property

Hey, i have encountered a problem with align property of an item not overriding the options align property of timeline.

I want some specific items on the timeline to be aligned on the left of the line and some on the right side.

Due to the documentation for Vis.js timeline, property align of item should override the global align property of options for timeline. But it does not.

item example:

    var items = [];

    var item = {
      align: "left"
      date: "20.09.2019"
      eventId: 440
      heading: "Event"
      id: "86ad4f21-6235-46e0-b5c9-29a6d2c16f50"
      nodeType: "single-node"
      start: "2019-09-20T04:00:00"
    }

    items.push(item);

    // create dataset
    var dataset = new vis.DataSet(items);

timeline options:

    var options = {
      orientation: 'top',
      min: "2019-09-20T04:00:00",
      max: "2019-09-25T04:00:00",
      start: "2019-09-20T04:00:00",
      end: "2019-09-25T04:00:00",
      align: 'left'
    }

here is how i update the item align property after calling the vis.Timeline constructor:

    var visualization = document.getElementById('visualization');

    var timeline = new vis.Timeline(visualization, dataset, options);

    timeline.itemsData.forEach(function(dataItem) {
      if (dataItem.eventId === 440) {
        dataItem.align = 'right';
        timeline.itemsData.update(dataItem, {
          fieldId: "eventId"
        })
      }
    })

If i just use it wrongly, then i am sorry for spamming here, but i spent lots of time trying to figure it out.

Zoom does not work in Firefox

I'm on latest Firefox 68.0.1 and zoom using scroll wheel doesn't seem to work in online examples. Zoom works in Chromium though.

Unable to build timeline

tl;dr: How do I properly build the timeline? It seems to be broken event with a fresh install.


I am experiencing issues trying to build the master branch.

This is from a fresh clone and after running npm install.

1. Running npm run build gives the error:

$ npm run build

> [email protected] build C:\Users\zacharjc\Desktop\Repos\vis-timeline
> rollup --config rollup.config.js


index.js → dist/vis-timeline-graph2d.esm.js...
created dist/vis-timeline-graph2d.esm.js in 8.8s

index.js → dist/vis-timeline-graph2d.min.js...
[!] (plugin babel-minify) Error: don't know how to turn this value into a node
Error: don't know how to turn this value into a node
    at Object.valueToNode (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\types\lib\converters\valueToNode.js:103:9)
    at PluginPass.Expression (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\babel-plugin-minify-constant-folding\lib\index.js:195:26)
    at PluginPass.newFn (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\visitors.js:230:17)
    at newFn (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\visitors.js:193:21)
    at NodePath._call (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\path\context.js:53:20)
    at NodePath.call (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\path\context.js:40:17)
    at NodePath.visit (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\path\context.js:88:12)
    at TraversalContext.visitQueue (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\context.js:118:16)
    at TraversalContext.visitSingle (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\context.js:90:19)
    at TraversalContext.visit (C:\Users\zacharjc\Desktop\Repos\vis-timeline\node_modules\@babel\traverse\lib\context.js:146:19)

The workaround is to just use the vis-timeline-graph2d.esm.js file


2. In my project, I have installed the local vis-timeline vis npm install -s ../vis-timeline which renders:

"dependencies": {
    ...
    "vis-timeline": "file:../vis-timeline"
    ...
}

in package.json.

When importing vis-timeline via import * as vis from 'vis-timeline'; in my typescript project using this code:

this.timeline = new vis.Timeline(
      document.getElementById('timeline-main'),
      [
        { id: 1, content: 'item 1', start: '2014-04-20' },
        { id: 2, content: 'item 2', start: '2014-04-14' },
        { id: 3, content: 'item 3', start: '2014-04-18' },
        { id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19' },
        { id: 5, content: 'item 5', start: '2014-04-25' },
        { id: 6, content: 'item 6', start: '2014-04-27', type: 'point' }
      ],
      { height: 'calc(100vh - 136px)' }
    );

I get the error:

"export 'Timeline' (imported as 'vis') was not found in 'vis-timeline'

But when importing vis const vis = require('vis-timeline');

I get the error:

ERROR TypeError: vis.Timeline is not a constructor
    at ActivitiesComponent.push../src/app/features/crew/component/activities/activities.component.ts.ActivitiesComponent.ngAfterContentInit (activities.component.ts:19)
    at callProviderLifecycles (core.js:21406)
    at callElementProvidersLifecycles (core.js:21387)
    at callLifecycleHooksChildrenFirst (core.js:21377)
    at checkAndUpdateView (core.js:29442)
    at callViewAction (core.js:29679)
    at execComponentViewsAction (core.js:29621)
    at checkAndUpdateView (core.js:29444)
    at callViewAction (core.js:29679)
    at execEmbeddedViewsAction (core.js:29642)

I want to build the timeline so I can contribute and test out the timeline-plus merges but I am blocked from doing so until I can do a successful build.

extend instead of replace existing locales

It is possible to set custom locales (docs, example).

Current behavior

If a custom local is given the embedded locales are overwritten and can not be used anymore.

Expected behavior

If custom locales are provided via the options the should extend the existing locals not replace them.

Network and Graph2d not working in the same app

We use both network and 2d charts in the same app. This worked fine in vis 4.x but no longer works. I get the following error:

TypeError: vis.Network is not a constructor

If the load order is

        <!--Vis-->
        <script src="dist/vis-network.min.js"></script>
        <script src="dist/vis-timeline-graph2d.min.js"></script>

and

TypeError: vis.Graph2d is not a constructor

if the graph2d module loads first. It appears like the one module overwrites the other. The last module in the load order is the one that works.

getCustomTime does not work with id

When using the getCustomTime function with an id parameter, it always errors out.
I investigated a bit, and found that the library doesn't store the id in the options field in the members of the internally stored customTimes array.

install a greenkeeper

we should install a greenkeeper bot that auto-updates dependencies. This is especially important for dependencies on vis-util or vis-data.

Shade/gray-out unloaded time ranges?

Hello!

I am developing with vis.js and I am loving it!

I was wondering if it would be a reasonable feature request to be able to have "unloaded" time ranges shaded or grayed out so when a user scrolls outside of the currently loaded time range they know that there might be data that needs to be loaded.

The same functionality said a different way:

Is it possible to have the default timeline background a selected color (user would most likely choose gray or black) and have the loaded regions appear a different selected color (user would likely choose white like in the default examples) so that if a user zooms out, they see that the unloaded regions are shaded so they need to stop scrolling to let them load? (I have all the loading functionality working, just need a way to determine if and where the background would have the shaded or un-shaded class)

Appreciate any help if this is possible with the current grid background styling.
I did check https://visjs.github.io/vis-timeline/docs/timeline/#Styles but it seems like it would take quite a bit of work in order to generate the corresponding css, if possible at all.

Composer unable to install vis-timeline as NPM asset

After adding the NPM package to my composer file (require > "vis-timeline": "5.1.0"). composer is unable to find it. However it does find the vis-network NPM package. Composer search cannot find it either, it only returns "cliffparnitzky/vis.js-timeline". Am I the only one experiencing this issue?

Npm not up to date

Hello,

The npm package and the git have differents update dates but they have the same version :
npm package from : https://unpkg.com/vis-timeline@latest/dist/vis-timeline-graph2d.min.js
(Redirects to : https://unpkg.com/[email protected]/dist/vis-timeline-graph2d.min.js)

 * @version 5.1.0
 * @date    2019-08-02T15:25:33Z

git repo from : https://github.com/visjs/vis-timeline/blob/master/dist/vis-timeline-graph2d.min.js

 * @version 5.1.0
 * @date    2019-08-13T18:10:02Z

The main problem is that in the npm package there is no such thing as clustering but in the git repo, the clustering is working correctly.

Console error when clustering with using npm package

Here is the options used in the component:

  	// Configuration for the Timeline
  	var defaultOptions = {
  		stack: false,
  		maxHeight: 800,
  		height: 150,
  		type: 'point',
  		groupOrder: 'content',
  		cluster: {
  			titleTemplate:
  				'This cluster contains {count} elements',
  			showStipes: false
  		},
  		template: (itemData, element, data) => {
  			if (data.isCluster) {
  				return `<div>${data.content}</div>`;
  			} else {
  				return `<div>${data.content}</div>`;
  			}
  		},
  		moment: function(date) {
  			return vis.moment(date).utc();
  		}
  	};

And here is the error I get :

Unknown option detected: "cluster" in 

options = {
  cluster
}

Perhaps it was misplaced? Matching option found at: 
options = {
  configure: {
    filter
  }
}

Could you update the npm package along with the updates on the git repository or at least keep a version on npm that can run all the examples that can be found in : https://github.com/visjs/vis-timeline/tree/master/examples/

Thank you and keep going your library is very nice 🥇

Scroll wheel zooms horizontally and scrolls vertically

When zoomKey: '' and verticalScroll: true, scrolling will zoom in/out vertically via rangechange and will also scroll up/down on the groups.

WORKAROUND: set preferZoom: true in the timeline config options.

A good solution for this would be to add preferZoom in documentation and default preferZoom to true on timeline init.

Default test script doesn't work

On a clean clone of the repo, running the default test script (npm run test) throws this error:

C:\dev\vis-timeline\lib\timeline\component\css\dataaxis.css:2
.vis-panel.vis-background.vis-horizontal .vis-grid.vis-horizontal {
^

SyntaxError: Unexpected token .

We need to fix the importing of CSS files.

adopt pull-requests fom vis and timeline-plus

Timeline: Error on drag to left with hidden dates

This issue happen on the hiding periods example. These are the steps to reproduce it:

  1. Zoom in until periods of 4 hours are showed,

  2. Position left border to the initial hour of a day (9:00 AM in the example). You must see like the following image:
    image

  3. Drag to left and you will see that 8:00 AM is showed, but the timeline was configured to hide periods from 00:00 AM to 09:00 AM .
    image

"infinite loop in redraw" warning on browser zoom

I'm using the VisJs timeline from the 'almende/vis' repo and come across an issue where if you change the zoom level (80% causes the most problems) then the redraw function gets stuck in a infinite loop. There is a repeated warning in the console 'WARNING: infinite loop in redraw?'.

There is an issue raised in the old repo: Timeline Issue: Sometimes the redraw cycle can become stuck in an infinite loop #450

I've gone through the examples for this repo and i can see is it still occurring. If the old issues are still being tracked then i apologise and feel free to close this one.

Class to easily draw lines to connect items

Following the issue of vis almende/vis#1699, and thanks to the comments of @frboyer and @JimmyCheng, I have created an Arrow Class to easily draw lines to connect items in the vis Timeline module.

CapturaTime

Maybe something like that could be implemented inside the module... however, I quite newbie programmer and I do not know how to implement it. I know that @yotamberk is quite busy nowadays... If someone in the community thinks that could do it, please feel free to use and adapt it.

For the moment, I have managed to create this Arrow Class that can be suitable for many situations.

Congrats for the creation of this community!!

[build] ReferenceError: window is not defined on hammerjs

I cannot run test after npm install completed successfully.

$> npm run test

> [email protected] test /home/vagrant/IdeaProjects/vis-timeline
> mocha --exit --require @babel/register

/home/vagrant/IdeaProjects/vis-timeline/node_modules/hammerjs/hammer.js:2643
})(window, document, 'Hammer');
   ^
ReferenceError: window is not defined
  • npm version : 6.11.2
  • nodejs version: 10.16.2

I can run npm run dist and it build successfully.

Related issue:

exclude moment from bundle by default?

Since #9 it is possible to exclude external libraries (e.g. moment) from the build.
The question is should be exclude e.g. moment by default? This would be a breaking change because than the user would always need to import moment manually.

What do you folks think?

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.