Sankey Diagram - 单击节点/线后,取消忽略其他节点/链接

时间:2018-02-02 02:52:00

标签: javascript css google-visualization

我尝试点击节点/链接以通过选项保留Sankey Diagram上的突出显示节点/链接:(相关代码在其前面有注释)



google.load('visualization', '1.1', {packages: ['sankey']});      
google.setOnLoadCallback(drawChart);

function drawChart() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'From');
    data.addColumn('string', 'To');
    data.addColumn('number', 'Weight');
    data.addRows([
        [ 'A', 'X', 5 ],
        [ 'A', 'Y', 7 ],
        [ 'A', 'Z', 6 ],
        [ 'B', 'X', 2 ],
        [ 'B', 'Y', 9 ],
        [ 'B', 'Z', 4 ]
    ]);
             
    // Sets chart options.
    var options = {
        width: 600,
        // The specific block of code I am talking about.
        sankey: {
            node: {
              interactivity: true
            },
            link: {
            	interactivity: true
            }
        }
    };

    // Instantiates and draws our chart, passing in some options.
    var chart = new        
    google.visualization.Sankey(document.getElementById('sankey_basic'));
    chart.draw(data, options);
}

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<div id="sankey_basic" style="width: 900px; height: 300px;"></div>
&#13;
&#13;
&#13;

目前,当我点击链接然后点击该节点时,它仍会在链接上保持突出显示。我想在点击节点/链接时删除突出显示其他节点/链接。

0 个答案:

没有答案