Commit b2082f13 authored by Janez K's avatar Janez K
Browse files

dela tudi za atribute

parent 35692fab
...@@ -14,9 +14,17 @@ def cforange_hierarchical_clustering(request,input_dict,output_dict,widget): ...@@ -14,9 +14,17 @@ def cforange_hierarchical_clustering(request,input_dict,output_dict,widget):
("Complete linkage", orange.HierarchicalClustering.Complete), ("Complete linkage", orange.HierarchicalClustering.Complete),
] ]
root = orange.HierarchicalClustering(matrix, linkage=linkages[linkage][1]) root = orange.HierarchicalClustering(matrix, linkage=linkages[linkage][1])
attributes = [x.name for x in matrix.items.domain] 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): def build_hierarchy(node, root=False):
values_dict = dict([(x,matrix.items[node.first][x].value) for x in attributes]) if not node.branches else {} 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(): for attribute in values_dict.keys():
if type(values_dict[attribute]) == float: if type(values_dict[attribute]) == float:
values_dict[attribute]="%.3f" % values_dict[attribute] values_dict[attribute]="%.3f" % values_dict[attribute]
......
...@@ -164,14 +164,29 @@ if (vizualization=="circle") { ...@@ -164,14 +164,29 @@ if (vizualization=="circle") {
.attr("r", 3); .attr("r", 3);
} }
for (a in attributes) { $(".node").mouseenter(function() {
node.append("svg:text") alert("test");
.attr("dx", function(d) { return d.x < 180 ? 8 : -8; }) });
.attr("dy", ".31em")
.attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; }) if (vizualization=="circle") {
.attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; }) for (a in attributes) {
.attr("class", "attribute"+a+" attributes") node.append("svg:text")
.text(function(d) { return d.values[attributes[a]]; }); .attr("dx", function(d) { return d.x < 180 ? 8 : -8; })
.attr("dy", ".31em")
.attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
.attr("transform", function(d) { return d.x < 180 ? null : "rotate(180)"; })
.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(); $(".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