Commit 5a60b0d9 authored by PkSM3's avatar PkSM3

color nodes

parent 85f5697f
...@@ -148,11 +148,22 @@ ...@@ -148,11 +148,22 @@
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li><a> <li class="dropdown">
<button id="clustbyCC">Clusterize</button> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
</a></li> <img title="Set Colors" src="img/colors.png" width="20px"><b class="caret"></b></img>
</a>
<ul class="dropdown-menu">
<li><a href="#" id="colorbyCC">By Country</a></li>
<li><a href="#"><strike>By Acronym</strike></a></li>
<li><a href="#" id="colorbyDef">By Default</a></li>
<li class="divider"></li>
<li><a href="#"> <span class="glyphicon glyphicon-repeat"></span> <strike>Properties</strike></a></li>
</ul>
</li>
</ul> </ul>
</div> </div>
<!-- <!--
......
This diff is collapsed.
...@@ -681,10 +681,15 @@ function theListeners(){ ...@@ -681,10 +681,15 @@ function theListeners(){
}); });
$("#clustbyCC").click(function(){ $("#colorbyCC").click(function(){
clustersBy("country"); clustersBy("country");
}); });
$("#colorbyDef").click(function(){
clustersBy("default");
});
$.doTimeout(10,function (){ $.doTimeout(10,function (){
var deftoph=$("#defaultop").height(); var deftoph=$("#defaultop").height();
var refh=$("#fixedtop").height(); var refh=$("#fixedtop").height();
......
...@@ -164,7 +164,7 @@ function getCountries(){ ...@@ -164,7 +164,7 @@ function getCountries(){
} }
function clustersBy(daclass) { function clustersBy(daclass) {
if(daclass=="country") { if (daclass=="country") {
CCs = getCountries() CCs = getCountries()
CCxID = {} CCxID = {}
...@@ -173,19 +173,25 @@ function clustersBy(daclass) { ...@@ -173,19 +173,25 @@ function clustersBy(daclass) {
CCxID[code]=parseInt(i); CCxID[code]=parseInt(i);
} }
pr(CCxID) pr(CCxID)
var nodes = getVisibleNodes(); var nodes = getVisibleNodes();
colorList.sort(function(){ return Math.random()-0.5; }); colorList.sort(function(){ return Math.random()-0.5; });
pr(colorList); // pr(colorList);
for(var i in nodes) { for(var i in nodes) {
cc = nodes[i].attr["CC"] cc = nodes[i].attr["CC"]
if( !isUndef( cc ) && cc!="-" ) { if( !isUndef( cc ) && cc!="-" ) {
nodes[i].color = colorList[ CCxID[cc] ]; nodes[i].color = colorList[ CCxID[cc] ];
} }
} }
}
partialGraph.refresh() if (daclass=="default") {
partialGraph.draw(); var nodes = getVisibleNodes();
for(var i in nodes) {
nodes[i].color = Nodes[ nodes[i].id ].color;
}
} }
partialGraph.refresh()
partialGraph.draw();
} }
\ No newline at end of file
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