Commit 82b95c03 authored by Anze Vavpetic's avatar Anze Vavpetic

merge

parents dabcd4aa b2082f13
......@@ -10,9 +10,17 @@ def cforange_hierarchical_clustering(request,input_dict,output_dict,widget):
matrix = input_dict['dm']
linkage = int(input_dict['linkage'])
root = Clustering.hierarchical_clustering(linkage, matrix)
dm_examples = True
try:
attributes = [x.name for x in matrix.items.domain]
except:
attributes = ['attribute']
dm_examples = False
def build_hierarchy(node, root=False):
if dm_examples:
values_dict = dict([(x,matrix.items[node.first][x].value) for x in attributes]) if not node.branches else {}
else:
values_dict = dict([(x,matrix.items[node.first].name) for x in attributes]) if not node.branches else {}
for attribute in values_dict.keys():
if type(values_dict[attribute]) == float:
values_dict[attribute]="%.3f" % values_dict[attribute]
......
......@@ -164,6 +164,11 @@ if (vizualization=="circle") {
.attr("r", 3);
}
$(".node").mouseenter(function() {
alert("test");
});
if (vizualization=="circle") {
for (a in attributes) {
node.append("svg:text")
.attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
......@@ -173,6 +178,16 @@ if (vizualization=="circle") {
.attr("class", "attribute"+a+" attributes")
.text(function(d) { return d.values[attributes[a]]; });
}
} else {
for (a in attributes) {
node.append("svg:text")
.attr("dx", -10)
.attr("dy", 3)
.style("text-anchor", function(d) { return d.children ? "end" : "start"; })
.attr("class", "attribute"+a+" attributes")
.text(function(d) { return d.values[attributes[a]]; });
}
}
$(".attributes").hide();
......
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