Imoplement a sankey diagram without including the complete Plotly lib


I’m working on an implementation where I need to generate a sankey graph in JS. I looked into adding only the minimum components;


But this results in a empty graph with an X & Y axis for some reason. It’s not the implementation of the rest of the code, if I include the complete Plotly library the graph is drawn correctly.

I looked into but sankey is not listed there and none of the bundles seems to include it…

Am I missing something or is this by design and is there no other way to draw these kinds of plots?



The Sankey module is here → plotly.js/sankey.js at master · plotly/plotly.js · GitHub


var Plotly = require('plotly.js/lib/core')
  • a build step using browserify or webpack should work.
1 Like

Thank you, this worked. I got confused since it’s not in any of the index packages.

1 Like

I ran the parameters you can have given. However I’m still getting a blank screen when using the bundled JS.

browserify your_parameters.js > bundle.js

<script src='bundle.js'></script>

Are there any other modules that need to be included for the Sankey Diagram?

For reference my script needs to process data from a JSON file.

Plotly.d3.json('./data.json', function (fig) {

and runs fine when using

<script src='plotly-latest.min.js'></script>