2012-08-08 4 views
1

"graphnode6.0 -----> graphnode0.0 -------> graphnode15.0"과 같은 강제 그래프를 표시하려고하지만 json 객체를 구성 할 때 난 항상 내 JSON 객체는 "graphnode6.0 ------> graphnode0.0 < --------- graphnode15.0"를 얻을infoviz의 Force Directed Graph에서 잘못된 에지 방향

var json = [ 
{ 
    "adjacencies": [ 
    { 
     "nodeTo": "graphnode15.0", 
     "data": {"$type":"arrow", 
     "$direction":"['graphnode0.0','graphnode15.0']"} 
    } 
    ], 
    "data": { 
    '$color': "#83548B", 
    '$type': "circle" 
    }, 
    "id": "graphnode0.0", 
    "name": "graphnode0.0" 
}, 
{ 
    "adjacencies": [  
    { 
     "nodeTo": "graphnode0.0", 
     "data": {"$type":"arrow", 
     "$direction":"['graphnode6.0','graphnode0.0']"} 
    }], 
    "data": { 
    "$color": "#83548B", 
    "$type": "circle" 
    }, 
    "id": "graphnode6.0", 
    "name": "graphnode6.0" 
} 

]

이 JSON 구조에 실수가 있습니까? 감사 수밋

답변

0

나는, 내가 모두 우리의 문제 : 당신의 방향 블록 내부

사용 따옴표를 해결하기 위해 관리했습니다 생각하여 빠른 데모에 비슷한 문제가 있지만, 감사했다.

"$direction":["graphnode1", "nodeZ"] 

나는 한 방향으로 만 렌더링 할 따옴표

"$direction":['graphnode1', 'nodeZ'] 

화살표와 함께했을 때. 희망은 당신을 위해 일합니다!

0

$direction 속성에 문자열을 사용하고 있습니다.

"$direction":"['graphnode6.0','graphnode0.0']" 

배열이어야합니다. 이처럼 :

"$direction":["graphnode6.0","graphnode0.0"] 

See this example code.

관련 문제