javascript - Cytoscape.js - How to display nodes generated in Java -


I want to display the graph using the data generated on the server side of the Java EE application. So my question is how to insert some data structure (JSN object) in the "Elements" section below the code:

  $ (function () {// on dom var var = Cytoscape ({container): Document.getElementById ('cy'), style: cytoscape.stylesheet (.) Selector ('node') .css ({'content': 'data (id)'}. Css {'Target-arrow-shape': 'triangle', 'width': 4, 'line-color': '#ddd', 'target-arrow-color': '#ddd'}). Selector ('.' '# 61bffc', 'transition-property': 'background-color': '# 61bffc', 'line-color': '# 61bffc', 'target-arrow-color': 'background-elements : {Nodes: [{data: {id: 'a'}}, {data: {id: color, line color, target-arrow-r} 'Data': 'd'}}, {data: 'd'}}, {data: id: '' transit duration '' '0.5s' '}' '' '' ''}}, edges: [ : 'A', Target: 'A', Target: 'E'}}, {Data: {ID: 'AB', Weight: 3, Source: 'A', Target: 'B'}} , {Data: {ID: 'BC', Weight: 5, Source: 'B'}}, {Data: 'Ho', Weight: 4, Source: 'B', Target: 'E'}}, {Data Target: 'E'}}, {Data: {ID: 'CD', Weight: 'C'}}, {Data: {ID: 'CE', Weight: 6, Source: 'C', Target: 'E'}}, {Data: Layout: {name: 'c', target: 'd'}}, {Data: 'Breadfest': 2 (name: 'd', weight: 7, source: 'd', target: 'e'}}]}}, ', Directed: F, Roots' # A, padding: 10}});  

The full example can be found that I did not feel like using a scriptlet on the page with graph logic to implement some Java code that would get me the required data. But how to put the results under "element" to get the dynamically generated article (nodes and edges)?

It is a simple error with shutting down the braces:

Layout: {name: 'breadfirst', guided: right, root: '#a', padding: 10}});

To:

Layout: {name: 'breadfirst', guided: true, root: '#a', padding: 10}}); });

i.e., finally }; Add and graph will appear.


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -