Skip to content

Instantly share code, notes, and snippets.

@parthi2929
Created July 7, 2022 08:01
Show Gist options
  • Save parthi2929/a39ffff9c5442af742958044f4610114 to your computer and use it in GitHub Desktop.
Save parthi2929/a39ffff9c5442af742958044f4610114 to your computer and use it in GitHub Desktop.
Sample data for circular sankey illustration for renbloc linkedin post by Nils Söderström
let data = {
"nodes": [
{
"name": "Grid-2"
},
{
"name": "Grid-1"
},
{
"name": "Solar"
},
{
"name": "Site"
},
{
"name": "Other"
},
{
"name": "Hotel"
},
{
"name": "Kulturhus"
},
{
"name": "Energy Central"
},
{
"name": "BESS charging"
}
],
"links": [
{
"source": "Grid-2",
"target": "Site",
"value": "237",
"optimal": "yes"
},
{
"source": "Grid-1",
"target": "Site",
"value": "202",
"optimal": "yes"
},
{
"source": "Solar",
"target": "Site",
"value": "100",
"optimal": "yes"
},
{
"source": "Site",
"target": "Other",
"value": "304",
"optimal": "yes"
},
{
"source": "Site",
"target": "Hotel",
"value": "184",
"optimal": "yes"
},
{
"source": "Site",
"target": "Kulturhus",
"value": "41",
"optimal": "yes"
},
{
"source": "Site",
"target": "Energy Central",
"value": "7",
"optimal": "yes"
},
{
"source": "Site",
"target": "BESS charging",
"value": "3",
"optimal": "yes"
},
{
"source": "Other",
"target": "Solar",
"value": "50",
"optimal": "yes"
},
{
"source": "Hotel",
"target": "Solar",
"value": "10",
"optimal": "yes"
}
]
};
@parthi2929
Copy link
Author

parthi2929 commented Jul 7, 2022

The related post is here

You could use above data for this sankey example

In index.html of above example, include above js, and remove data in index.js (or use renamed data variable, or whatever)

  <script src="d3-sankey-circular.js"></script>
  <script src="d3-path-arrows.js"></script>
  <script src="renbloc_data.js"></script>
  <script src="index.js"></script>

The result you would be getting should be something like this.. (I used my own tinkered script from above example)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment