Commit 69e7c039 authored by Romain Loth's avatar Romain Loth

WIP making facets work in bipartite case + further factorizing

facets (ie clusters and other searchable/colorable attributes) should work with bipartite case, but it meant factorizing facetsBinning() and updateValueFacets() from commit 71507331
parent d06a320b
...@@ -21,11 +21,17 @@ This will still evolve but the main steps for any graph initialization messily u ...@@ -21,11 +21,17 @@ This will still evolve but the main steps for any graph initialization messily u
#### About source data #### About source data
- doc/sem typing: follows the node property "`category`" - doc/sem typing: follows the node property "`type`" or if absent, "`category`"
- if the category name is "document" => catSoc (type 0) - if the category name is "document" => catSoc (type 0)
- if the category name contains the str "term" => catSem (type 1) - if the category name contains the str "term" => catSem (type 1)
- `somenode.attributes`: the `attributes` property is always an object
- any attribute listed in the sourcenode.attributes will be indexed if the TW.scanClusters flag is true
- the mapping from attribute values to matching nodes is in TW.Clusters.aType.anAttr.aValue.map !
- coloration: "`age`" "`growth_rate`" + any attribute of type float or int - coloration: "`age`" "`growth_rate`" + any attribute of type float or int
- clustering: "`cluster_index`" ou nom figurant dans `TW.nodeClusAtt` - clustering: "`cluster_index`" ou nom figurant dans `TW.nodeClusAtt`
- vocabulary: (en cours) any attribute of type string and where the amount of distinct values is < TW.somesettings
## User interaction mecanisms ## User interaction mecanisms
......
This diff is collapsed.
...@@ -816,17 +816,24 @@ function clustersBy(daclass) { ...@@ -816,17 +816,24 @@ function clustersBy(daclass) {
for(var nid in NodeID_Val) { for(var nid in NodeID_Val) {
var newval_color = Math.round( ( Min_color+(NodeID_Val[nid]["round"]-real_min)*((Max_color-Min_color)/(real_max-real_min)) ) ); var newval_color = Math.round( ( Min_color+(NodeID_Val[nid]["round"]-real_min)*((Max_color-Min_color)/(real_max-real_min)) ) );
var hex_color = rgbToHex(255, (255-newval_color) , 0) var hex_color = rgbToHex(255, (255-newval_color) , 0)
TW.partialGraph.graph.nodes(nid).color = hex_color
TW.partialGraph.graph.nodes(nid).customAttrs.alt_color = hex_color let n = TW.partialGraph.graph.nodes(nid)
if (n && !n.hidden) {
n.color = hex_color
n.customAttrs.alt_color = hex_color
// FIXME not used ? // FIXME not used ?
TW.partialGraph.graph.nodes(nid).customAttrs.altgrey_color = false n.customAttrs.altgrey_color = false
// £TODO SETTING SIZE HERE SHOULD BE OPTIONAL
var newval_size = Math.round( ( Min_size+(NodeID_Val[nid]["round"]-real_min)*((Max_size-Min_size)/(real_max-real_min)) ) ); var newval_size = Math.round( ( Min_size+(NodeID_Val[nid]["round"]-real_min)*((Max_size-Min_size)/(real_max-real_min)) ) );
TW.partialGraph.graph.nodes(nid).size = newval_size; n.size = newval_size;
n.label = "("+NodeID_Val[nid]["real"].toFixed(min_pow)+") "+TW.Nodes[nid].label
}
// console.log("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size) // console.log("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size)
TW.partialGraph.graph.nodes(nid).label = "("+NodeID_Val[nid]["real"].toFixed(min_pow)+") "+TW.Nodes[nid].label
} }
// [ / Scaling node colours(0-255) and sizes(2-7) ] // [ / Scaling node colours(0-255) and sizes(2-7) ]
...@@ -855,6 +862,8 @@ function repaintEdges() { ...@@ -855,6 +862,8 @@ function repaintEdges() {
} }
else { else {
let e = TW.partialGraph.graph.edges(eid) let e = TW.partialGraph.graph.edges(eid)
if (e) {
let src = TW.partialGraph.graph.nodes(idPair[0]) let src = TW.partialGraph.graph.nodes(idPair[0])
let tgt = TW.partialGraph.graph.nodes(idPair[1]) let tgt = TW.partialGraph.graph.nodes(idPair[1])
...@@ -868,6 +877,7 @@ function repaintEdges() { ...@@ -868,6 +877,7 @@ function repaintEdges() {
} }
} }
} }
}
} }
// rewrite of clustersBy with binning and for attributes that can have negative float values // rewrite of clustersBy with binning and for attributes that can have negative float values
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment