I am currently utilizing Cytoscape within an Angular 2 project that incorporates Typescript and I am attempting to implement the Cola layout. So, I included the dependency in my project via npm. As I am working with Angular 2 using Typescript, I first added the JavaScript module to the angular-cli.json file followed by the index.html file. Next, in my NetworkComponent - the Angular component responsible for displaying the graph - I imported the library as shown below:
declare var cola:any;
Subsequently, I attempted to utilize the layout in this manner:
this.cyto = cytoscape({
container: document.getElementById("graph"),
elements: this.graph.elements,
style: res.json()
});
this.cyto.layout({name: "cola"});
However, the graph failed to display and the console generated the following error message:
Can not apply layout: No such layout 'cola' found; did you include its JS file?
While I can successfully use the concentric
layout and visualize the graph, similar errors are encountered when attempting to incorporate other layout extensions like cose-bilkent
and springy
.
Is there a method to import the cola library and smoothly integrate it as the preferred graph layout? What potential issues could be causing this problem?