netsage-project / netsage-sankey-panel

Apache License 2.0
9 stars 5 forks source link

How to line up paths #15

Open mattbue opened 1 year ago

mattbue commented 1 year ago

Hi, I'm trying to use this plugin to visualize an energy distribution beginning from feeding point going to buildings and ending on the floors. Data is coming from mariadb table:

ID Source Destination Energy
1 feeding point building 1 100
2 feeding point building 2 200
3 building 1 b1 floor 1 75
4 building 1 b1 floor 2 25
5 building 2 b2 floor 1 150
6 building 2 b2 floor 2 50

This results the following diagram:

sankey

What needs to be changed so that the 'paths' are lined up?

zinko commented 1 year ago

How to change link color.

KatrinaTurner commented 1 year ago

Hi @mattbue ! You'll want your data arranged so that each row is a full path.... So you'll want an extra column like so: Source -- Building -- Dest -- Energy Feeding Point -- building 1 -- b1 floor 1 -- 75 Feeding Point -- building 1 -- b1 floor 2 -- 25

Hope this makes sense?

KatrinaTurner commented 1 year ago

Also, sorry for the late response. I haven't been getting notifications to my email for these for some reason 😢

KatrinaTurner commented 1 year ago

@zinko There is an option to change link color to a single color and then it should let you select it.

pakerfeldt commented 2 months ago

Hi @mattbue ! You'll want your data arranged so that each row is a full path.... So you'll want an extra column like so: Source -- Building -- Dest -- Energy Feeding Point -- building 1 -- b1 floor 1 -- 75 Feeding Point -- building 1 -- b1 floor 2 -- 25

Hope this makes sense?

Seeing that this library is using d3-sankey underneath, I don't understand why there's this requirement of an additional column?

If you add the author's data to the example page over at d3 you'll get this: image

If you try to solve this with an extra column in this plugin, then you end up having all sources going through that hop before reaching the right side and that is not always the case. This is actually the exact problem I'm facing myself and there seems to be no way around it even to the d3 library supports that use case. I think there is somewhat of a limitation in this plugin 🤔.