Commit 5a60b0d9 authored by PkSM3's avatar PkSM3

color nodes

parent 85f5697f
......@@ -148,11 +148,22 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a>
<button id="clustbyCC">Clusterize</button>
</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<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>
</div>
<!--
......
This diff is collapsed.
......@@ -681,10 +681,15 @@ function theListeners(){
});
$("#clustbyCC").click(function(){
$("#colorbyCC").click(function(){
clustersBy("country");
});
$("#colorbyDef").click(function(){
clustersBy("default");
});
$.doTimeout(10,function (){
var deftoph=$("#defaultop").height();
var refh=$("#fixedtop").height();
......
......@@ -164,7 +164,7 @@ function getCountries(){
}
function clustersBy(daclass) {
if(daclass=="country") {
if (daclass=="country") {
CCs = getCountries()
CCxID = {}
......@@ -173,19 +173,25 @@ function clustersBy(daclass) {
CCxID[code]=parseInt(i);
}
pr(CCxID)
var nodes = getVisibleNodes();
colorList.sort(function(){ return Math.random()-0.5; });
pr(colorList);
// pr(colorList);
for(var i in nodes) {
cc = nodes[i].attr["CC"]
if( !isUndef( cc ) && cc!="-" ) {
nodes[i].color = colorList[ CCxID[cc] ];
}
}
}
partialGraph.refresh()
partialGraph.draw();
if (daclass=="default") {
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