我正在尝试实现流可视化图,如谷歌流可视化。请为此类实现建议任何 API。任何帮助将不胜感激。
编辑:我使用sankey 图来实现这个要求。下面是我的代码:
$(document).ready(function() {
var dataArray = [["India \n 40","United States \n 25","Canada \n 20","Hong Kong \n 15"],
["page1 \n 50","page2 \n 30","about_us.htm \n 20"],
["page2 \n 50","contactus.htm \n 15"],
["page1 \n 50"]];
var sankey = new Sankey();
for(var i=0; i< dataArray.length; i++)
sankey.stack(i,dataArray[i]);
sankey.setData([["India \n 40",20,"page1 \n 50"],["United States \n 25",10,"page1 \n 50"],["Canada \n 20",10,"page1 \n 50"],["Hong Kong \n 15",10,"page1 \n 50"],["India \n 40",10,"page2 \n 30"],["United States \n 25",10,"page2 \n 30"],["Canada \n 20",5,"page2 \n 30"],["Hong Kong \n 15",5,"page2 \n 30"],["India \n 40",10,"about_us.htm \n 20"],["United States \n 25",5,"about_us.htm \n 20"],["Canada \n 20",5,"about_us.htm \n 20"],
["page1 \n 50",35,"page2 \n 50"],["page2 \n 30",15,"page2 \n 50"],["page1 \n 50",10,"contactus.htm \n 15"],["page2 \n 30",5,"contactus.htm \n 15"],
["page2 \n 50",40,"page1 \n 50"]
]);
sankey.setBubbles([["page1 \n 50", 5],["page2 \n 30",10],["about_us.htm \n 20",20],["contactus.htm \n 15",15],["page2 \n 50",10]]);
sankey.bubbleColor = "#F37126";
sankey.bubbleLabelColor = "#FFF";
sankey.draw();
});
在上面的示例中,我在第一次和第三次交互中有“ page1 \n 50 ” 。为此,它将在第三次交互中仅创建一个节点。如何克服这个问题。请帮帮我。
提前致谢