Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Klortho/d3-flextree
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.0.0
Choose a base ref
...
head repository: Klortho/d3-flextree
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 12 commits
  • 14 files changed
  • 3 contributors

Commits on Apr 5, 2018

  1. Copy the full SHA
    552df71 View commit details
  2. fixes #4

    Klortho committed Apr 5, 2018
    Copy the full SHA
    7d74f54 View commit details

Commits on Apr 13, 2018

  1. work

    Klortho committed Apr 13, 2018
    Copy the full SHA
    ee239b8 View commit details
  2. fix the demo

    Klortho committed Apr 13, 2018
    Copy the full SHA
    917923b View commit details

Commits on Apr 14, 2018

  1. working on runkit script

    Klortho committed Apr 14, 2018
    Copy the full SHA
    0104ed8 View commit details

Commits on Apr 16, 2018

  1. working on build scripts

    Klortho committed Apr 16, 2018
    Copy the full SHA
    3055b4a View commit details
  2. add image to readme

    Klortho committed Apr 16, 2018
    Copy the full SHA
    b1fe7cd View commit details

Commits on May 17, 2021

  1. Copy the full SHA
    fe01568 View commit details

Commits on May 21, 2021

  1. Merge pull request #20 from avs-doom/master

    Fix only default export warning for webpack 5
    Klortho authored May 21, 2021
    Copy the full SHA
    50fdf91 View commit details

Commits on Aug 25, 2021

  1. fixed missing semicolons

    eckseller committed Aug 25, 2021
    Copy the full SHA
    2c382e8 View commit details

Commits on Nov 8, 2021

  1. Merge pull request #23 from eckseller/semicolons

    fixed missing semicolons
    Klortho authored Nov 8, 2021
    Copy the full SHA
    7c045eb View commit details
  2. bump version

    Klortho committed Nov 8, 2021
    Copy the full SHA
    af19622 View commit details
Showing with 5,988 additions and 1,057 deletions.
  1. +0 −1 .gitignore
  2. +0 −1 .npmignore
  3. +21 −13 README.md
  4. +5,618 −906 package-lock.json
  5. +5 −8 package.json
  6. +23 −2 rollup.config.js
  7. +1 −0 sample-tree.svg
  8. +3 −2 src/demo/index.html
  9. +126 −103 src/demo/script.js
  10. +15 −10 src/flextree.js
  11. +5 −5 src/test/api-tests.js
  12. +0 −1 src/test/compare.js
  13. +168 −0 src/test/test-trees.js
  14. +3 −5 src/test/tester.js
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -5,4 +5,3 @@
/node_modules/
npm-debug.log
/test/
_package.js
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/papers/
/test/
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# D3 flextree plugin

This plugin provides a more general version of the [D3 tree
layout module](https://github.com/d3/d3-hierarchy#tree). Unlike
`tree`, this plugin allows for nodes
of variable sizes; like the `tree`, the algorithm is fast, running in
*O(n)* time.
[![](https://data.jsdelivr.com/v1/package/npm/d3-flextree/badge)](https://www.jsdelivr.com/package/npm/d3-flextree)

This plugin provides a more general version of the [D3 tree layout
module](https://github.com/d3/d3-hierarchy#tree). Unlike `tree`, this plugin
allows for nodes of variable sizes; like `tree`, the algorithm is fast, running
in *O(n)* time.

![](./sample-tree.svg)

See [the demo](https://klortho.github.io/d3-flextree/).

`flextree()` is a factory function that returns a ***layout*** instance. A
layout is a function that computes the positions of nodes in a
tree diagram. Properties attached to the layout control various aspects
*layout* is a function that computes the positions of nodes in a
tree diagram. Properties attached to the layout control various parameters
of the algorithm.

[Try d3-flextree in your browser](https://npm.runkit.com/d3-flextree).
@@ -20,6 +25,14 @@ Otherwise, download the [latest
release](https://github.com/Klortho/d3-flextree/releases/latest).
AMD, CommonJS, and browser environments are supported.

Alternatively, you can use it straight from the jsdelivr CDN at
[https://cdn.jsdelivr.net/npm/d3-flextree@2.0.0/build/d3-flextree.min.js](https://cdn.jsdelivr.net/npm/d3-flextree@2.0.0/build/d3-flextree.min.js). or [d3-flextree.js](https://cdn.jsdelivr.net/npm/d3-flextree@2.0.0/build/d3-flextree.js)

## Overview

Computing the layout of a tree data structure involves two steps: first,
create a *hierarchy* from the data, and second, invoke the layout function.

In a Node environment:

```javascript
@@ -51,11 +64,6 @@ if necessary):
</script>
```

## Overview

Computing the layout of a tree data structure involves two steps: first,
create a *hierarchy* from the data, and second, invoke the layout function.

When creating the hierarchy, the library uses the `children` accessor
function to determine the children of a data node. When the layout is
computed, two other accessor functions are used: `nodeSize` (to get the
@@ -86,7 +94,7 @@ const data = [
];
const layout = flextree({
children: data => {
const kd = d.slice(2);
const kd = data.slice(2);
return kd.length ? kd : null;
},
nodeSize: node => node.data.slice(0, 2),
Loading