A modern, browser-based WYSIWYG editor for creating and editing Sankey diagrams. Built as a single HTML file with no external dependencies (except Google Fonts and Material Icons).
- Visual WYSIWYG editing - Click flows to edit colors and values directly on the diagram
- Drag-and-drop nodes - Reposition nodes vertically by dragging
- Right-click context menu - Add or remove flows from nodes
- Real-time updates - Changes reflect immediately in the diagram
- Individual flow colors - Each flow can have its own color (no forced inheritance)
- Quick color picker - Click any flow to access a color palette
- Editable data table - Modify source, target, value, and color for each flow
- Add/delete flows - From the sidebar or directly on the diagram
- Show/hide node values - Toggle value display next to node names
- Show/hide flow values - Display values on flow paths
- Tooltips - Hover over flows and nodes for detailed information
- Customizable background - Choose from preset colors with optional dot pattern
- JSON import/export - Save and load diagram data
- SVG export - Export high-quality vector graphics with embedded styles
- Persistent state - All settings and positions are preserved in exports
- Resizable sidebar - Drag to adjust panel width
- Tabbed interface - Organized Flows, Nodes, and Settings panels
- Zoom controls - Zoom in/out and reset view
- Responsive design - Works on desktop and tablet
- Open
sankey-editor.htmlin any modern browser - The editor loads with sample data showing an energy flow diagram
- Click flows to edit colors/values, drag nodes to reposition
- Click the + Add Flow button in the Flows tab
- Or click any node to add a flow from that node
- Or right-click a node for more options
- Click a flow in the diagram → popup appears with value and color options
- Edit in table → modify source, target, value directly in the Flows tab
- Delete → click the trash icon in the table or use the popup delete option
- Flows and nodes can be edited via the sidebar tables
- Use Tab to navigate between input fields
sankey-editor.html # Complete application (single file)
README.md # This file
screenshot.png # Screenshot for documentation
- Pure HTML, CSS, and JavaScript (no build step required)
- SVG for diagram rendering
- CSS custom properties for theming
- Google Fonts (Inter) and Material Icons
- Chrome (recommended)
- Firefox
- Safari
- Edge
The JSON export/import format:
{
"flows": [
{ "source": "Node A", "target": "Node B", "value": 100, "color": "#002EFF" }
],
"nodePositions": {
"Node A": { "y": 50 }
},
"settings": {
"nodeWidth": 20,
"nodePadding": 40,
"width": 900,
"height": 500,
"backgroundColor": "#FFFFFF",
"showDotPattern": false,
"showFlowValues": false,
"showNodeValues": true
}
}The editor includes a curated color palette. To customize:
- Find the
sulzerColorsobject in the JavaScript - Modify or add color categories and values
Edit the diagramData object to change the initial diagram shown on load.
CSS custom properties at the top of the file control:
--color-*- Color palette--space-*- Spacing scale--radius-*- Border radii--shadow-*- Box shadows
MIT License - feel free to use, modify, and distribute.
Vincent Verdet
- Uses Inter typeface
- Icons from Material Icons