Giter Club home page Giter Club logo

hierarchy-viewer's Introduction

Hierarchy Viewer

Generates a hierarchy with GraphViz for any parent-child relationship hidden in a CSV tabular data file, with column names as header row. Also generates a HTML file with an animated D3 collapsible tree, for the parent-child relationship.

(1) Simplified Graphs

Run the following from the command line, to show the simple employee-manager dependency hierarchy, with employee ID as default object identifiers. Remark that the "from" column must be the unique identifier for each row. These are all the requiered command line arguments:

python viewer.py --f data/employees --from employee_id --to manager_id

employee-manager-hierarchy

IDs are unique, but not very friendly. If you have a column that can be used to easily identify an object, you can mention it. Here we have the same hierarchy, but we indetify the employees by their names:

python viewer.py --f data/employees --from employee_id --to manager_id --d employee_name

hierarchy-with-employee-names

The --rev switch will change the direction of each arrow from parent to child (by default it is from child to parent). Here is the manager-employee hierarchy:

python viewer.py --f data/employees --from employee_id --to manager_id --d employee_name --rev

manager-employee-hierarchy

Each run will also create and show a HTML file with a D3 SVG graph as an animated collapsible tree, always for the same parent-child hierarchy (collapsed node appear with dark circles):

parent-child-hierarchy

(2) Graphs with Groups

Same as before, except we added the department ID to group all employees from each department in a surrounding "box":

python viewer.py --f data/employees --from employee_id --to manager_id --d employee_name --g department_id

group-by-department

In a similar manner we may group employees by job title:

python viewer.py --f data/employees --from employee_id --to manager_id --d employee_name --g job_id

group-by-job-title

(3) Bubble Charts

Instead of grouping, we may also pass a "value" column, like SALARY, in which case each shape becomes a "bubble" resized based on these values, with the actual value as tooltip:

python viewer.py --f data/employees --from employee_id --to manager_id --d employee_name --v salary

bubble-chart

(4) Detailed Graphs

The --all flag will "expand" all other properties (except the display name) from the CSV file for each object. If you get an error that the URL is too long for the browser, copy and paste the generated DOT file content into the online GraphViz editor (but be aware that this may generate indeed a lot of data!).

python viewer.py --f data/employees --from employee_id --to manager_id --d employee_name --all

Here is a partial view of the generated graph:

show-details

The data/employees.csv test data file has been adapted from here:

employees-data

hierarchy-viewer's People

Contributors

cristiscu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.