Mercurial > hg > Members > nobuyasu > html > graphViewer
changeset 12:549962a324ac draft
modified show.html
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Mar 2013 16:11:02 +0900 |
parents | 8c4171f77fcc |
children | 37d68fe602c2 |
files | show.html |
diffstat | 1 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/show.html Wed Mar 20 15:25:09 2013 +0900 +++ b/show.html Wed Mar 20 16:11:02 2013 +0900 @@ -292,7 +292,7 @@ } -function showEdgesAndNodes(graphData,jsonData) { +function showEdgesAndNodes(graphData,jsonData,kind) { var nodes = graphData.nodes; var jsonNodes = jsonData.nodes; for (var i=0; i<jsonNodes.length; i++) { @@ -301,9 +301,10 @@ } var edges = graphData.edges; var jsonEdges = jsonData.edges; - for (var i=0; i<edges.lenght; i++) { - var id = jsonEdges[i].id; - showEdge(graphData, edges[id]); + for (var i=0; i<jsonEdges.length; i++) { + var edge = edges[jsonEdges[i].id]; + edge.property.kind = kind; + showEdge(graphData, edge); } showAllEdge(graphData); } @@ -312,7 +313,7 @@ var u = "/aat/aaevidencesiftingmodel.userdesktops/get?id="+id+"&kind="+kind/*+"?direction="+direction;*/; $.ajax({ url:u, - success:function(o) { parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[id]); showEdgesAndNodes(GRAPH_DATA, o);}, + success:function(o) { parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[id]); showEdgesAndNodes(GRAPH_DATA, o, kind);}, type:"GET", cache:true, error:function(o) { console.log("getEvidence error : ", o); } }); @@ -351,7 +352,6 @@ function updateNodeElement(node) { var created = false; - console.log("node = +",node); if(!node.view) { created = true; createNodeDiv(node); @@ -430,6 +430,7 @@ if (memory.edges[edgeId]) continue; memory.edges[edgeId] = {}; memory.edges[edgeId].property = edge; + memory.edges[edgeId].visible = false; if (edge.kind == "both") { memory.nodes[edge.from].both.push(edgeId); memory.nodes[edge.to].both.push(edgeId); @@ -442,7 +443,7 @@ } function showEdge(graphData, edge) { - function connectEdge(fromNode, toNode, rel, type) { + function connectEdge(fromNode, toNode, kind, type) { var c; if (type == 'both') { c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowBothConnector); @@ -450,16 +451,16 @@ c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector); } // jsPlumb.select({source:fromNode.view[0]}).removeAllOverlays(); - c.setLabel({label:"<span style='color:#129; font-size:1.5em;'>"+rel+"</span>",cssStyle:""}); + c.setLabel({label:"<span style='color:#129; font-size:1.5em;'>"+kind+"</span>",cssStyle:""}); return c; } if (edge.visible) return; var fromNode = graphData.nodes[edge.property.from]; var toNode = graphData.nodes[edge.property.to]; if (!fromNode.view && !toNode.view) return; - var rel = edge.property.rel; + var kind = edge.property.kind; var type = edge.property.type; - connectEdge(fromNode, toNode, rel, type); + connectEdge(fromNode, toNode, kind, type); edge.visible = true; }