forked from codesinghanoop/react-native-d3-tree-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeployNodes.js
30 lines (28 loc) · 1.26 KB
/
DeployNodes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React, { Component } from 'react';
import _ from 'lodash'
import { tx, ty, kx, ky } from './CoordinatePoints'
import Svg,{ G, Text, Rect } from 'react-native-svg'
export function DeployNodes(nodes)
{
const rectNodes = _.map(nodes,function (n,index) {
let text
if(n.name)
{
text = <Text
fontSize={10}
x={tx(n)} y={ty(n)} >{ n.name }</Text>
return (<G key={'tree_' + index}>
<Rect
x={kx(n)}
y={ky(n)}
width="40"
height="20"
stroke="red"
fill="white"
/>
{text}
</G>)
}
})
return rectNodes
}