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
cd62bc11
Commit
cd62bc11
authored
7 years ago
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow facet titling by sigma dynamic attrs like degree
kanban #271
parent
8a5a9251
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
8 deletions
+30
-8
explorerjs.html
explorerjs.html
+4
-1
Tinaweb.js
twmain/Tinaweb.js
+2
-0
extras_explorerjs.js
twmain/extras_explorerjs.js
+24
-7
No files found.
explorerjs.html
View file @
cd62bc11
...
@@ -689,7 +689,10 @@
...
@@ -689,7 +689,10 @@
<label
for=
"attr-titling-metric"
class=
"smlabel input-group-addon"
>
Titling metric
</label>
<label
for=
"attr-titling-metric"
class=
"smlabel input-group-addon"
>
Titling metric
</label>
<select
id=
"attr-titling-metric"
name=
"attr-titling-metric"
<select
id=
"attr-titling-metric"
name=
"attr-titling-metric"
class=
"custom-select form-control"
>
class=
"custom-select form-control"
>
<option
selected
value=
"size"
>
Current size
</option>
<option
selected
value=
"size"
data-opttype=
"auto"
>
Auto size
</option>
<option
selected
value=
"degree"
data-opttype=
"auto"
>
Auto degree
</option>
<option
selected
value=
"inDegree"
data-opttype=
"auto"
>
Auto in degree
</option>
<option
selected
value=
"outDegree"
data-opttype=
"auto"
>
Auto out degree
</option>
<!-- other attrs filled by fillAttrsInForm(., 'num') -->
<!-- other attrs filled by fillAttrsInForm(., 'num') -->
</select>
</select>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
twmain/Tinaweb.js
View file @
cd62bc11
...
@@ -1174,6 +1174,8 @@ var TinaWebJS = function ( sigmacanvas ) {
...
@@ -1174,6 +1174,8 @@ var TinaWebJS = function ( sigmacanvas ) {
// attributes' facet-options init & handler
// attributes' facet-options init & handler
fillAttrsInForm
(
'choose-attr'
)
fillAttrsInForm
(
'choose-attr'
)
document
.
getElementById
(
'choose-attr'
).
onchange
=
showAttrConf
document
.
getElementById
(
'choose-attr'
).
onchange
=
showAttrConf
// add all numeric attributes to titlingMetric with option type fromFacets
fillAttrsInForm
(
'attr-titling-metric'
,
'num'
)
fillAttrsInForm
(
'attr-titling-metric'
,
'num'
)
// cancelSelection(false);
// cancelSelection(false);
...
...
This diff is collapsed.
Click to expand it.
twmain/extras_explorerjs.js
View file @
cd62bc11
...
@@ -11,6 +11,14 @@ TW.gui.colorFuns = {
...
@@ -11,6 +11,14 @@ TW.gui.colorFuns = {
'cluster'
:
"clusterColoring"
'cluster'
:
"clusterColoring"
}
}
// sigma has dynamic attributes.. the functions below return their resp. getters
TW
.
sigmaAttributes
=
{
'degree'
:
function
(
sigInst
)
{
return
function
(
nd
)
{
return
sigInst
.
graph
.
degree
(
nd
.
id
)}},
'outDegree'
:
function
(
sigInst
)
{
return
function
(
nd
)
{
return
sigInst
.
graph
.
degree
(
nd
.
id
,
'out'
)}},
'inDegree'
:
function
(
sigInst
)
{
return
function
(
nd
)
{
return
sigInst
.
graph
.
degree
(
nd
.
id
,
'in'
)}}
}
// Execution: changeGraphAppearanceByFacets( true )
// Execution: changeGraphAppearanceByFacets( true )
// It reads scanned node-attributes and prepared legends in TW.Clusters
// It reads scanned node-attributes and prepared legends in TW.Clusters
// to add the button in the html with the sigmaUtils.gradientColoring(x) listener.
// to add the button in the html with the sigmaUtils.gradientColoring(x) listener.
...
@@ -277,13 +285,20 @@ function set_ClustersLegend ( daclass, groupedByTicks ) {
...
@@ -277,13 +285,20 @@ function set_ClustersLegend ( daclass, groupedByTicks ) {
let
theRankingAttr
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingMetric
let
theRankingAttr
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingMetric
let
maxLen
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingNTerms
||
2
let
maxLen
=
TW
.
conf
.
facetOptions
[
daclass
].
titlingNTerms
||
2
// custom accessor (user settings or by default)
// custom accessor (
sigma auto attr or
user settings or by default)
let
getVal
let
getVal
if
(
theRankingAttr
)
{
if
(
theRankingAttr
)
{
getVal
=
function
(
node
)
{
return
node
.
attributes
[
theRankingAttr
]}
// one of the 3 sigma dynamic attributes 'degree', etc
if
(
theRankingAttr
in
TW
.
sigmaAttributes
)
{
getVal
=
TW
.
sigmaAttributes
[
theRankingAttr
](
TW
.
partialGraph
)
}
}
// a user setting for a source data attribute
else
{
else
{
getVal
=
function
(
node
)
{
return
node
.
attributes
[
theRankingAttr
]}
}
}
// default ranking: by size
// default ranking: by size
else
{
getVal
=
function
(
node
)
{
return
node
.
size
}
getVal
=
function
(
node
)
{
return
node
.
size
}
}
}
...
@@ -872,7 +887,7 @@ function activateModules() {
...
@@ -872,7 +887,7 @@ function activateModules() {
// =================
// =================
// creates a list of <options> for all present attributes
// creates a list of
automatic
<options> for all present attributes
// (or a sublist on a meta.dataType condition
// (or a sublist on a meta.dataType condition
// NB condition on dataType could be on an extended meta "attrType"
// NB condition on dataType could be on an extended meta "attrType"
// cf. doc/developer_manual.md autodiagnose remark)
// cf. doc/developer_manual.md autodiagnose remark)
...
@@ -883,9 +898,10 @@ function fillAttrsInForm(menuId, optionalAttTypeConstraint) {
...
@@ -883,9 +898,10 @@ function fillAttrsInForm(menuId, optionalAttTypeConstraint) {
let
elChooser
=
document
.
getElementById
(
menuId
)
let
elChooser
=
document
.
getElementById
(
menuId
)
// remove the possible previous options from possible previous graphs
// remove any previous fromFacets options from possible previous graphs
while
(
elChooser
.
lastChild
)
{
let
autoOptions
=
document
.
getElementById
(
menuId
).
querySelectorAll
(
'option[data-opttype=fromFacets]'
)
elChooser
.
removeChild
(
elChooser
.
lastChild
)
for
(
var
i
=
0
;
i
<=
autoOptions
.
length
-
1
;
i
++
)
{
elChooser
.
removeChild
(
autoOptions
[
i
])
}
}
// each facet family or clustering type was already prepared
// each facet family or clustering type was already prepared
...
@@ -896,6 +912,7 @@ function fillAttrsInForm(menuId, optionalAttTypeConstraint) {
...
@@ -896,6 +912,7 @@ function fillAttrsInForm(menuId, optionalAttTypeConstraint) {
let
opt
=
document
.
createElement
(
'option'
)
let
opt
=
document
.
createElement
(
'option'
)
opt
.
value
=
att
opt
.
value
=
att
opt
.
innerText
=
att
opt
.
innerText
=
att
opt
.
dataset
.
opttype
=
"fromFacets"
elChooser
.
appendChild
(
opt
)
elChooser
.
appendChild
(
opt
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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