summaryrefslogtreecommitdiff
path: root/gstudio/templates
diff options
context:
space:
mode:
authorNeha shah <shan.akshata@gmail.com>2012-05-09 14:37:37 +0530
committerNeha shah <shan.akshata@gmail.com>2012-05-09 14:37:37 +0530
commit0c6fa488209e61220b2ebea4580e2caf97b30d6c (patch)
tree9c237f1a0111a51ca3832efe73f60c7cda5a561d /gstudio/templates
parent0643630713261d8939ff64a312ae1ba494c01db7 (diff)
parent6b77378be56f722d36459056b7d3083d1a422448 (diff)
downloadgnowsys-0c6fa488209e61220b2ebea4580e2caf97b30d6c.tar.gz
Merge remote branch 'gn/master'
Diffstat (limited to 'gstudio/templates')
-rw-r--r--gstudio/templates/gstudio/skeleton.html60
1 files changed, 38 insertions, 22 deletions
diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html
index 1e790ff..c5a15c3 100644
--- a/gstudio/templates/gstudio/skeleton.html
+++ b/gstudio/templates/gstudio/skeleton.html
@@ -10,7 +10,7 @@
}
.nodetext {
#pointer-events: none;
- font: 10px Serif;
+ font: 12px Serif;
font-style:italic;
}
.mainnode{
@@ -192,10 +192,10 @@ function init(a,b)
all_edges =_(b).chain().map(function(e) {
e.source = nodes_by_id[e.from];
e.target = nodes_by_id[e.to];
-
+ //`e.type = nodes_by_id[e.type]
return e;
}).filter(function(e){
- return nodes_by_id[e.from] && nodes_by_id[e.to]&& e.type!="title"
+ return nodes_by_id[e.from] && nodes_by_id[e.to]&& e.type!="title" && e.type!="content"
}).value();
@@ -253,7 +253,7 @@ var a = 25 * s;
.charge(-5000)
.friction(0.7)
.gravity(0.7)
- .linkDistance(75)
+ .linkDistance(50)
.nodes([])
.links([])
.size([w, h])
@@ -279,6 +279,9 @@ var a = 25 * s;
force.links(edges);
force.start();
+
+
+
link = d3.select("#chart g.edges").selectAll("line.link")
.data(edges, function(e){return e.from + "-" + e.to + "-" + e.type});
@@ -301,13 +304,13 @@ var a = 25 * s;
})
.attr("text", function(d) {
return d.type;
- })
+ });
+
+
+
- .append("a")
- .text(function(d) { return d.type; });
-
var node = d3.select("#chart g.nodes").selectAll("g.node").data(nodes);
@@ -316,30 +319,40 @@ var a = 25 * s;
var new_g = node.enter().append("svg:a")
- .attr("class", function(d) { var e=(d._id).charAt(0); if (d._id==key) return "mainnode"; else if (e=="-") return "nodetext"; else if (isNaN(d._id)) return "relnode" ; else return "node"; })
-
- //.attr("xlink:href",function(d){return d.url;})
+ .attr("class", function(d) { var e=(d._id).charAt(0); if (d._id==key) return "mainnode"; else if (e=="-") return "nodetext"; else if (isNaN(d._id)) return "relnode" ; else return "node"; })
+
.call(force.drag);
-
+$(window).bind('keydown',function(event){
+ if(17==event.keyCode){
new_g.on("click",function(d){
- if(d._id>0)
+ if(d._id>0 && d.expanded=="false")
{
d3.select("#amazingViz").remove();
d.expanded="true";
$.getJSON('/nodetypes/graphs/graph_json/' + d._id , function (json2) {
new_metadata=json2.node_metadata;
- new_relations=json2.relations;
+ new_relations=json2.relations;
metadata=_.union(new_metadata,metadata);
relations=_.union(new_relations,relations);
init(metadata,relations);
load(d._id)
})
-
}
- });
+
+ });
+
+}
+});
+
+
+
+ new_g.on("click", function(d) {
+
+ new_g.attr("xlink:href",function(d){return d.url;});
+ });
/*new_g.append("svg:ellipse")
@@ -356,8 +369,9 @@ var a = 25 * s;
var text1 = new_g.append("svg:text")
.attr("class",function(d) {var e=(d._id).charAt(0); if (d._id==key) return "mainnode";else if (e=="-") return "nodetext"; else if (isNaN(d._id)) return "relnode"; else return "node"; })
- .attr("dy", 20)
- .attr("dx", 25)
+ .attr("y", 20)
+ .attr("x", 25)
+ .attr("dy", ".35em")
.attr("text-anchor","middle")
// .attr("style",function text(d) { if ((d._id)>0) return "font-size:9.00pt;fill:blue;" ; else return "font-size:9.00pt;fill:black;"})
@@ -370,9 +384,10 @@ var a = 25 * s;
new_g.filter(function(d) { return (d._id).charAt(0)=="-"; }).append("svg:rect")
- .attr("x",bbox.x-5)
+ .attr("x",bbox.x-22
+ )
.attr("y", bbox.y)
- .attr("width", function(d) {var ttx=d.screen_name ; return (ttx.length + bbox.width)})
+ .attr("width", function(d) {var ttx=d.screen_name ; return (ttx.length+bbox.width+40)})
.attr("height", bbox.height)
.call(force.drag)
.style("fill-opacity", ".1")
@@ -388,9 +403,9 @@ var a = 25 * s;
.attr("cx", bbox.x+25)
.attr("cy", bbox.y+13)
.call(force.drag)
- .attr("rx",function(d) {var ttx=d.screen_name ; return (ttx.length + 45)})
+ .attr("rx",function(d) {var ttx=d.screen_name ; return (ttx.length + 40)})
.attr("ry",13)
- .style("fill-opacity", ".5")
+ .style("fill-opacity", ".2")
.style("stroke", "#666")
.style("stroke-width", "1.5px")
.style("fill", function color(d) {var e=(d._id).charAt(0); if (d.expanded=="true") return "red"; else return "none"});
@@ -398,6 +413,7 @@ var a = 25 * s;
+
node.exit().remove();