2

I have an object like this:

edge

...,{\"data\":{\"label\":\"test\",\"source\":\"1\",\"target\":\"19\",\"extra\": 
{\"color\":\"#000000\",\"width\":\"#000000\"}}},{\"data\":
{\"label\":\"1~20\",\"source\":\"1\",\"target\":\"20\",\"extra\":
{\"color\":\"#FF0000\",\"width\":\"5\"}}},...

I am able to parse it, read it and display my nodes and edges into cytoscape.js, but I cannot figure out how to access the extra components to set color and width.

Here:

.selector("edge")
                    .css({
                        "width": "mapData(weight, 0, 100, 1, 4)",
                        "target-arrow-shape": "triangle",
                        "source-arrow-shape": "circle",
                        "line-color": "data.extra(color)"//data(color)
                    })

I know how to acess the color property if it's outside extra, but I would like to use it inside the extra component, as one can see in the JSON example.

Please, how should I access my extra components to set the css color?

Any help is appreciated.

4

1 回答 1

2

如果您从主干构建,我已经推送了一个修复程序以允许data(extra.color)在映射器中使用样式语法。

于 2013-06-07T20:23:22.220 回答