Coder Social home page Coder Social logo

treecut.js's Introduction

treecut.js

treecut.js automatically adjusts the level of abstraction of treemaps as a function of display size.

The abstraction is determined by a tree cut, which is essentially a boundary between the visible and hidden parts of the tree.

The tree cut selection algorithm is based on the Minimum Description Length principle. To reduce clutter when space is scarce, it sets the cut above subtrees that have more uniform scores. This behaviour has the effect of exposing subtrees that contain nodes with a dramatically disproportionate score (outliers) while collapsing regular subtrees. Conversely, with more space, the algorithm tends to select lower cuts, allowing more nodes to be displayed.

You can read the full technical details in our research paper.

Usage

With d3.hierarchy

Get your tree ready with d3.hierarchy as usual:

var tree =  d3.hierarchy(data);
    .sum(function(d) { return d.children ? d.value : 0; })
    .sort(function(a,b){ return b.value - a.value; });

Then let treecut.js adorn it with its own attributes:

var treecut = vialab.treecut;
treecut.hierarchy()
    .adornD3(tree);

Extract the cut.

var cut = treecut.treemap()
    .findcut(tree, 800*600); // 800*600 is the display area, in pixels

findcut returns an array of nodes that belong to the cut. You can mark the nodes under the cut as invisible before drawing the treemap:

cut.forEach(function(d){
    d.descendants().forEach(function(o,i){
      if (i==0) return;
      o.visible = false;
    });
});

Example

Demos

Load the pages on windows of different size to see how the treemap adapts.

MeSH - Medical Subject Headings

MeSH is a hierarchy of 56,327 categories used to tag PubMed publications. The size of a category encodes the number of papers contained in it. For each category A, a child named (A) represents the number of papers tagged directly with A.

Link: http://vialab.science.uoit.ca/mesh/

You can compare the view above with the unabstracted MeSH treemap.

DMOZ (Directory Mozilla)

DMOZ is a hierarchical web directory of nearly half a million categories.

Link: http://vialab.science.uoit.ca/dmoz/

Slides (VIS 16 Talk)

Link: https://vialab.ca/treecut/slides

Tip: Use keys W, D, S and A to interact with slides 9 and 12. On slide 12 you can also click on nodes to anchor the tree cut.

Citation

R. Veras; C. Collins, "Optimizing Hierarchical Visualizations with the Minimum Description Length Principle," in IEEE Transactions on Visualization and Computer Graphics , vol.23, no.1, pp.631-640.

@Article{Veras2017,
Author = { Rafael Veras and Christopher Collins },
Journal= {IEEE Transactions on Visualization and Computer Graphics },
Title= { Optimizing Hierarchical Visualizations with the Minimum Description Length Principle },
Year= {2017},
Volume = { 23 },
Number = { 1 },
Pages= { 631--640},
Keywords = { Hierarchy data, data aggregation, multiscale visualization, tree cut, antichain },
DOI = { 10.1109/TVCG.2016.2598591 },
ISSN = { 1077-2626 },
Month = jan,
}

treecut.js's People

Contributors

rafaveguim avatar

Stargazers

Arman Didandeh avatar

Watchers

James Cloos avatar Christopher Collins 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.