Skip to content

Commit 59f5b1c

Browse files
justinsisleybkrem
authored andcommitted
Feature: "straight" as a pathFunc (#30)
* Added straight pathFunc option * Added propType support and test for straight pathFunc * Increased straightPath test coverage * Minor syntax change to remove incorrect default pathFunc
1 parent e489e6c commit 59f5b1c

File tree

5 files changed

+61
-12
lines changed

5 files changed

+61
-12
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ React D3 Tree is a [React](http://facebook.github.io/react/) component that lets
1818

1919

2020
## Demo
21-
- Current release: https://bkrem.github.io/react-d3-tree/
21+
- Current release: https://bkrem.github.io/react-d3-tree/
2222

2323

2424
## Installation
@@ -66,10 +66,10 @@ class MyComponent extends React.Component {
6666
render() {
6767
return (
6868
     {/* <Tree /> will fill width/height of its container; in this case `#treeWrapper` */}
69-
<div id="treeWrapper" style={{width: '50em', height: '20em'}}>
70-
69+
<div id="treeWrapper" style={{width: '50em', height: '20em'}}>
70+
7171
<Tree data={myTreeData} />
72-
72+
7373
</div>
7474
);
7575
}
@@ -84,7 +84,7 @@ class MyComponent extends React.Component {
8484
| `onClick` | `func` | | | `undefined` | Callback function to be called whenever a node is clicked. <br /><br /> The clicked node's data object is passed to the callback function as the first parameter. |
8585
| `orientation` | `string` (enum) | `horizontal` `vertical` | | `horizontal` | `horizontal` - Tree expands left-to-right. <br /><br /> `vertical` - Tree expands top-to-bottom. |
8686
| `translate` | `object` | | | `{x: 0, y: 0}` | Translates the graph along the x/y axis by the specified amount of pixels (avoids the graph being stuck in the top left canvas corner). |
87-
| `pathFunc` | `string` (enum) | `diagonal` `elbow` | | `diagonal` | `diagonal` - Renders smooth, curved edges between parent-child nodes. <br /><br /> `elbow` - Renders sharp edges at right angles between parent-child nodes. |
87+
| `pathFunc` | `string` (enum) | `diagonal` `elbow` `straight` | | `diagonal` | `diagonal` - Renders smooth, curved edges between parent-child nodes. <br /><br /> `elbow` - Renders sharp edges at right angles between parent-child nodes. <br /><br /> `straight` - Renders straight lines between parent-child nodes. |
8888
| `collapsible` | `bool` | | | `true` | Toggles ability to collapse/expand the tree's nodes by clicking them. |
8989
| `initialDepth` | `number` | `0..n` | | `undefined` | Sets the maximum node depth to which the tree is expanded on its initial render. <br /> Tree renders to full depth if prop is omitted. |
9090
| `depthFactor` | `number` | `-n..0..n` | | `undefined` | Ensures the tree takes up a fixed amount of space (`node.y = node.depth * depthFactor`), regardless of tree depth. <br /> **TIP**: Negative values invert the tree's direction. |
@@ -159,10 +159,10 @@ class MyComponent extends React.Component {
159159
render() {
160160
return (
161161
     {/* <Tree /> will fill width/height of its container; in this case `#treeWrapper` */}
162-
<div id="treeWrapper" style={{width: '50em', height: '20em'}}>
163-
162+
<div id="treeWrapper" style={{width: '50em', height: '20em'}}>
163+
164164
<Tree data={this.state.data} />
165-
165+
166166
</div>
167167
);
168168
}

0 commit comments

Comments
 (0)