Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bioviz-js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Remi PLANEL
bioviz-js
Commits
8e8c3089
Commit
8e8c3089
authored
Jun 15, 2019
by
Remi PLANEL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename nodes
parent
25e08212
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
18 deletions
+38
-18
src/examples/phylotree/main.ts
src/examples/phylotree/main.ts
+38
-18
No files found.
src/examples/phylotree/main.ts
View file @
8e8c3089
import
PhylogramLayout
from
"
../../scripts/layout/phylogram
"
;
import
{
RawPhyloTreeNode
}
from
"
../../scripts/types
"
;
import
CladogramLayout
from
"
../../scripts/layout/cladogram
"
;
import
{
RawPhyloTreeNode
,
PhyloTreeNode
}
from
"
../../scripts/types
"
;
import
{
select
}
from
"
d3-selection
"
;
import
Phylotree
from
"
../../scripts/component/tree/phylotree
"
;
import
{
cluster
,
hierarchy
,
HierarchyNode
}
from
"
d3-hierarchy
"
;
import
{
defaultSeparation
}
from
"
../../scripts/layout/phylotree
"
;
const
phylotreeComponent
=
Phylotree
();
const
data
:
RawPhyloTreeNode
=
{
"
name
"
:
"
Eve
"
,
"
name
"
:
"
Root
"
,
branchLength
:
0
,
nodes
:
{
r
:
10
},
"
children
"
:
[
{
"
name
"
:
"
Cain
"
,
branchLength
:
0.
8
,
"
name
"
:
"
Level-1-0
"
,
branchLength
:
0.
9
,
nodes
:
{
fill
:
"
blue
"
}
},
{
"
name
"
:
"
Seth
"
,
branchLength
:
0.
6
,
"
name
"
:
"
Level-1-1
"
,
branchLength
:
0.
3
,
nodes
:
{
r
:
8
,
fill
:
"
red
"
},
"
children
"
:
[
{
"
name
"
:
"
Enos
"
,
branchLength
:
0.3
"
name
"
:
"
Level-2-0
"
,
branchLength
:
1.2
},
{
"
name
"
:
"
Noam
"
,
branchLength
:
0.1
"
name
"
:
"
Level-2-1
"
,
branchLength
:
1.8
,
nodes
:
{
fill
:
"
darkgreen
"
,
r
:
5
}
}
]
}
]
};
const
width
=
900
;
const
height
=
400
;
const
size
:
[
number
,
number
]
=
[
height
-
10
,
width
-
60
];
const
phylotreeLayout
=
PhylogramLayout
()
// .nodeSize([50, 200]);
.
size
(
size
);
const
phylotreeData
=
phylotreeLayout
(
data
);
const
marginLeft
=
(
data
.
nodes
&&
data
.
nodes
.
r
)
?
data
.
nodes
.
r
:
4
;
const
width
=
1000
;
const
height
=
200
;
const
size
:
[
number
,
number
]
=
[
height
,
width
-
marginLeft
];
const
isPhylogram
=
true
;
const
phylotreeData
=
(
isPhylogram
)
?
PhylogramLayout
()
// .nodeSize([40, width - marginLeft])
.
size
(
size
)(
data
)
:
cluster
()
.
separation
(
defaultSeparation
)
.
size
(
size
)(
hierarchy
(
data
))
select
(
"
svg
"
)
.
attr
(
"
width
"
,
width
)
.
attr
(
"
height
"
,
height
)
.
append
(
"
g
"
)
.
attr
(
"
transform
"
,
'
translate(10,0)
'
)
.
attr
(
"
transform
"
,
`translate(
${
marginLeft
}
,0)`
)
.
datum
([
phylotreeData
])
.
call
(
phylotreeComponent
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment