Skip to content

Commit c8b1425

Browse files
committed
Added vertexGap prop
1 parent 0cb9f87 commit c8b1425

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reactjs-graphs",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Create branched graphs in ReactJS",
55
"main": "build/index.js",
66
"scripts": {

source/Graph.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class Graph extends React.Component {
2525
let mainIndex = 1
2626

2727
let totalYAllowed = props.height
28-
let vertexGap = props.orientation === 'horizontal' ? 100 : 70
28+
let vertexGap = props.vertexGap
2929

3030
let horizontalMin = 0, horizontalMax = 0
3131
let verticalMin = props.height/2, verticalMax = props.height/2
@@ -185,9 +185,11 @@ export default class Graph extends React.Component {
185185
Graph.propTypes = {
186186
orientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,
187187
width: PropTypes.number.isRequired,
188-
height: PropTypes.number.isRequired
188+
height: PropTypes.number.isRequired,
189+
vertexGap: PropTypes.number.isRequired
189190
}
190191

191192
Graph.defaultProps = {
192-
orientation: 'horizontal'
193+
orientation: 'horizontal',
194+
vertexGap: 100
193195
}

0 commit comments

Comments
 (0)