https://github.com/pskopnik/alluvial
https://github.com/pskopnik/alluvial
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pskopnik/alluvial
- Owner: pskopnik
- Created: 2017-08-08T10:42:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-22T13:33:35.000Z (almost 8 years ago)
- Last Synced: 2025-01-05T13:42:09.507Z (5 months ago)
- Language: HTML
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Alluvial Diagram Generator
## Setup
Install [yarn](https://yarnpkg.com) and execute the following in the project's
root directory to download all dependencies:yarn
[npm](https://www.npmjs.com/) may also be used, but doesn't respect yarn's
lock file. Download dependencies using `npm install`.## Usage
The project directory must be hosted using a web server.
For example: The node [http-server](https://www.npmjs.com/package/http-server)
yarn global add http-server
# or
npm install -g http-serverhttp-server
`http-server` will serve the current directory listening on port
8080 by default (change by using the `-p ` flag).Python also ships with a http server, the following serves the working
directory listening on port 8000:python -m SimpleHTTPServer 8000
The repository exposes two end points: `static.html` and `draggable.html`.
Both draw an alluvial diagram of the data provided in `data.json`.
Simply replace the file and reload the page to display changed data.
In some cases `data.json` is cached by the browser, in such cases a hard
reload (and cache emptying) may be necessary.`draggable.html` displays the same diagram as `static.html`, but a bit more
interactive.## Expected JSON Format
`data.json` is expected to have this format:
{
"nodes": [
{
"spec": "p_1_1",
"value": 13
},
{
"spec": "c_2_1"
},
{
"spec": "p_2_1",
"value": 45
},
...
],
"links": [
{
"source": "p_1_1",
"target": "c_2_1",
"value": 12
},
{
"source": "c_2_1",
"target": "p_2_1",
"value": 12
},
...
]
}Also see the `data.json` file in this repository for reference.