From 45fb5f2bdda2bbe5fd6bae887a6dfa230e69bb62 Mon Sep 17 00:00:00 2001 From: shefali shetty Date: Thu, 3 May 2012 12:01:36 +0530 Subject: a gnowsys-studio/ --- gstudio/templates/gstudio/graph1.html | 2 +- gstudio/templates/gstudio/skeleton.html | 370 ++++++++++++-------------------- 2 files changed, 140 insertions(+), 232 deletions(-) (limited to 'gstudio/templates') diff --git a/gstudio/templates/gstudio/graph1.html b/gstudio/templates/gstudio/graph1.html index 587b703..ab66e51 100644 --- a/gstudio/templates/gstudio/graph1.html +++ b/gstudio/templates/gstudio/graph1.html @@ -94,7 +94,7 @@ $(function() { success : function(json) { var force; - + // this contains all the nodes as a dict with _id as the key var nodes_by_id = _.reduce(json.node_metadata, function(acc, n) { diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index 1fcf9cc..1e790ff 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -16,14 +16,14 @@ .mainnode{ font: 15px sans-serif; - fill:"red"; + fill:"black"; border-width: 1px; font-weight:bold; border-color: gray; } .relnode { - font: 10px sans-serif; + font: 12px sans-serif; font-weight:bold; fill:#000; } @@ -32,8 +32,9 @@ .node { border-width: 1px; border-color: gray; - fill:"green"; - font: 10px sans-serif; + font: 12px sans-serif; + fill:#25587E; + font-weight:bold; } body { background-color: white; @@ -45,8 +46,8 @@ display: block; } svg { - margin-left: 10%; - margin-right: 10%; + margin-left: 50%; + margin-right: 50%; display: block; position: absolute; } @@ -168,52 +169,18 @@ -- cgit v1.1 From 2b8a427dc2defae171a30abdf9dc54a28ae24857 Mon Sep 17 00:00:00 2001 From: shefali shetty Date: Fri, 4 May 2012 16:11:44 +0530 Subject: Graphs are merged by the'Cntrl+click' event and by the 'click' event,hyperlink is enabled --- gstudio/templates/gstudio/skeleton.html | 49 +++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'gstudio/templates') diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index 1e790ff..41df756 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{ @@ -195,7 +195,7 @@ function init(a,b) 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(); @@ -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}); @@ -304,8 +307,7 @@ var a = 25 * s; }) .append("a") - .text(function(d) { return d.type; }); - + .text(function(d) { return d.type; }); @@ -316,30 +318,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 +368,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 +383,9 @@ 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 +401,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"}); -- cgit v1.1 From be7765e07e626c8be1e3d433ddb2e4f84259cf59 Mon Sep 17 00:00:00 2001 From: shefali shetty Date: Wed, 9 May 2012 11:24:16 +0530 Subject: bug related to 'relation' is rectified --- gstudio/templates/gstudio/skeleton.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gstudio/templates') diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index 41df756..c5a15c3 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -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" && e.type!="content" + 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]) @@ -304,12 +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); @@ -383,7 +384,8 @@ $(window).bind('keydown',function(event){ new_g.filter(function(d) { return (d._id).charAt(0)=="-"; }).append("svg:rect") - .attr("x",bbox.x-22) + .attr("x",bbox.x-22 + ) .attr("y", bbox.y) .attr("width", function(d) {var ttx=d.screen_name ; return (ttx.length+bbox.width+40)}) .attr("height", bbox.height) @@ -411,6 +413,7 @@ $(window).bind('keydown',function(event){ + node.exit().remove(); -- cgit v1.1 From 06db97bafe284e9d974a869db4cb2b6bd86f39de Mon Sep 17 00:00:00 2001 From: shefali shetty Date: Wed, 9 May 2012 14:16:09 +0530 Subject: Arrow marker added to the links --- gstudio/templates/gstudio/skeleton.html | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'gstudio/templates') diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index c5a15c3..d179220 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -207,6 +207,7 @@ $(function fgraph() { $.getJSON('/nodetypes/graphs/graph_json/' + {{object.id}}, function (json1) { metadata=json1.node_metadata; relations=json1.relations; + relnset=json1.relset init(metadata,relations); load({{object.id}}) }); @@ -282,7 +283,7 @@ var a = 25 * s; - link = d3.select("#chart g.edges").selectAll("line.link") + link = d3.select("#chart g.edges").selectAll("line.link").select(this.arrowhead) .data(edges, function(e){return e.from + "-" + e.to + "-" + e.type}); link.enter().append("svg:line") @@ -304,13 +305,12 @@ var a = 25 * s; }) .attr("text", function(d) { return d.type; - }); + }) + .attr("marker-end", "url(#arrowhead)"); - - var node = d3.select("#chart g.nodes").selectAll("g.node").data(nodes); @@ -325,6 +325,21 @@ var a = 25 * s; + new_g.append("svg:marker") + .attr("id", "arrowhead") + .attr("viewBox","0 0 10 10") + .attr("refX","20") + .attr("refY","5") + .attr("markerUnits","strokeWidth") + .attr("markerWidth","9") + .attr("markerHeight","5") + .attr("orient","auto") + .append("svg:path") + .attr("d","M 0 0 L 10 5 L 0 10 z") + .attr("fill", "#6D6666"); + + + $(window).bind('keydown',function(event){ if(17==event.keyCode){ new_g.on("click",function(d){ @@ -334,7 +349,8 @@ $(window).bind('keydown',function(event){ 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; + new_relnset=json2.relset metadata=_.union(new_metadata,metadata); relations=_.union(new_relations,relations); init(metadata,relations); -- cgit v1.1 From 4c0a08ce6ef98e9b3e5020471e364e8b81d13eb0 Mon Sep 17 00:00:00 2001 From: Neha shah Date: Wed, 9 May 2012 14:27:09 +0530 Subject: rss feed for nodetype --- gstudio/templates/gstudio/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gstudio/templates') diff --git a/gstudio/templates/gstudio/base.html b/gstudio/templates/gstudio/base.html index 94a72eb..0b70311 100644 --- a/gstudio/templates/gstudio/base.html +++ b/gstudio/templates/gstudio/base.html @@ -20,8 +20,8 @@ {% endblock %} {% block sidebar %} - ? -

Rssfeed

+ ? +

Rssfeed

- -- cgit v1.1