Prerequisites
Before you begin, ensure you have:- A modern web browser (Chrome, Firefox, Safari, or Edge)
- An Excel file (
.xlsx) with network relationship data - A local web server to serve the files (options provided below)
Your Excel file should have at least two columns: one for origin nodes and one for destination nodes. Weight and coordinate columns are optional.
Installation
Get the application
Clone the repository or download the source files:The application consists of just 4 files:
index.html- Main layout and UI structureapp.js- Core logic and visualization renderingpresentation.js- Event handlers and UI interactionsstyles.css- Visual styling
All dependencies (D3, vis-network, Leaflet, SheetJS) are loaded from CDN - no installation required!
Start a local server
You need to serve the files via HTTP (not
file://) to avoid CORS issues with CDN libraries.Choose one of these methods:Using VS Code? Install the “Live Server” extension and right-click
index.html → “Open with Live Server”Load Your First Dataset
Click Load Excel
Click the Load Excel button in the sidebar and select your
.xlsx file.If your Excel file has multiple sheets, you’ll be prompted to select one.
Map columns
After loading, use the dropdown menus to map your data columns:
- Origin - The source node column (required)
- Destination - The target node column (required)
- Weight - Optional numeric column for edge weights (auto-counts if not specified)
- Coordinates - Optional lat/lng columns for geographic visualization
Explore visualizations
Once columns are mapped, visualizations generate automatically. Switch between tabs to explore:
- Sankey - Flow diagram showing volume of connections
- Gravitational Network - Force-directed graph layout
- Ego Networks - Compare up to 4 destinations side-by-side
- Geographic Map - Map view with arcs (requires coordinate columns)
Your First Visualization
Let’s walk through a simple example with referral network data:Example Data Structure
Your Excel file should look like this:| Origin Hospital | Destination Hospital | Referrals |
|---|---|---|
| Hospital A | Hospital B | 15 |
| Hospital A | Hospital C | 8 |
| Hospital B | Hospital D | 22 |
| Hospital C | Hospital D | 12 |
Mapping and Viewing
- Load the file - Click Load Excel and select your file
- Map columns:
- Origin → “Origin Hospital”
- Destination → “Destination Hospital”
- Weight → “Referrals”
- View Sankey diagram - See flows between hospitals with edge width proportional to referrals
- Apply filters - Use the origin/destination dropdowns to focus on specific hospitals
- Adjust Top-N - Use the slider to show only the top 50 connections (or any number 5-500)
Visualization Controls
Each visualization has specific controls in the toolbar:Sankey & Network
- Top-N Slider - Limit displayed edges (5-500)
- Origin Filter - Show only edges from selected origins
- Destination Filter - Show only edges to selected destinations
- Zoom Controls - +/- buttons and reset
Ego Networks
- Destination Dropdowns - Select up to 4 destinations to compare
- Each panel shows the 1-hop neighborhood around that destination
Geographic Map
- Origin/Destination Filters - Same as Sankey/Network
- Color By - Group nodes by a data column
- Cost Mode - Toggle to show distance × weight (arc width = spatial cost)
- Interactive Legend - Click legend items to filter by group
Statistics Display
Every visualization shows real-time statistics:Sankey & Network
- Displayed links / Total links
- Displayed weight / Total weight
- Percentage of total shown
Ego Networks
- Neighbors count per destination
- Edges in ego network
- Total referrals
Tips for Best Results
Performance with large datasets
Performance with large datasets
If your Excel file has thousands of edges:
- Use Top-N filters to show only the most important connections
- Apply origin/destination filters to focus on specific nodes
- Start with Sankey or Ego Networks (faster than full Network graph)
Geographic visualization requirements
Geographic visualization requirements
To use the Geographic Map tab:
- Your data must include latitude and longitude columns for both origins and destinations
- Select all 4 coordinate columns in the sidebar: Origin Lat, Origin Lng, Dest Lat, Dest Lng
- Coordinates should be in decimal degrees (e.g., 41.8781, -87.6298)
Understanding auto-weight counting
Understanding auto-weight counting
If you don’t specify a Weight column:
- The app counts occurrences of each (origin, destination) pair
- Example: If “Hospital A → Hospital B” appears 3 times, weight = 3
- Useful for raw transaction logs where each row is one referral/event
Interpreting node colors
Interpreting node colors
- Sankey: Nodes colored by their role (origins vs destinations)
- Network: Uses D3 category10 color scale cycling through nodes
- Ego Networks: Central destination in blue, neighbors in orange
- Map: Circle = origin only, Square = destination only, Diamond = both
Troubleshooting
Map not showing - Check that all 4 coordinate columns are selected and contain valid numeric lat/lng values.
Next Steps
Now that you have the basics working, explore advanced features:Data Format Guide
Learn about Excel file requirements and data structure best practices
Filtering Guide
Master filtering techniques across all visualization types
Deployment Guide
Deploy your own instance to GitHub Pages, Netlify, or other hosting