Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
memiescape
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Lobbé
memiescape
Commits
8a2b7eda
Commit
8a2b7eda
authored
Sep 11, 2020
by
qlobbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the colors by dynamics
parent
6ff78c43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
392 additions
and
99 deletions
+392
-99
index.html
index.html
+26
-10
qlobbe.css
lib/css/qlobbe.css
+86
-12
ressources.js
ressources.js
+280
-77
No files found.
index.html
View file @
8a2b7eda
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
<button
id=
"draw"
class=
"button draw"
>
<button
id=
"draw"
class=
"button draw"
>
draw
draw
</button>
</button>
<!-- <span id="focus" class="phylo-focus">▸ focus</span> -->
</div>
</div>
<!-- row 2 & 3 -->
<!-- row 2 & 3 -->
...
@@ -49,12 +50,17 @@
...
@@ -49,12 +50,17 @@
<div
class=
"phylo-isoline"
id=
"phyloIsoLine"
></div>
<div
class=
"phylo-isoline"
id=
"phyloIsoLine"
></div>
<div
class=
"phylo-isoline-info"
id=
"phyloIsolineInfo"
>
<div
class=
"phylo-isoline-info"
id=
"phyloIsolineInfo"
>
<button
id=
"reset"
class=
"button reset"
>
<div
class=
"btn-group"
>
<i
class=
"fas fa-expand-arrows-alt"
></i>
<button
id=
"reset"
class=
"button reset"
>
</button>
<i
class=
"fas fa-expand-arrows-alt"
></i>
<button
id=
"label"
class=
"button label"
>
</button>
<i
class=
"fas fa-align-center"
></i>
<button
id=
"label"
class=
"button label"
>
</button>
<i
class=
"fas fa-dot-circle"
></i>
</button>
<button
id=
"heading"
class=
"button heading"
>
<i
class=
"fas fa-sort-alpha-down"
></i>
</button>
</div>
</div>
</div>
<!-- row 4 -->
<!-- row 4 -->
...
@@ -86,6 +92,7 @@
...
@@ -86,6 +92,7 @@
try
{
try
{
document
.
querySelector
(
"#reset"
).
style
.
visibility
=
"visible"
document
.
querySelector
(
"#reset"
).
style
.
visibility
=
"visible"
document
.
querySelector
(
"#label"
).
style
.
visibility
=
"visible"
document
.
querySelector
(
"#label"
).
style
.
visibility
=
"visible"
document
.
querySelector
(
"#heading"
).
style
.
visibility
=
"visible"
json
=
JSON
.
parse
(
e
.
target
.
result
);
json
=
JSON
.
parse
(
e
.
target
.
result
);
draw
(
json
)
draw
(
json
)
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -125,6 +132,14 @@
...
@@ -125,6 +132,14 @@
// draw PhyloInfo
// draw PhyloInfo
window
.
freq
=
{};
var
jsonFreq
=
(
json
.
phyloTermsFreq
).
slice
(
2
,
-
2
).
split
(
"),("
);
jsonFreq
.
forEach
(
function
(
elem
){
let
arr
=
elem
.
split
(
','
)
window
.
freq
[
arr
[
0
]]
=
parseFloat
(
arr
[
1
])
})
window
.
nbDocs
=
parseFloat
(
json
.
phyloDocs
);
window
.
nbDocs
=
parseFloat
(
json
.
phyloDocs
);
window
.
nbBranches
=
parseFloat
(
json
.
phyloBranches
);
window
.
nbBranches
=
parseFloat
(
json
.
phyloBranches
);
window
.
nbGroups
=
parseFloat
(
json
.
phyloGroups
);
window
.
nbGroups
=
parseFloat
(
json
.
phyloGroups
);
...
@@ -165,7 +180,8 @@
...
@@ -165,7 +180,8 @@
gId
:
parseInt
(
g
.
_gvid
)
,
gId
:
parseInt
(
g
.
_gvid
)
,
size
:
parseInt
(
g
.
support
),
size
:
parseInt
(
g
.
support
),
label
:
(
g
.
label
.
slice
(
1
,
g
.
label
.
length
-
1
)).
split
(
'|'
),
label
:
(
g
.
label
.
slice
(
1
,
g
.
label
.
length
-
1
)).
split
(
'|'
),
foundation
:
(
g
.
foundation
.
slice
(
1
,
g
.
foundation
.
length
-
1
)).
split
(
'|'
)
}
foundation
:
(
g
.
foundation
.
slice
(
1
,
g
.
foundation
.
length
-
1
)).
split
(
'|'
),
role
:
((
g
.
role
.
slice
(
1
,
g
.
role
.
length
-
1
)).
split
(
'|'
)).
map
(
e
=>
parseInt
(
e
.
trim
()))}
});
});
var
links
=
json
.
edges
.
filter
(
edges
=>
edges
.
edgeType
==
"link"
).
map
(
function
(
l
){
var
links
=
json
.
edges
.
filter
(
edges
=>
edges
.
edgeType
==
"link"
).
map
(
function
(
l
){
...
@@ -239,9 +255,9 @@
...
@@ -239,9 +255,9 @@
class
phyloPhyloInfo
extends
React
.
Component
{
class
phyloPhyloInfo
extends
React
.
Component
{
render
()
{
render
()
{
return
<
div
className
=
"phylo-phylo-info"
id
=
"phyloPhyloInfo"
>
return
<
div
className
=
"phylo-phylo-info"
id
=
"phyloPhyloInfo"
>
<
span
><
b
>
{
this
.
props
.
nbTerms
}
<
/b> terms</
span
>
<
span
><
b
id
=
"phyloTerms"
>
{
this
.
props
.
nbTerms
}
<
/b> terms</
span
>
<
span
><
b
>
{
this
.
props
.
nbGroups
}
<
/b> groups</
span
>
<
span
><
b
id
=
"phyloGroups"
>
{
this
.
props
.
nbGroups
}
<
/b> groups</
span
>
<
span
><
b
>
{
this
.
props
.
nbBranches
}
<
/b> branches</
span
>
<
span
><
b
id
=
"phyloBranches"
>
{
this
.
props
.
nbBranches
}
<
/b> branches</
span
>
<
/div>
<
/div>
}
}
}
}
...
...
lib/css/qlobbe.css
View file @
8a2b7eda
...
@@ -42,7 +42,7 @@ body {
...
@@ -42,7 +42,7 @@ body {
.phylo-folder
{
.phylo-folder
{
grid-row
:
1
;
grid-row
:
1
;
grid-column
:
2
/
1
6
;
grid-column
:
2
/
1
0
;
}
}
/* -------------------- */
/* -------------------- */
...
@@ -102,8 +102,8 @@ body {
...
@@ -102,8 +102,8 @@ body {
.phylo-isoline-info
{
.phylo-isoline-info
{
grid-row
:
2
/
4
;
grid-row
:
2
/
4
;
grid-column
:
15
/
16
;
grid-column
:
15
/
16
;
padding-top
:
5
0%
;
padding-top
:
3
0%
;
padding-bottom
:
5
0%
;
padding-bottom
:
3
0%
;
}
}
/* -------------------- */
/* -------------------- */
...
@@ -203,6 +203,10 @@ i.how:hover span {
...
@@ -203,6 +203,10 @@ i.how:hover span {
font-size
:
12px
;
font-size
:
12px
;
}
}
.header
{
font-weight
:
bold
;
}
/* ---------- input ---------- */
/* ---------- input ---------- */
.button
{
.button
{
...
@@ -216,10 +220,22 @@ i.how:hover span {
...
@@ -216,10 +220,22 @@ i.how:hover span {
color
:
white
;
color
:
white
;
}
}
.btn-group
button
{
margin-top
:
1px
;
margin-bottom
:
1px
;
display
:
block
;
width
:
40px
;
}
.draw
{
.draw
{
display
:
none
;
display
:
none
;
}
}
.phylo-focus
{
fill
:
#f8381f
;
color
:
#f8381f
;
}
.reset
{
.reset
{
visibility
:
hidden
;
visibility
:
hidden
;
}
}
...
@@ -228,6 +244,15 @@ i.how:hover span {
...
@@ -228,6 +244,15 @@ i.how:hover span {
visibility
:
hidden
;
visibility
:
hidden
;
}
}
.heading
{
visibility
:
hidden
;
}
.headed
{
background-color
:
#0d1824
;
color
:
white
;
}
.labeled
{
.labeled
{
background-color
:
#0d1824
;
background-color
:
#0d1824
;
color
:
white
;
color
:
white
;
...
@@ -273,6 +298,14 @@ i.how:hover span {
...
@@ -273,6 +298,14 @@ i.how:hover span {
stroke
:
#fff
;
stroke
:
#fff
;
}
}
.x-mark-over
{
fill
:
#f3be54
;
}
.x-mark-focus
{
fill
:
#f8381f
;
}
.tick
text
{
.tick
text
{
font-family
:
"Inter-Regular"
;
font-family
:
"Inter-Regular"
;
}
}
...
@@ -320,28 +353,29 @@ i.how:hover span {
...
@@ -320,28 +353,29 @@ i.how:hover span {
/* ---------- group ---------- */
/* ---------- group ---------- */
.group-outer
{
.group-outer
{
stroke-width
:
1
px
;
stroke-width
:
0.8
px
;
stroke
:
#fff
;
stroke
:
#fff
;
fill
:
#fff
;
fill
:
#fff
;
}
}
.group-inner
{
.group-inner
{
stroke-width
:
1
px
;
stroke-width
:
0.8
px
;
stroke
:
#0d1824
;
stroke
:
#0d1824
;
fill
:
#0d1824
;
fill
:
#0d1824
;
/*cursor: pointer;*/
/*cursor: pointer;*/
z-index
:
10
;
z-index
:
10
;
}
}
.group-inner-focus
{
.group-heading
{
stroke
:
#f8381f
;
fill
:
#fff
;
stroke
:
#A9A9A9
;
}
}
.group-
inner-un
focus
{
.group-focus
{
stroke
:
#
A9A9A9
;
stroke
:
#
f8381f
;
}
}
.group-
path-
focus
{
.group-
un
focus
{
stroke
:
#A9A9A9
;
stroke
:
#A9A9A9
;
}
}
...
@@ -357,13 +391,46 @@ i.how:hover span {
...
@@ -357,13 +391,46 @@ i.how:hover span {
.term
:hover
{
.term
:hover
{
font-weight
:
bold
;
font-weight
:
bold
;
fill
:
#f8381f
;
}
.term-unfocus
{
/*fill: #A9A9A9;*/
}
.term-focus
{
/*fill: black;*/
}
}
.term-path
{
.term-path
{
fill
:
none
;
fill
:
none
;
stroke
:
#
f8381f
;
stroke
:
#
F0684D
;
stroke-width
:
1.5px
;
stroke-width
:
1.5px
;
z-index
:
1
;
}
.emerging
{
/*text-decoration: underline #F0684D;*/
/*fill:#5AA350;*/
fill
:
#5AA350
;
}
.decreasing
{
/*text-decoration: underline #74B5FF;*/
fill
:
#11638F
;
}
.path-focus
{
fill
:
none
;
stroke
:
#F0684D
;
stroke-width
:
1.5px
;
}
.path-unfocus
{
stroke
:
#A9A9A9
;
}
.path-heading
{
stroke
:
#A9A9A9
;
}
}
/* ---------- phylo ---------- */
/* ---------- phylo ---------- */
...
@@ -406,6 +473,13 @@ i.how:hover span {
...
@@ -406,6 +473,13 @@ i.how:hover span {
z-index
:
100
;
z-index
:
100
;
}
}
.peak-focus
{
font-size
:
18px
;
stroke-width
:
2px
;
stroke
:
#F0684D
;
}
.peak-label
{
.peak-label
{
text-align
:
center
;
text-align
:
center
;
font-family
:
"Inter-Regular"
;
font-family
:
"Inter-Regular"
;
...
...
ressources.js
View file @
8a2b7eda
...
@@ -82,6 +82,8 @@ function xOverFlow(ticks,arr) {
...
@@ -82,6 +82,8 @@ function xOverFlow(ticks,arr) {
})
})
}
}
var
branchFocus
=
[];
function
addMarkX
(
ticks
,
ws
,
ids
)
{
function
addMarkX
(
ticks
,
ws
,
ids
)
{
ticks
.
each
(
function
(
t
,
i
){
ticks
.
each
(
function
(
t
,
i
){
d3
.
select
(
this
)
d3
.
select
(
this
)
...
@@ -91,7 +93,11 @@ function addMarkX(ticks,ws,ids) {
...
@@ -91,7 +93,11 @@ function addMarkX(ticks,ws,ids) {
.
attr
(
"height"
,
"8"
)
.
attr
(
"height"
,
"8"
)
.
attr
(
"width"
,
ws
[
i
]
+
1
)
.
attr
(
"width"
,
ws
[
i
]
+
1
)
.
attr
(
"class"
,
"x-mark"
)
.
attr
(
"class"
,
"x-mark"
)
.
attr
(
"id"
,
"xmark-"
+
ids
[
i
])
.
attr
(
"id"
,
"xmark-"
+
ids
[
i
])
if
(
branchFocus
.
includes
(
""
+
ids
[
i
]))
{
d3
.
select
(
"#xmark-"
+
ids
[
i
]).
style
(
"fill"
,
"#F0684D"
);
}
})
})
}
}
...
@@ -121,8 +127,8 @@ function addMarkY(ticks) {
...
@@ -121,8 +127,8 @@ function addMarkY(ticks) {
function
setYDomain
(
labels
)
{
function
setYDomain
(
labels
)
{
var
inf
=
labels
[
0
].
from
,
var
inf
=
labels
[
0
].
from
,
sup
=
labels
[
labels
.
length
-
1
].
from
;
sup
=
labels
[
labels
.
length
-
1
].
from
;
//
inf = new Date((inf.getFullYear() - 1),6,0);
inf
=
new
Date
((
inf
.
getFullYear
()
-
1
),
6
,
0
);
inf
=
new
Date
((
198
0
-
1
),
6
,
0
);
// inf = new Date((196
0 - 1),6,0);
sup
=
new
Date
((
sup
.
getFullYear
()
+
1
),
0
,
0
);
sup
=
new
Date
((
sup
.
getFullYear
()
+
1
),
0
,
0
);
return
[
inf
,
sup
];
return
[
inf
,
sup
];
}
}
...
@@ -133,10 +139,10 @@ function groupTermsBy(elements, attr) {
...
@@ -133,10 +139,10 @@ function groupTermsBy(elements, attr) {
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
let
from
=
elements
[
i
].
getAttribute
(
attr
)
let
from
=
elements
[
i
].
getAttribute
(
attr
)
if
(
curr
!=
from
)
{
if
(
curr
!=
from
)
{
grouped
[
from
]
=
[[(
elements
[
i
]).
getAttribute
(
"gx"
),(
elements
[
i
]).
getAttribute
(
"gy"
)]];
grouped
[
from
]
=
[[(
elements
[
i
]).
getAttribute
(
"gx"
),(
elements
[
i
]).
getAttribute
(
"gy"
)
,(
elements
[
i
]).
getAttribute
(
"bid"
)
]];
curr
=
from
curr
=
from
}
else
{
}
else
{
grouped
[
from
].
push
([(
elements
[
i
]).
getAttribute
(
"gx"
),(
elements
[
i
]).
getAttribute
(
"gy"
)]);
grouped
[
from
].
push
([(
elements
[
i
]).
getAttribute
(
"gx"
),(
elements
[
i
]).
getAttribute
(
"gy"
)
,(
elements
[
i
]).
getAttribute
(
"bid"
)
]);
}
}
}
}
return
Object
.
values
(
grouped
);
return
Object
.
values
(
grouped
);
...
@@ -215,8 +221,8 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -215,8 +221,8 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
.
attr
(
"visibility"
,
"visible"
)
.
attr
(
"visibility"
,
"visible"
)
.
text
(
"▲"
)
.
text
(
"▲"
)
.
on
(
"mouseover"
,
peakOver
)
.
on
(
"mouseover"
,
peakOver
)
.
on
(
"mouseout"
,
peakOut
)
;
.
on
(
"mouseout"
,
peakOut
)
.
on
(
"click"
,
peakClick
);
/* *** draw the phylo *** */
/* *** draw the phylo *** */
...
@@ -296,9 +302,9 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -296,9 +302,9 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
}
}
var
linkGen
=
d3
.
linkVertical
();
var
linkGen
=
d3
.
linkVertical
();
var
groupLinks
=
links
.
map
(
l
=>
({
source
:
findGroup
(
l
.
from
,
xScale
,
yScale
),
target
:
findGroup
(
l
.
to
,
xScale
,
yScale
)}));
var
groupLinks
=
links
.
map
(
l
=>
({
source
:
findGroup
(
l
.
from
,
xScale
,
yScale
),
target
:
findGroup
(
l
.
to
,
xScale
,
yScale
)
,
from
:
l
.
from
,
to
:
l
.
to
}));
var
groupAncestors
=
aLinks
.
map
(
l
=>
({
source
:
findGroup
(
l
.
from
,
xScale
,
yScale
),
target
:
findGroup
(
l
.
to
,
xScale
,
yScale
)}));
var
groupAncestors
=
aLinks
.
map
(
l
=>
({
source
:
findGroup
(
l
.
from
,
xScale
,
yScale
),
target
:
findGroup
(
l
.
to
,
xScale
,
yScale
)
,
from
:
l
.
from
,
to
:
l
.
to
}));
panel
panel
.
selectAll
(
"path"
)
.
selectAll
(
"path"
)
...
@@ -307,13 +313,15 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -307,13 +313,15 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
.
attr
(
"d"
,
linkGen
)
.
attr
(
"d"
,
linkGen
)
.
attr
(
"fill"
,
"none"
)
.
attr
(
"fill"
,
"none"
)
.
attr
(
"stroke"
,
"#0d1824"
)
.
attr
(
"stroke"
,
"#0d1824"
)
.
attr
(
"class"
,
"group-path"
)
.
attr
(
"class"
,
"group-path"
)
.
attr
(
"source"
,
d
=>
d
.
from
)
.
attr
(
"target"
,
d
=>
d
.
to
)
// https://observablehq.com/@mbostock/fit-text-to-circle
// https://observablehq.com/@mbostock/fit-text-to-circle
/* fake group content */
/* fake group content */
var
colors
=
[
"#
f8381f
"
,
"#aa8c58"
,
"#74b5ff"
,
"#0d1824"
];
var
colors
=
[
"#
F0684D
"
,
"#aa8c58"
,
"#74b5ff"
,
"#0d1824"
];
/* groups */
/* groups */
...
@@ -364,6 +372,7 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -364,6 +372,7 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
panel
.
selectAll
(
".y-highlight"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
panel
.
selectAll
(
".y-highlight"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
panel
.
selectAll
(
".ngrams"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
panel
.
selectAll
(
".ngrams"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
panel
.
selectAll
(
".term-path"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
panel
.
selectAll
(
".term-path"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
panel
.
selectAll
(
".emergence"
).
attr
(
"transform"
,
d3
.
event
.
transform
);
showPeak
()
showPeak
()
}
}
...
@@ -375,6 +384,9 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -375,6 +384,9 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
d3
.
select
(
"#label"
).
on
(
"click"
,
showLabel
);
d3
.
select
(
"#label"
).
on
(
"click"
,
showLabel
);
function
showLabel
()
{
function
showLabel
()
{
if
((
document
.
getElementsByClassName
(
"header"
))[
0
].
style
.
visibility
!=
"hidden"
)
{
showHeading
()
}
doubleClick
()
doubleClick
()
let
ngrams
=
document
.
getElementsByClassName
(
"ngrams"
)
let
ngrams
=
document
.
getElementsByClassName
(
"ngrams"
)
let
groups
=
document
.
getElementsByClassName
(
"group-inner"
)
let
groups
=
document
.
getElementsByClassName
(
"group-inner"
)
...
@@ -397,6 +409,94 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -397,6 +409,94 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
}
}
}
}
/* role & dynamic */
d3
.
select
(
"#heading"
).
on
(
"click"
,
showHeading
);
var
emergences
=
{};
groups
.
forEach
(
function
(
g
){
// is emerging ?
if
((
g
.
role
).
includes
(
0
))
{
for
(
var
i
=
0
;
i
<
(
g
.
role
).
length
;
i
++
)
{
if
((
g
.
role
)[
i
]
==
0
)
{
var
gf
=
parseInt
(((
g
.
foundation
)[
i
]).
trim
())
if
(
gf
in
emergences
)
{
(
emergences
[
gf
].
x
).
push
(
xScale
(
g
.
x
));
(
emergences
[
gf
].
y
).
push
(
yScale
(
g
.
from
));
}
else
{
emergences
[
gf
]
=
{
"label"
:
g
.
label
[
i
],
"x"
:[
xScale
(
g
.
x
)],
"y"
:[
yScale
(
g
.
from
)]}
}
}
}
}
});
var
keys
=
Object
.
keys
(
emergences
);
var
fontDomain
=
[
Math
.
min
(...(
Object
.
values
(
window
.
freq
))),
Math
.
max
(...(
Object
.
values
(
window
.
freq
)))];
const
arraySum
=
(
acc
,
curr
)
=>
acc
+
curr
;
function
rdm
()
{
if
(
Math
.
random
()
>
0.5
)
{
return
1
;
}
else
{
return
-
1
;
}
}
var
fontScale
=
d3
.
scaleLinear
().
domain
([
0
,
Math
.
max
(...(
Object
.
values
(
window
.
freq
)))]).
range
([
2
,
10
]);
var
opacityScale
=
d3
.
scaleLinear
().
domain
([
0
,
Math
.
max
(...(
Object
.
values
(
window
.
freq
)))]).
range
([
0.3
,
1
]);
keys
.
forEach
(
function
(
k
){
let
x
=
((
emergences
[
k
]).
x
).
reduce
(
arraySum
)
/
((
emergences
[
k
]).
x
).
length
let
y
=
((
emergences
[
k
]).
y
).
reduce
(
arraySum
)
/
((
emergences
[
k
]).
y
).
length
var
freq
=
0
;
if
(
k
in
window
.
freq
)
{
freq
=
window
.
freq
[
k
];
}
panel
.
append
(
"text"
)
.
attr
(
"x"
,
x
+
(
rdm
()
*
Math
.
random
()
*
10
))
.
attr
(
"y"
,
y
+
(
rdm
()
*
Math
.
random
()
*
10
))
.
attr
(
"fdt"
,
k
)
.
style
(
"font-size"
,
fontScale
(
freq
)
+
"px"
)
.
style
(
"opacity"
,
opacityScale
(
freq
))
.
attr
(
"class"
,
"header"
)
.
style
(
"visibility"
,
"hidden"
)
.
style
(
"text-anchor"
,
"middle"
)
.
text
((
emergences
[
k
]).
label
);
});
function
showHeading
()
{
if
((
document
.
getElementsByClassName
(
"ngrams"
))[
0
].
style
.
visibility
!=
"hidden"
)
{
showLabel
()
}
doubleClick
()
let
headers
=
document
.
getElementsByClassName
(
"header"
)
let
groups
=
document
.
getElementsByClassName
(
"group-inner"
)
if
(
headers
[
0
].
style
.
visibility
==
"hidden"
)
{
document
.
getElementById
(
"heading"
).
classList
.
add
(
"headed"
)
for
(
var
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
groups
[
i
].
style
.
fill
=
"#f5eee6"
;
groups
[
i
].
classList
.
add
(
"group-heading"
)
}
d3
.
selectAll
(
".group-path"
).
classed
(
"path-heading"
,
true
);
for
(
var
i
=
0
;
i
<
headers
.
length
;
i
++
){
headers
[
i
].
style
.
visibility
=
"visible"
;
}
}
else
{
document
.
getElementById
(
"heading"
).
classList
.
remove
(
"headed"
)
for
(
var
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
groups
[
i
].
style
.
fill
=
"#61a3a9"
;
groups
[
i
].
classList
.
remove
(
"group-heading"
)
}
d3
.
selectAll
(
".group-path"
).
classed
(
"path-heading"
,
false
);
for
(
var
i
=
0
;
i
<
headers
.
length
;
i
++
){
headers
[
i
].
style
.
visibility
=
"hidden"
;
}
}
}
/* groups */
/* groups */
function
textWidth
(
text
)
{
function
textWidth
(
text
)
{
...
@@ -404,22 +504,24 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -404,22 +504,24 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
return
context
.
measureText
(
text
).
width
;
return
context
.
measureText
(
text
).
width
;
}
}
function
toLines
(
words
,
fdt
,
targetWidth
)
{
function
toLines
(
words
,
fdt
,
role
,
targetWidth
)
{
let
line
;
let
line
;
let
lineWidth0
=
Infinity
;
let
lineWidth0
=
Infinity
;
const
lines
=
[];
const
lines
=
[];
for
(
let
i
=
0
,
n
=
words
.
length
;
i
<
n
;
++
i
)
{
for
(
let
i
=
0
,
n
=
words
.
length
;
i
<
n
;
++
i
)
{
let
lineText1
=
(
line
?
line
.
text
+
" "
:
""
)
+
words
[
i
];
let
lineText1
=
(
line
?
line
.
text
+
" "
:
""
)
+
words
[
i
];
let
lineFdt1
=
(
line
?
line
.
fdt
+
" "
:
""
)
+
fdt
[
i
];
let
lineFdt1
=
(
line
?
line
.
fdt
+
" "
:
""
)
+
fdt
[
i
];
let
lineRole1
=
(
line
?
line
.
role
+
" "
:
""
)
+
role
[
i
];
let
lineWidth1
=
textWidth
(
lineText1
);
let
lineWidth1
=
textWidth
(
lineText1
);
if
((
lineWidth0
+
lineWidth1
)
/
2
<
targetWidth
+
10
)
{
if
((
lineWidth0
+
lineWidth1
)
/
2
<
targetWidth
+
10
)
{
line
.
width
=
lineWidth0
=
lineWidth1
;
line
.
width
=
lineWidth0
=
lineWidth1
;
// line.text = lineText1;
// line.text = lineText1;
line
.
text
.
push
(
words
[
i
])
line
.
text
.
push
(
words
[
i
])
line
.
fdt
.
push
(
fdt
[
i
])
line
.
fdt
.
push
(
fdt
[
i
])
line
.
role
.
push
(
role
[
i
])
}
else
{
}
else
{
lineWidth0
=
textWidth
(
words
[
i
]);
lineWidth0
=
textWidth
(
words
[
i
]);
line
=
{
width
:
lineWidth0
,
text
:
[
words
[
i
]],
fdt
:
[
fdt
[
i
]]};
line
=
{
width
:
lineWidth0
,
text
:
[
words
[
i
]],
fdt
:
[
fdt
[
i
]]
,
role
:
[
role
[
i
]]
};
lines
.
push
(
line
);
lines
.
push
(
line
);
}
}
}
}
...
@@ -466,7 +568,7 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -466,7 +568,7 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
var
lineHeight
=
12
,
var
lineHeight
=
12
,
targetWidth
=
Math
.
sqrt
(
textWidth
(
g
.
label
.
join
(
''
).
trim
())
*
radius
),
targetWidth
=
Math
.
sqrt
(
textWidth
(
g
.
label
.
join
(
''
).
trim
())
*
radius
),
lines
=
toLines
(
g
.
label
,
g
.
foundation
,
targetWidth
),
lines
=
toLines
(
g
.
label
,
g
.
foundation
,
g
.
role
,
targetWidth
),
textRadius
=
toTextRadius
(
lines
,
lineHeight
)
textRadius
=
toTextRadius
(
lines
,
lineHeight
)
textRatio
=
(
radius
-
0.5
)
/
textRadius
;
textRatio
=
(
radius
-
0.5
)
/
textRadius
;
...
@@ -474,12 +576,14 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -474,12 +576,14 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
let
words
=
lines
[
i
].
text
,
let
words
=
lines
[
i
].
text
,
fdt
=
lines
[
i
].
fdt
,
fdt
=
lines
[
i
].
fdt
,
terms
=
mergeLists
(
words
,
fdt
)
roles
=
lines
[
i
].
role
,
terms
=
mergeLists
(
words
,
fdt
,
roles
)
toSpan
=
(
acc
,
w
)
=>
acc
+
"<tspan fdt="
+
w
[
1
]
toSpan
=
(
acc
,
w
)
=>
acc
+
"<tspan fdt="
+
w
[
1
]
+
" class='term fdt-"
+
(
w
[
1
]).
trim
()
+
"'"
+
" class='term fdt-"
+
(
w
[
1
]).
trim
()
+
"
"
+
"g-"
+
g
.
gId
+
findRole
(
w
[
2
])
+
"
'"
+
" gy="
+
yScale
(
g
.
from
)
+
" gy="
+
yScale
(
g
.
from
)
+
" gx="
+
xScale
(
g
.
x
)
+
" gx="
+
xScale
(
g
.
x
)
+
" gid="
+
g
.
gId
+
" gid="
+
g
.
gId
+
" bid="
+
g
.
bId
+
" from="
+
(
g
.
from
).
getFullYear
()
+
" from="
+
(
g
.
from
).
getFullYear
()
+
">"
+
w
[
0
]
+
"</tspan>"
;
+
">"
+
w
[
0
]
+
"</tspan>"
;
...
@@ -489,22 +593,43 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -489,22 +593,43 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
.
attr
(
"text-anchor"
,
"middle"
)
.
attr
(
"text-anchor"
,
"middle"
)
.
style
(
"font-size"
,
12
*
textRatio
+
"px"
)
.
style
(
"font-size"
,
12
*
textRatio
+
"px"
)
.
style
(
"visibility"
,
"hidden"
)
.
style
(
"visibility"
,
"hidden"
)
.
append
(
"tspan"
)
.
append
(
"tspan"
)
.
attr
(
"x"
,
xScale
(
g
.
x
))
.
attr
(
"x"
,
xScale
(
g
.
x
))
.
attr
(
"y"
,
yScale
(
g
.
from
)
+
(
i
-
lines
.
length
/
2.8
)
*
(
lineHeight
*
textRatio
))
.
attr
(
"y"
,
yScale
(
g
.
from
)
+
(
i
-
lines
.
length
/
2.8
)
*
(
lineHeight
*
textRatio
))
.
html
(
terms
.
reduce
(
toSpan
,
""
));
.
html
(
terms
.
reduce
(
toSpan
,
""
));
d3
.
selectAll
(
".term"
).
on
(
"click"
,
termClick
);
d3
.
selectAll
(
".term"
)
.
on
(
"click"
,
termClick
)
// .on("mouseover",function(){
// d3.selectAll(".term").classed("term-unfocus",true);
// d3.selectAll(".term").filter(".g-" + this.getAttribute("gid")).classed("term-focus",true);
// })
// .on("mouseout",function(){
// d3.selectAll(".term").classed("term-unfocus",false);
// d3.selectAll(".term").classed("term-focus",false);
// });
}
}
}
}
d3
.
selectAll
(
".header"
).
raise
();
function
mergeLists
(
l1
,
l2
)
{
function
findRole
(
r
)
{
if
(
r
==
0
)
{
return
" emerging"
;
}
else
if
(
r
==
2
)
{
return
" decreasing"
;
}
else
{
return
""
;
}
}
function
mergeLists
(
l1
,
l2
,
l3
)
{
let
merged
=
[];
let
merged
=
[];
for
(
let
i
=
0
;
i
<
l1
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
l1
.
length
;
i
++
)
{
merged
.
push
([
l1
[
i
],
l2
[
i
]])
merged
.
push
([
l1
[
i
],
l2
[
i
]
,
l3
[
i
]
])
}
}
return
merged
;
return
merged
;
}
}
...
@@ -543,7 +668,7 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -543,7 +668,7 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
}
}
function
showPeak
()
{
function
showPeak
()
{
d3
.
selectAll
(
".peak"
).
style
(
"
visibility
"
,
function
(
peak
,
i
){
d3
.
selectAll
(
".peak"
).
style
(
"
fill
"
,
function
(
peak
,
i
){
var
isVisible
=
d3
var
isVisible
=
d3
.
selectAll
(
".branch-"
+
i
)
.
selectAll
(
".branch-"
+
i
)
.
nodes
()
.
nodes
()
...
@@ -558,74 +683,118 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -558,74 +683,118 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
.
reduce
((
mem
,
cur
)
=>
{
return
mem
||
cur
;})
.
reduce
((
mem
,
cur
)
=>
{
return
mem
||
cur
;})
if
(
isVisible
)
{
if
(
isVisible
)
{
d3
.
select
(
"#peak-shadow"
+
i
).
attr
(
"visibility"
,
"visible"
);
d3
.
select
(
"#peak-shadow"
+
i
).
attr
(
"visibility"
,
"visible"
);
return
"
visible
"
;
return
"
#0d1824
"
;
}
else
{
}
else
{
d3
.
select
(
"#peak-shadow"
+
i
).
attr
(
"visibility"
,
"hidden"
);
d3
.
select
(
"#peak-shadow"
+
i
).
attr
(
"visibility"
,
"hidden"
);
return
"
hidden
"
;
return
"
#A9A9A9
"
;
}
}
})
})
}
}
function
termClick
()
{
function
countTerms
(
groups
)
{
var
terms
=
[];
// remove old focus
d3
.
selectAll
(
".term-path"
).
remove
();
var
groups
=
document
.
getElementsByClassName
(
'group-inner'
);
for
(
var
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
groups
[
i
].
classList
.
remove
(
"group-inner-focus"
);
let
gid
=
((
groups
[
i
].
node
().
getAttribute
(
"id"
)).
split
(
"group"
))[
1
]
groups
[
i
].
classList
.
add
(
"group-inner-unfocus"
);
d3
.
selectAll
(
".g-"
+
gid
).
nodes
().
forEach
(
e
=>
terms
.
push
(
e
.
getAttribute
(
"fdt"
)))
}
}
var
paths
=
document
.
getElementsByClassName
(
'group-path'
);
return
(
Array
.
from
(
new
Set
(
terms
))).
length
;
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
}
paths
[
i
].
classList
.
add
(
"group-path-focus"
);
function
countBranches
(
groups
)
{
var
branches
=
[];
for
(
var
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
branches
.
push
(
groups
[
i
].
node
().
getAttribute
(
"bId"
));
}
}
return
(
Array
.
from
(
new
Set
(
branches
))).
length
;
}
function
termClick
()
{
// remove old focus
initPath
()
// catch the last transformations
// catch the last transformations
var
transform
=
d3
.
select
(
"#group"
+
this
.
getAttribute
(
"gid"
)).
node
().
getAttribute
(
"transform"
);
var
transform
=
d3
.
select
(
"#group"
+
this
.
getAttribute
(
"gid"
)).
node
().
getAttribute
(
"transform"
);
// focus
document
.
querySelector
(
"#phyloPhylo"
).
innerHTML
=
this
.
textContent
;
document
.
querySelector
(
"#phyloPhylo"
).
classList
.
add
(
"phylo-focus"
);
// find the relevant links
var
idx
=
this
.
getAttribute
(
"fdt"
),
var
idx
=
this
.
getAttribute
(
"fdt"
),
terms
=
document
.
getElementsByClassName
(
"fdt-"
+
idx
),
terms
=
document
.
getElementsByClassName
(
"fdt-"
+
idx
),
paths
=
document
.
getElementsByClassName
(
"group-path"
),
periods
=
groupTermsBy
(
terms
,
"from"
);
periods
=
groupTermsBy
(
terms
,
"from"
);
var
gids
=
[],
groups
=
[];
for
(
var
i
=
0
;
i
<
terms
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
terms
.
length
;
i
++
)
{
let
gid
=
(
terms
[
i
]).
getAttribute
(
"gid"
);
gids
.
push
((
terms
[
i
]).
getAttribute
(
"gid"
));
d3
.
select
(
"#group"
+
gid
).
node
().
classList
.
remove
(
"group-inner-unfocus"
)
let
group
=
d3
.
select
(
"#group"
+
(
terms
[
i
]).
getAttribute
(
"gid"
))
d3
.
select
(
"#group"
+
gid
).
node
().
classList
.
add
(
"group-inner-focus"
)
group
.
classed
(
"group-unfocus"
,
false
)
.
classed
(
"group-focus"
,
true
);
groups
.
push
(
group
)
//highlight the branches peak
d3
.
select
(
"#peak-"
+
(
terms
[
i
]).
getAttribute
(
"bid"
)).
classed
(
"peak-focus"
,
true
);
branchFocus
.
push
((
terms
[
i
]).
getAttribute
(
"bid"
));
d3
.
select
(
"#xmark-"
+
(
terms
[
i
]).
getAttribute
(
"bid"
)).
style
(
"fill"
,
"#F0684D"
);
}
// facet
document
.
querySelector
(
"#phyloGroups"
).
innerHTML
=
groups
.
length
;
document
.
querySelector
(
"#phyloTerms"
).
innerHTML
=
countTerms
(
groups
);
document
.
querySelector
(
"#phyloBranches"
).
innerHTML
=
countBranches
(
groups
);
document
.
querySelector
(
"#phyloGroups"
).
classList
.
add
(
"phylo-focus"
);
document
.
querySelector
(
"#phyloTerms"
).
classList
.
add
(
"phylo-focus"
);
document
.
querySelector
(
"#phyloBranches"
).
classList
.
add
(
"phylo-focus"
);
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
if
(
gids
.
includes
((
paths
[
i
]).
getAttribute
(
"source"
))
&&
(
paths
[
i
]).
getAttribute
(
"target"
))
{
paths
[
i
].
classList
.
add
(
"path-focus"
);
paths
[
i
].
classList
.
remove
(
"path-unfocus"
);
}
}
}
var
bids
=
[];
for
(
var
i
=
0
;
i
<
periods
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
periods
.
length
;
i
++
)
{
if
(
i
!=
periods
.
length
-
1
)
{
if
(
i
!=
periods
.
length
-
1
)
{
for
(
var
j
=
0
;
j
<
periods
[
i
].
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
periods
[
i
].
length
;
j
++
)
{
bids
.
push
(
periods
[
i
][
j
][
2
])
var
x1
=
periods
[
i
][
j
][
0
],
var
x1
=
periods
[
i
][
j
][
0
],
y1
=
periods
[
i
][
j
][
1
];
y1
=
periods
[
i
][
j
][
1
];
for
(
var
k
=
0
;
k
<
periods
[
i
+
1
].
length
;
k
++
)
{
for
(
var
k
=
0
;
k
<
periods
[
i
+
1
].
length
;
k
++
)
{
var
x2
=
periods
[
i
+
1
][
k
][
0
],
var
x2
=
periods
[
i
+
1
][
k
][
0
],
y2
=
periods
[
i
+
1
][
k
][
1
];
y2
=
periods
[
i
+
1
][
k
][
1
];
if
((
periods
[
i
][
j
][
2
]
!=
periods
[
i
+
1
][
k
][
2
])
&&
(
!
bids
.
includes
(
periods
[
i
+
1
][
k
][
2
])))
{
// draw the paths
// draw the links between branches
panel
panel
.
append
(
"path"
)
.
append
(
"path"
)
.
attr
(
"class"
,
"term-path"
)
.
attr
(
"class"
,
"term-path"
)
.
attr
(
"d"
,
function
(
d
)
{
.
attr
(
"d"
,
function
(
d
)
{
return
"M"
+
x1
+
","
+
y1
return
"M"
+
x1
+
","
+
y1
+
"C"
+
x2
+
","
+
y1
+
"C"
+
x2
+
","
+
y1
+
" "
+
x2
+
","
+
y2
+
" "
+
x2
+
","
+
y2
+
" "
+
x2
+
","
+
y2
;
+
" "
+
x2
+
","
+
y2
;
})
})
.
attr
(
"transform"
,
transform
)
.
attr
(
"transform"
,
transform
)
.
style
(
"stroke-opacity"
,
0.6
)
.
style
(
"stroke-opacity"
,
0.4
)
.
lower
();
.
lower
();
}
bids
.
push
(
periods
[
i
+
1
][
k
][
2
])
}
}
}
}
}
}
}
}
d3
.
selectAll
(
".
group-path
"
).
lower
();
d3
.
selectAll
(
".
path-unfocus
"
).
lower
();
}
}
function
peakOver
(
b
,
i
)
{
function
peakOver
(
b
,
i
)
{
d3
.
select
(
"#peak-"
+
i
).
node
().
setAttribute
(
"class"
,
"peak peak-over"
);
d3
.
select
(
"#peak-"
+
i
).
classed
(
"peak-focus"
,
false
);
d3
.
select
(
"#peak-"
+
i
).
classed
(
"peak-over"
,
true
);
label
.
text
(
b
.
label
.
replace
(
/"/g
,
''
))
label
.
text
(
b
.
label
.
replace
(
/"/g
,
''
))
.
style
(
"visibility"
,
"visible"
)
.
style
(
"visibility"
,
"visible"
)
.
style
(
"top"
,
(
yScale0
(
b
.
y
)
+
div0
.
top
-
18
)
+
"px"
)
.
style
(
"top"
,
(
yScale0
(
b
.
y
)
+
div0
.
top
-
18
)
+
"px"
)
...
@@ -634,10 +803,20 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -634,10 +803,20 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
}
}
function
peakOut
(
b
,
i
)
{
function
peakOut
(
b
,
i
)
{
d3
.
select
(
"#peak-"
+
i
).
node
().
setAttribute
(
"class"
,
"peak"
);
d3
.
select
(
"#peak-"
+
i
).
classed
(
"peak-over"
,
false
);
if
(
branchFocus
.
includes
(
""
+
b
.
bId
))
{
d3
.
select
(
"#peak-"
+
i
).
classed
(
"peak-focus"
,
true
);
}
branchOut
();
branchOut
();
}
}
function
peakClick
(
b
,
i
)
{
let
tx
=
((
d3
.
selectAll
(
".group-inner"
).
filter
(
".branch-"
+
b
.
bId
).
nodes
())[
0
]).
getAttribute
(
"cx"
)
svg
.
transition
()
.
duration
(
750
)
.
call
(
zoom
.
transform
,
d3
.
zoomIdentity
.
translate
(((
wo
+
xo
)
/
2
)
-
tx
,
0
).
scale
(
1
));
}
function
branchOver
(
bId
)
{
function
branchOver
(
bId
)
{
d3
.
select
(
"#xmark-"
+
bId
).
style
(
"fill"
,
"#f3be54"
);
d3
.
select
(
"#xmark-"
+
bId
).
style
(
"fill"
,
"#f3be54"
);
d3
.
select
(
"#hover-"
+
bId
).
style
(
"visibility"
,
"visible"
);
d3
.
select
(
"#hover-"
+
bId
).
style
(
"visibility"
,
"visible"
);
...
@@ -647,6 +826,9 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -647,6 +826,9 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
d3
.
selectAll
(
".peak-label"
).
style
(
"visibility"
,
"hidden"
);
d3
.
selectAll
(
".peak-label"
).
style
(
"visibility"
,
"hidden"
);
d3
.
selectAll
(
".branch-hover"
).
style
(
"visibility"
,
"hidden"
);
d3
.
selectAll
(
".branch-hover"
).
style
(
"visibility"
,
"hidden"
);
d3
.
selectAll
(
".x-mark"
).
style
(
"fill"
,
"#4A5C70"
);
d3
.
selectAll
(
".x-mark"
).
style
(
"fill"
,
"#4A5C70"
);
for
(
var
i
=
0
;
i
<
branchFocus
.
length
;
i
++
)
{
d3
.
select
(
"#xmark-"
+
branchFocus
[
i
]).
style
(
"fill"
,
"#F24C3D"
);
}
}
}
function
tickOver
()
{
function
tickOver
()
{
...
@@ -665,33 +847,54 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
...
@@ -665,33 +847,54 @@ function drawPhylo(branches, periods, groups, links, aLinks, bLinks, frame) {
peakOut
(
branch
,
ego
)
peakOut
(
branch
,
ego
)
}
}
function
groupOver
()
{
// function groupOver() {
var
from
=
this
.
getAttribute
(
"from"
);
// var from = this.getAttribute("from");
d3
.
select
(
"#y-highlight-"
+
from
).
style
(
"visibility"
,
"visible"
);
// d3.select("#y-highlight-" + from).style("visibility","visible");
// d3.select("#y-mark-year-inner-" + from).node().setAttribute("class","y-mark-year-inner-highlight");
// // d3.select("#y-mark-year-inner-" + from).node().setAttribute("class","y-mark-year-inner-highlight");
// d3.select("#y-mark-year-outer-" + from).node().setAttribute("class","y-mark-year-outer-highlight");
// // d3.select("#y-mark-year-outer-" + from).node().setAttribute("class","y-mark-year-outer-highlight");
// d3.select("#y-label-" + from).node().setAttribute("class","y-label-bold");
// // d3.select("#y-label-" + from).node().setAttribute("class","y-label-bold");
// }
// function groupOut() {
// var from = this.getAttribute("from");
// d3.select("#y-highlight-" + from).style("visibility","hidden");
// // d3.select("#y-mark-year-inner-" + from).node().setAttribute("class","y-mark-year-inner");
// // d3.select("#y-mark-year-outer-" + from).node().setAttribute("class","y-mark-year-outer");
// // d3.select("#y-label-" + from).node().setAttribute("class","y-label");
// }
function
initPath
()
{
d3
.
selectAll
(
".group-inner"
)
.
classed
(
"group-unfocus"
,
true
)
.
classed
(
"group-focus"
,
false
);
d3
.
selectAll
(
".group-path"
)
.
classed
(
"path-unfocus"
,
true
)
.
classed
(
"path-focus"
,
false
);
d3
.
selectAll
(
".term-path"
).
remove
();
d3
.
selectAll
(
".peak"
).
classed
(
"peak-focus"
,
false
);
d3
.
selectAll
(
".x-mark"
).
style
(
"fill"
,
"#4A5C70"
);
branchFocus
=
[];
}
}
function
groupOut
()
{
var
from
=
this
.
getAttribute
(
"from"
);
d3
.
select
(
"#y-highlight-"
+
from
).
style
(
"visibility"
,
"hidden"
);
// d3.select("#y-mark-year-inner-" + from).node().setAttribute("class","y-mark-year-inner");
// d3.select("#y-mark-year-outer-" + from).node().setAttribute("class","y-mark-year-outer");
// d3.select("#y-label-" + from).node().setAttribute("class","y-label");
}
function
doubleClick
()
{
function
doubleClick
()
{
d3
.
selectAll
(
".group-inner"
)
.
classed
(
"group-unfocus"
,
false
)
.
classed
(
"group-focus"
,
false
);
d3
.
selectAll
(
".group-path"
)
.
classed
(
"path-unfocus"
,
false
)
.
classed
(
"path-focus"
,
false
);
d3
.
selectAll
(
".term-path"
).
remove
();
d3
.
selectAll
(
".term-path"
).
remove
();
var
groups
=
document
.
getElementsByClassName
(
'group-inner'
);
document
.
querySelector
(
"#phyloPhylo"
).
innerHTML
=
"phylomemy"
;
for
(
var
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
document
.
querySelector
(
"#phyloPhylo"
).
classList
.
remove
(
"phylo-focus"
);
groups
[
i
].
classList
.
remove
(
"group-inner-focus"
);
document
.
querySelector
(
"#phyloGroups"
).
innerHTML
=
window
.
nbGroups
;
groups
[
i
].
classList
.
remove
(
"group-inner-unfocus"
);
document
.
querySelector
(
"#phyloTerms"
).
innerHTML
=
window
.
nbTerms
;
}
document
.
querySelector
(
"#phyloBranches"
).
innerHTML
=
window
.
nbBranches
;
var
paths
=
document
.
getElementsByClassName
(
'group-path'
);
document
.
querySelector
(
"#phyloGroups"
).
classList
.
remove
(
"phylo-focus"
);
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
document
.
querySelector
(
"#phyloTerms"
).
classList
.
remove
(
"phylo-focus"
);
paths
[
i
].
classList
.
remove
(
"group-path-focus"
);
document
.
querySelector
(
"#phyloBranches"
).
classList
.
remove
(
"phylo-focus"
);
}
d3
.
selectAll
(
".peak"
).
classed
(
"peak-focus"
,
false
);
d3
.
selectAll
(
".x-mark"
).
style
(
"fill"
,
"#4A5C70"
);
branchFocus
=
[];
}
}
}
}
...
...
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