覆盖chart.style.node节点中的显示缩放图表中的规则



我使用nodeRules根据节点类型为节点设置特定样式。现在正在寻找一种方法来否决nodeDisplay设置。我想要实现的是,当没有可用的node.image时,它会显示标签。

在我的图表中,我有:

            style:{
                nodeRules:{"rule1":nodeStyle},
                linkRules:{"rule1":linkStyle},
                linkLabel:{textStyle:{font:"12px Arial", fillColor: "black"}, backgroundStyle:{fillColor:"#FFF", lineColor:"black"}},
                makeImagesCircular:true,
                nodeDisplay:"image"
            },

在我的nodeStyle函数中,我想要这样的东西:

            case "organization":
                node.radius = 40;
                node.fillColor = "red";
                node.lineColor = "red";
                node.labelStyle= {textStyle:{font:"14px Arial",fillColor:"black"}};
                $.ajax({
                    url:'/img/'+node.id+'.png',
                    type:'HEAD',
                    error: function()
                    {

                      // here the chart's nodeDisplay settings would be overruled
                      node.display="roundtext";


                    },
                    success: function()
                    {
                        node.image= "/img/"+node.id+".png";
                    }
                });                    
                break;

当前nodeDisplay是一个全局设置,不能按节点自定义。

每个节点的显示类型肯定会在我们开发图表时实现。

最新更新