Javascript 角度nvd3强制有向图-增加边长度

Javascript 角度nvd3强制有向图-增加边长度,javascript,angularjs,d3.js,nvd3.js,angular-nvd3,Javascript,Angularjs,D3.js,Nvd3.js,Angular Nvd3,我正在使用angular nvd3绘制一个强制有向图 http://krispo.github.io/angular-nvd3/#/forceDirectedGraph 以下是配置: $scope.graphOption = { chart: { type: 'forceDirectedGraph', height: 450,

我正在使用angular nvd3绘制一个强制有向图

http://krispo.github.io/angular-nvd3/#/forceDirectedGraph
以下是配置:

 $scope.graphOption = {
                        chart: {
                            type: 'forceDirectedGraph',
                            height: 450,
                             width: (function(){ return nv.utils.windowSize().width - 350 })(),
                            margin:{top: 20, right: 20, bottom: 20, left: 20},
                            color: function(d){
                                return color(d.group)
                            },
                            charge: -300,
                            tooltip: {
                                  contentGenerator: function (key, x, y, e, graph) {
                                    var ttContent = $scope.getTooltilContent(key);

                                    return '<div class="nvd3-tooltip-wls">'+ttContent+'</div>';
                                  }
                            },
                            nodeExtras: function(node) {
                                node && node
                                  .append("text")

                                  .text(function(d) { return d.name })
                                  .style('font-size', '11px');
                            }
                        }
                };
我在chrome控制台中尝试过这样做,但没有改变任何事情:

var force = d3.layout.force()
    .size([1000, 450])
    .nodes(nodes)
    .links(links);
force.linkDistance(1000);
force.start()

编辑:我还想在一些节点上显示字体超级图标。

您可以使用linkStrength和linkDist属性的值来调整图形的形状。在示例中,减小linkStrength(可能为0.05而不是0.1),并增加linkDist default 30

$scope.graphOption = {
    chart: {
        type: 'forceDirectedGraph',
        // [...]
        charge: -300,
        linkStrength: .05,
        linkDist: 100,
        // [...]
    }
};
单击屏幕右上角的“扩展”按钮时,所有受支持的图表选项都可见

var force = d3.layout.force()
    .size([1000, 450])
    .nodes(nodes)
    .links(links);
force.linkDistance(1000);
force.start()
$scope.graphOption = {
    chart: {
        type: 'forceDirectedGraph',
        // [...]
        charge: -300,
        linkStrength: .05,
        linkDist: 100,
        // [...]
    }
};