Skip to content

Commit

Permalink
Bump 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikGartner committed Apr 24, 2020
1 parent cb562f1 commit 1a9f03a
Show file tree
Hide file tree
Showing 9 changed files with 11,063 additions and 31 deletions.
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<a name="2.3.0"></a>
# [2.3.0](https://github.com/ErikGartner/dtree/compare/2.2.2...v2.3.0) (2020-04-24)


### Features

* **#20:** add feature to zoom/pan to position/node ([eb1bb87](https://github.com/ErikGartner/dtree/commit/eb1bb87))
* **#20:** add zoomToFit() function ([f57859c](https://github.com/ErikGartner/dtree/commit/f57859c))
* **#65:** add custom click event for marriage nodes ([b4111d6](https://github.com/ErikGartner/dtree/commit/b4111d6))
* **#65:** add custom renderer for marriages ([112a375](https://github.com/ErikGartner/dtree/commit/112a375))


<a name="2.2.2"></a>
## [2.2.2](https://github.com/ErikGartner/dtree/compare/2.2.1...v2.2.2) (2019-07-07)

Expand Down Expand Up @@ -411,6 +423,3 @@
* Update devDeps ([c653f93](https://github.com/ErikGartner/dtree/commit/c653f93))
* Update options and align text ([9346c2d](https://github.com/ErikGartner/dtree/commit/9346c2d))
* Use class in data ([085ed25](https://github.com/ErikGartner/dtree/commit/085ed25))



45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ yarn add d3-dtree

Lastly dTree is also available through several CDNs such as [jsDelivr](https://www.jsdelivr.com/package/npm/d3-dtree):
```
https://cdn.jsdelivr.net/npm/d3-dtree@2.2.2/dist/dTree.min.js
https://cdn.jsdelivr.net/npm/d3-dtree@2.3.0/dist/dTree.min.js
```

## Requirements
Expand All @@ -35,7 +35,7 @@ To use the library the follow dependencies must be loaded:
## Usage
To create a graph from data use the following command:
```javascript
dTree.init(data, options);
tree = dTree.init(data, options);
```

The data object should have the following structure:
Expand Down Expand Up @@ -75,6 +75,10 @@ The following CSS sets some good defaults:
.nodeText{
font: 10px sans-serif;
}
.marriageNode {
background-color: black;
border-radius: 50%;
}
```

The options object has the following default values:
Expand All @@ -84,6 +88,8 @@ The options object has the following default values:
debug: false,
width: 600,
height: 600,
hideMarriageNodes: true,
marriageNodeSize: 10,
callbacks: {
/*
Callbacks should only be overwritten on a need to basis.
Expand All @@ -106,6 +112,14 @@ The options object has the following default values:
}
```

### Zooming
The returned object, `tree = dTree.init(data, options)`, contains functions to control the viewport.

- `tree.resetZoom(duration = 500)` - Reset zoom and position to initial state
- `zoomTo(x, y, zoom = 1, duration = 500)` - Zoom to a specific position
- `zoomToNode(nodeId, zoom = 2, duration = 500)` - Zoom to a specific node
- `zoomToFit(duration = 500)` - Zoom to fit the entire tree into the viewport

### Callbacks
Below follows a short descriptions of the available callback functions that may be passed to dTree. See [dtree.js](https://github.com/ErikGartner/dTree/blob/master/src/dtree.js) for the *default implementations*.

Expand Down Expand Up @@ -151,10 +165,35 @@ function(name, extra, textClass)
```
The textRenderer function returns the formatted text to the nodeRenderer. This way the user may chose to overwrite only what text is shown but may opt to keep the default nodeRenderer.

#### marriageClick
```javascript
function(extra, id)
```
Same as `nodeClick` but for the marriage nodes (connector).

#### marriageRightClick
```javascript
function(extra, id)
```
Same as `nodeRightClick` but for the marriage nodes (connector).

#### marriageRenderer
```javascript
function(x, y, height, width, extra, id, nodeClass)
```
Same as `nodeRenderer` but for the marriage nodes (connector).

#### marriageSize
```javascript
function(nodes, size)
```
Same as `nodeSize` but for the marriage nodes (connector).


## Development
dTree has the following development environment:

- node v11.x
- node v11.x (use Docker [image](https://hub.docker.com/_/node/) `node:11`)
- gulp 3.x
- [Yarn](https://yarnpkg.com/) instead of npm.

Expand Down
137 changes: 117 additions & 20 deletions dist/dTree.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/dTree.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 1a9f03a

Please sign in to comment.