Commit db4ed596 authored by Romain Loth's avatar Romain Loth

Merge commit '644e50d' into with_tina_1.2

parents 765b533b 9532a8e0
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<link rel="stylesheet" href="twlibs3/jquery-3/jquery-ui-1.12.1/jquery-ui.min.css" media="screen"> <link rel="stylesheet" href="twlibs3/jquery-3/jquery-ui-1.12.1/jquery-ui.min.css" media="screen">
<!-- NB bootstrap 3 not used for main grid (graph + bars) but inside the bars --> <!-- NB bootstrap 3 not used for main grid (graph + bars) but inside the bars -->
<link rel="stylesheet" href="twlibs3/bootstrap-3/css/bootstrap.min.css" media="screen"> <link rel="stylesheet" href="twlibs3/bootstrap-3/css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="twlibs3/css/freshslider/freshslider.css" media="screen"> <link rel="stylesheet" href="twlibs3/freshslider/freshslider.css" media="screen">
<link rel="stylesheet" href="twlibs3/tweets/tweet.light.ltr.css" /> <link rel="stylesheet" href="twlibs3/tweets/tweet.light.ltr.css" />
<link rel="stylesheet" href="twlibs3/tweets/custom.css"/> <link rel="stylesheet" href="twlibs3/tweets/custom.css"/>
......
...@@ -187,7 +187,7 @@ TW.conf = (function(TW){ ...@@ -187,7 +187,7 @@ TW.conf = (function(TW){
TWConf.filterSliders = true // show sliders for nodes/edges subsets TWConf.filterSliders = true // show sliders for nodes/edges subsets
TWConf.clusterColorsAtt = true; // show "Set colors" menu TWConf.colorByAtt = true; // show "Set colors" menu
TWConf.dragNodesAvailable = true; // allow dragging nodes with CTRL+click TWConf.dragNodesAvailable = true; // allow dragging nodes with CTRL+click
......
...@@ -730,7 +730,7 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -730,7 +730,7 @@ var TinaWebJS = function ( sigmacanvas ) {
TW.partialGraph.camera.goTo({x:0, y:0, ratio:1.2}) TW.partialGraph.camera.goTo({x:0, y:0, ratio:1.2})
}); });
if (!TW.conf.clusterColorsAtt) { if (!TW.conf.colorByAtt) {
$("#setcolorsMenu").hide() $("#setcolorsMenu").hide()
} }
......
...@@ -433,6 +433,9 @@ function changeType() { ...@@ -433,6 +433,9 @@ function changeType() {
// possible: add it in an early way here and request that MS2 doesn't change state // possible: add it in an early way here and request that MS2 doesn't change state
}) })
// update the color menu
changeGraphAppearanceByFacets( getActivetypesNames() )
// to recreate the new selection in the new type graph, if we had one before // to recreate the new selection in the new type graph, if we had one before
// NB relies on new actypes so should be after pushState // NB relies on new actypes so should be after pushState
if (newselsArr.length && sels.length) { if (newselsArr.length && sels.length) {
......
...@@ -14,26 +14,23 @@ TW.gui.colorFuns = { ...@@ -14,26 +14,23 @@ TW.gui.colorFuns = {
// 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.
function changeGraphAppearanceByFacets( manualflag ) { function changeGraphAppearanceByFacets(actypes) {
if ( !isUndef(manualflag) && !TW.conf.colorByAtt ) TW.conf.colorByAtt = manualflag;
if(!TW.conf.colorByAtt) return; if(!TW.conf.colorByAtt) return;
if (!actypes) actypes = getActivetypesNames()
let currentNbNodes = TW.partialGraph.graph.nNodes() let currentNbNodes = TW.partialGraph.graph.nNodes()
// create colormenu and 1st default entry // create colormenu and 1st default entry
var color_menu_info = '<li><a href="#" onclick="TW.gui.handpickedcolor = false ; graphResetLabelsAndSizes()">By Default</a></li>'; var color_menu_info = '<li><a href="#" onclick="TW.gui.handpickedcolor = false ; graphResetLabelsAndSizes()">By Default</a></li>';
if( $( "#colorgraph-menu" ).length>0 ) { if( $( "#colorgraph-menu" ).length>0 ) {
var actypes = getActivetypesNames()
for (var tid in actypes) { for (var tid in actypes) {
let ty = actypes[tid] let ty = actypes[tid]
// each facet family or clustering type was already prepared // each facet family or clustering type was already prepared
for (var attTitle in TW.Clusters[ty]) { for (var attTitle in TW.Clusters[ty]) {
// attribute counts: nb of classes // attribute counts: nb of classes
// POSS here distinguish [ty][attTitle].classes.length and ranges.length // POSS here distinguish [ty][attTitle].classes.length and ranges.length
var attNbClasses = TW.Clusters[ty][attTitle].invIdx.length var attNbClasses = TW.Clusters[ty][attTitle].invIdx.length
...@@ -192,21 +189,11 @@ function SomeEffect( ValueclassCode ) { ...@@ -192,21 +189,11 @@ function SomeEffect( ValueclassCode ) {
var activetypesKey = getActivetypesKey() var activetypesKey = getActivetypesKey()
// we have our precomputed idmaps for nodes_2_colour // we have our precomputed idmaps for nodes_2_colour => full selection
// ------------------------------------------------- // /!\ nodeset can be quite big
for (var k in TW.Clusters[nodeType][cluType].invIdx[iClu].nids) { TW.instance.selNgn.MultipleSelection2(
var nid = TW.Clusters[nodeType][cluType].invIdx[iClu].nids[k] {nodes: TW.Clusters[nodeType][cluType].invIdx[iClu].nids}
nodes_2_colour[nid] = true )
n = TW.partialGraph.graph.nodes(nid)
if(n) {
n.customAttrs['highlight'] = true;
}
}
TW.pushState({
sels:TW.Clusters[nodeType][cluType].invIdx[iClu].nids,
rels:{}
})
TW.partialGraph.refresh() TW.partialGraph.refresh()
} }
...@@ -1035,7 +1022,7 @@ function newAttrConfAndColor() { ...@@ -1035,7 +1022,7 @@ function newAttrConfAndColor() {
// console.log("reparse binned result", newClustering) // console.log("reparse binned result", newClustering)
// update the GUI menu // update the GUI menu
changeGraphAppearanceByFacets(true) changeGraphAppearanceByFacets()
// run the new color // run the new color
let colMethod = TW.gui.colorFuns[TW.conf.facetOptions[attrTitle]['col']] let colMethod = TW.gui.colorFuns[TW.conf.facetOptions[attrTitle]['col']]
......
...@@ -302,10 +302,6 @@ function syncRemoteGraphData () { ...@@ -302,10 +302,6 @@ function syncRemoteGraphData () {
TW.relDocsInfos[path+"/"+aGexf]['social'] = theGexfs[aGexf]["social"]["table"] TW.relDocsInfos[path+"/"+aGexf]['social'] = theGexfs[aGexf]["social"]["table"]
} }
} }
console.log("TW.relDocsInfos", TW.relDocsInfos)
} }
else { else {
TW.relDocsInfos[path+"/"+aGexf] = null TW.relDocsInfos[path+"/"+aGexf] = null
...@@ -618,7 +614,7 @@ function mainStartGraph(inFormat, inData, twInstance) { ...@@ -618,7 +614,7 @@ function mainStartGraph(inFormat, inData, twInstance) {
// should prepare the colors/clusters menu once and for all // should prepare the colors/clusters menu once and for all
// (previously, needed to be called after changeType/changeLevel) // (previously, needed to be called after changeType/changeLevel)
changeGraphAppearanceByFacets(true) changeGraphAppearanceByFacets()
// set the default legend // set the default legend
set_ClustersLegend ( "clust_default" ) set_ClustersLegend ( "clust_default" )
......
...@@ -889,13 +889,7 @@ function heatmapColoring(daclass) { ...@@ -889,13 +889,7 @@ function heatmapColoring(daclass) {
function clusterColoring(daclass) { function clusterColoring(daclass) {
console.log("")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log("clusterColoring ( "+daclass+" )") console.log("clusterColoring ( "+daclass+" )")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log(" = = = = = = = = = = = = = = = = = ")
console.log("")
cancelSelection(false); // now loops only on selected cancelSelection(false); // now loops only on selected
graphResetLabelsAndSizes() // full loop graphResetLabelsAndSizes() // full loop
...@@ -953,7 +947,7 @@ function clusterColoring(daclass) { ...@@ -953,7 +947,7 @@ function clusterColoring(daclass) {
let val = valGroup.val || valGroup.range let val = valGroup.val || valGroup.range
// use the int as an index between 0 and nColors // use the int as an index between 0 and nColors
if (parseInt(val) == val) { if (parseInt(val) == val) {
theColor = colList [val] % nColors theColor = colList [val % nColors]
} }
// or create a representative int on the same range // or create a representative int on the same range
else { else {
...@@ -973,7 +967,7 @@ function clusterColoring(daclass) { ...@@ -973,7 +967,7 @@ function clusterColoring(daclass) {
} }
} }
// rembember in TW.Clusters // remember in TW.Clusters
valGroup.col = theColor valGroup.col = theColor
} }
} }
......
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