How to draw A sankey-diagram with a connection A->A

霸气de小男生 提交于 2020-02-06 07:28:05

问题


I need to draw a sankey-diagram in my laravel project. And the data consist of some rows on which from and to nodes are same. An example data is given bellow.

  var data = [
      {from: "A",  to: "A", weight: 12},
      {from: "A",  to: "X",  weight: 10},
      {from: "A",  to: "Y", weight: 15},
      {from: "A",  to: "Z",   weight: 20},
      {from: "B",  to: "X",  weight:  15},
      {from: "B",  to: "Y", weight: 5},
      {from: "B",  to: "Z", weight: 8}        
    ]; 

Tried Google chart, but it didn't work. they also mentioned in the documentation that

Note: Avoid cycles in your data: if A links to itself, or links to B which links to C which links to A, your chart will not render.

So How can I draw a sankey chart withcycles in my data ?(A->A, B->B... )

来源:https://stackoverflow.com/questions/60036602/how-to-draw-a-sankey-diagram-with-a-connection-a-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!