2012-08-08 65 views
1

我试图显示像“graphnode6.0 -----> graphnode0.0 -------> graphnode15.0”但是当我构造json对象我总是得到 “graphnode6.0 ------> graphnode0.0 < --------- graphnode15.0” 我的JSON对象是在infoviz的力导向图中不正确的边缘方向

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.