visjs / angular-visjs

AngularJS directive module for vis.js components
http://visjs.github.io/angular-visjs
MIT License
133 stars 64 forks source link

How to set up #43

Open Seiifer opened 8 years ago

Seiifer commented 8 years ago

Is this still maintained ? Is there any more documentation incoming ?

I'm having troubles using it, first what to use in the template because we find several versions depending on where we look at :

Should we use this directive :

<vis-timeline data="r.timeLineData" options="r.timeLineOptions"></vis-timeline>

Or this one :

<vis-graph2d data="r.timeLineData" options="r.timeLineOptions"></vis-graph2d>

This is the data in my controller :

    this.dataItems = new VisDataSet([
      {start: new Date(2010, 4, 2), end: new Date(2010, 4, 8), content: 'Trajectory A'},
      {start: new Date(2010, 4, 10), end: new Date(2010, 4, 14), content: 'Trajectory B'},
      {start: new Date(2010, 4, 16), end: new Date(2010, 4, 25), content: 'Trajectory C'}
    ]);

    this.dataGroups = new VisDataSet([
      {id: 1, content: 'Group 1'}
    ]);

    this.timeLineData = {items: this.dataItems, groups: this.dataGroups};

    this.timeLineOptions = {"start": '2010-04-01', "end": '2010-04-30'};

The options is set properly since I'm initially seeing the proper range (2010 April) but there is no boxes inside the timeline, no date and no content. So how should I use it ?

Also, if I don't intend to use groups, can we directly do this :

<vis-timeline data="r.dataItems" options="r.timeLineOptions"></vis-timeline>
cdjackson commented 8 years ago

Yes, this is maintained, but note that this is just a directive that is a wrapper around the main visjs library, so it is just passing your configuration into visjs.

Should we use this directive :

Or this one :

I guess that depends on what you’re trying to do. One is for timeline, and one is for graph2d!!

Seiifer commented 8 years ago

Well, I want to make a timeline, but shouldn't the above code be working ?

Because I'm only getting an empty timeline and this JS Warning :

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

cdjackson commented 8 years ago

I’m not sure - I don’t currently have time to analyse your code, but have you tried the examples since this is working on github.

Seiifer commented 8 years ago

The example from vis are working fine, but the indexes from angular-visjs don't. I'm just gonna use vis natively I guess

cdjackson commented 8 years ago

Well I just looked at the angular-visas examples on git, and the timeline was working fine!

http://visjs.github.io/angular-visjs/#/timeline http://visjs.github.io/angular-visjs/#/timeline