nowthis / sankeymatic

Make Beautiful Flow Diagrams
http://sankeymatic.com/build/
ISC License
841 stars 122 forks source link

Improved standalone library support #66

Open AlanFoster opened 11 months ago

AlanFoster commented 11 months ago

Hi there; Thanks for Sankeymatic!

Is it possible to use Sankeymatic as a standalone library? i.e. providing a slightly different API to support dependency injecting some of the required values for creating sankey charts:

var definition = `
// Enter Flows between Nodes, like this:
//         Source [AMOUNT] Target

Wages [1500] Budget
Other [250] Budget

Budget [450] Taxes
Budget [420] Housing
Budget [400] Food
Budget [295] Transportation
Budget [25] Savings

// You can set a Node's color, like this:
:Budget #708090
//            ...or a color for a single Flow:
Budget [160] Other Necessities #0F0

// Use the controls below to customize
// your diagram's appearance...
`;

var options = {
  definition: definition,
  target: document.querySelector('#target'),
  reversed: false,
  // etc
};
renderSankey(options);