vis-timeline icon indicating copy to clipboard operation
vis-timeline copied to clipboard

Angular imports

Open DoNck opened this issue 5 years ago • 2 comments

Hi,

I want to import vis-timeline and copy paste the exemple demo in an empty angular project. I read about the different builds and wanted to try the peer build as I may need other vis components later.

Expected result:

Get a similar result to the exemple demo

Actual result:

The peer build import causes wrong style display whereas it kind of works with the standalone build import, wich I found pretty surprising. Also, even if the standalone build import works better, I don't get the same result as the exemple demo. Items are not displayed along the timeline !

Try it

Comment/uncomment the different build imports to see the difference: https://stackblitz.com/edit/angular-c7cnf2

Am I doing something the wrong way ?

Peer dependencies

I noticed two npm warnings :

npm WARN [email protected] requires a peer of uuid@^3.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of uuid@^7.0.0 but none is installed. You must install peer dependencies yourself.

Is this normal ? I both tried adding ^3.4.0 and ^7.0.0 (independently) with same results. I also tried to install 3.4.0 and 7.0.0 at the same time using uuid3 and uuid7 aliases, but then vis-data and vis-timeline do not know about these aliases and fail on imports.

Best regards

DoNck avatar Apr 22 '20 16:04 DoNck

I finally got all the features working. CSS is applied and items are displayed.

I used vis-timeline 7.0.0, peer build and added the following in my angular.json :

"styles": [
  "src/styles.css",
  "./node_modules/vis-timeline/dist/vis-timeline-graph2d.min.css"
],
"scripts": [
  "node_modules/vis-timeline/dist/vis-timeline-graph2d.min.js"
]

Try it: https://stackblitz.com/edit/angular-x326x6

Still I'm not sure that the previous result was expected and that this solution can be considered as a good practice... (I'm not an angular expert) I'd like to hear about.

Best regards

DoNck avatar Apr 23 '20 14:04 DoNck

@DoNck Does this example help you out ? -> https://stackoverflow.com/a/77308582/2946008

zanella avatar Oct 19 '23 11:10 zanella