Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
david Chavalarias
clinicaltrials
Commits
797b7bbb
Commit
797b7bbb
authored
Jun 12, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix max k elts algo (:/) and add size as a default ranking metric
parent
c764e903
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
extras_explorerjs.js
extras_explorerjs.js
+22
-11
No files found.
extras_explorerjs.js
View file @
797b7bbb
...
...
@@ -249,9 +249,6 @@ function graphResetLabelsAndSizes(){
// @daclass: the name of a numeric/categorical attribute from node.attributes
// @groupingTicks: an optional threshold's array expressing ranges with their low/up bounds label and ref to matchin nodeIds
function
set_ClustersLegend
(
daclass
,
groupedByTicks
)
{
//TW.partialGraph.states.slice(-1)[0].LouvainFait = true
$
(
"#legend-for-clusters"
).
removeClass
(
"my-legend"
)
$
(
"#legend-for-clusters"
).
html
(
""
)
if
(
daclass
==
null
)
return
;
...
...
@@ -305,25 +302,39 @@ function set_ClustersLegend ( daclass, groupedByTicks ) {
// create the legend item
var
preparedLabel
=
legendInfo
[
l
][
'labl'
]
// we add a title to cluster classes
// we add a title to cluster classes
by ranking their nodes and taking k best labels
if
(
TW
.
conf
.
facetOptions
[
daclass
]
&&
TW
.
conf
.
facetOptions
[
daclass
].
col
==
'cluster'
)
{
// let t0 = performance.now()
let
titles
=
[]
let
theRankingAttr
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingMetric
let
maxLen
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingNTerms
let
maxLen
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingNTerms
||
2
// custom accessor (user settings or by default)
let
getVal
if
(
theRankingAttr
)
{
getVal
=
function
(
node
)
{
return
node
.
attributes
[
theRankingAttr
]}
}
else
{
// default ranking: by size
getVal
=
function
(
node
)
{
return
node
.
size
}
}
for
(
let
j
in
legendInfo
[
l
][
'nids'
])
{
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
legendInfo
[
l
][
'nids'
][
j
])
let
lastMax
=
0
if
(
titles
.
length
)
{
// we keep titles sorted for this
lastMax
=
titles
.
slice
(
-
1
)[
0
].
val
let
theRankingVal
=
getVal
(
n
)
if
(
titles
.
length
<
maxLen
)
{
titles
.
push
({
'key'
:
n
.
label
,
'val'
:
theRankingVal
})
}
if
(
n
.
attributes
[
theRankingAttr
]
>
lastMax
)
{
titles
.
push
({
'key'
:
n
.
label
,
'val'
:
n
.
attributes
[
theRankingAttr
]})
else
{
// we keep titles sorted for this
let
lastMax
=
titles
.
slice
(
-
1
)[
0
].
val
if
(
theRankingVal
>
lastMax
)
{
titles
.
push
({
'key'
:
n
.
label
,
'val'
:
theRankingVal
})
}
}
titles
.
sort
(
function
(
a
,
b
)
{
return
b
.
val
-
a
.
val
})
...
...
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