1

我正在使用 InfoVis JIT sunburst 可视化并相应地修改节点和父节点颜色:

onBeforePlotNode: function(node)
    {

       if(node.data.risk == '1') 
        {
            var parents = node.getParents()[0];
            var gparents = parents.getParents()[0];
            node.data.$color = '#fc9802';
            parents.data.$color = '#fc9802';
            gparents.data.$color = '#fc9802';                  
        }

我遇到的问题是,在我将光标移到可视化的任何部分之前,颜色设置是不可见的。

  • 有趣的是,第一个颜色分配有效,node.data.$color = '#fc9802'; (在需要移动光标之前):

有没有办法在渲染之前刷新(或设置颜色的更好方法)?

4

1 回答 1

0

解决方案是使用延迟

setTimeout(function(){ ...somecode... ,1);

似乎以毫秒为单位的延迟无关紧要 - 我使用 1 并且它仍然有效。

于 2016-12-14T06:03:02.947 回答