Skip to content

Commit d7ce894

Browse files
committed
Merge branch 'master' into develop
2 parents 07c705e + 2e9eb1d commit d7ce894

File tree

4 files changed

+55
-39
lines changed

4 files changed

+55
-39
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# React D3 Tree
22
[![Build Status](https://travis-ci.org/bkrem/react-d3-tree.svg?branch=master)](https://travis-ci.org/bkrem/react-d3-tree)
33
[![Coverage Status](https://coveralls.io/repos/github/bkrem/react-d3-tree/badge.svg?branch=master)](https://coveralls.io/github/bkrem/react-d3-tree?branch=master)
4+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f9ed4796ee9c448dbcd80af2954cc0d1)](https://www.codacy.com/app/ben.kremer/react-d3-tree?utm_source=github.com&utm_medium=referral&utm_content=bkrem/react-d3-tree&utm_campaign=Badge_Grade)
45
[![npm version](https://badge.fury.io/js/react-d3-tree.svg)](https://badge.fury.io/js/react-d3-tree)
56

67
React D3 Tree is a [React](http://facebook.github.io/react/) component that lets you represent hierarchical data (e.g. ancestor trees, organisational structure, package dependencies) as an animated & interactive tree graph by leveraging [D3](https://d3js.org/)'s `tree` layout.
@@ -16,7 +17,7 @@ React D3 Tree is a [React](http://facebook.github.io/react/) component that lets
1617

1718

1819
## Demo
19-
- Current release (stable): https://bkrem.github.io/react-d3-tree/
20+
- Current release: https://bkrem.github.io/react-d3-tree/
2021

2122

2223
## Installation
@@ -33,6 +34,7 @@ yarn add react-d3-tree
3334

3435
## Usage
3536
```jsx
37+
import React from 'react';
3638
import Tree from 'react-d3-tree';
3739

3840
const myTreeData = [
@@ -59,7 +61,7 @@ const myTreeData = [
5961
},
6062
];
6163

62-
class MyComponent extends Component {
64+
class MyComponent extends React.Component {
6365
render() {
6466
return (
6567
     {/* <Tree /> will fill width/height of its container; in this case `#treeWrapper` */}
@@ -127,6 +129,7 @@ Statically hosted JSON or CSV files can be used as data sources via the addition
127129
### Example
128130

129131
```jsx
132+
import React from 'react';
130133
import { Tree, treeUtil } from 'react-d3-tree';
131134

132135
const csvSource = 'https://raw.githubusercontent.com/bkrem/react-d3-tree/master/docs/examples/data/csv-example.csv';
@@ -147,7 +150,7 @@ componentWillMount() {
147150
.catch((err) => console.error(err));
148151
}
149152

150-
class MyComponent extends Component {
153+
class MyComponent extends React.Component {
151154
render() {
152155
return (
153156
     {/* <Tree /> will fill width/height of its container; in this case `#treeWrapper` */}

docs/components/Link.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,13 @@ type: `enum('horizontal'|'vertical')`
2020

2121
type: `enum('diagonal'|'elbow')`
2222

23+
24+
### `styles` (required)
25+
26+
type: `object`
27+
28+
29+
### `transitionDuration` (required)
30+
31+
type: `number`
32+

docs/components/Node.md

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,29 @@
66
Props
77
-----
88

9-
### `circleRadius`
10-
11-
type: `number`
12-
defaultValue: `10`
13-
14-
15-
### `circleStyle`
9+
### `attributes`
1610

1711
type: `object`
18-
defaultValue: `{
19-
stroke: '#000',
20-
strokeWidth: 2,
21-
fill: 'grey',
22-
}`
12+
defaultValue: `undefined`
2313

2414

25-
### `depthFactor`
15+
### `circleRadius`
2616

2717
type: `number`
18+
defaultValue: `10`
2819

2920

30-
### `leafCircleStyle`
21+
### `name` (required)
3122

32-
type: `object`
33-
defaultValue: `{
34-
stroke: '#000',
35-
strokeWidth: 2,
36-
fill: 'transparent',
37-
}`
23+
type: `string`
3824

3925

4026
### `nodeData` (required)
4127

4228
type: `object`
4329

4430

45-
### `onClick`
31+
### `onClick` (required)
4632

4733
type: `func`
4834

@@ -52,27 +38,18 @@ type: `func`
5238
type: `enum('horizontal'|'vertical')`
5339

5440

55-
### `primaryLabel`
56-
57-
type: `string`
58-
59-
60-
### `primaryLabelStyle`
61-
62-
type: `object`
63-
64-
65-
### `secondaryLabels`
41+
### `styles` (required)
6642

6743
type: `object`
6844

6945

70-
### `secondaryLabelsStyle`
46+
### `textAnchor`
7147

72-
type: `object`
48+
type: `string`
49+
defaultValue: `'start'`
7350

7451

75-
### `textAnchor`
52+
### `transitionDuration` (required)
7653

77-
type: `string`
54+
type: `number`
7855

docs/components/Tree.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,32 @@ type: `shape[object Object]`
4747
defaultValue: `{ min: 0.1, max: 1 }`
4848

4949

50+
### `styles`
51+
52+
type: `shape[object Object]`
53+
defaultValue: `{
54+
nodes: {
55+
node: {
56+
circle: {},
57+
name: {},
58+
attributes: {},
59+
},
60+
leafNode: {
61+
circle: {},
62+
name: {},
63+
attributes: {},
64+
},
65+
},
66+
links: {},
67+
}`
68+
69+
70+
### `transitionDuration`
71+
72+
type: `number`
73+
defaultValue: `500`
74+
75+
5076
### `translate`
5177

5278
type: `shape[object Object]`

0 commit comments

Comments
 (0)