Mercurial > hg > NetworkVis
comparison ismi-python-neo4jrestclient/static/commentaries_authors2.html @ 18:c5fffe4338a1
with clickable nodes now.
author | casties |
---|---|
date | Wed, 07 Oct 2015 16:27:29 +0200 |
parents | 09c0a9ceb778 |
children | 2b2699d47eba |
comparison
equal
deleted
inserted
replaced
17:09c0a9ceb778 | 18:c5fffe4338a1 |
---|---|
95 <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script> | 95 <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script> |
96 <!-- <script src="https://d3js.org/d3.v3.min.js" type="text/javascript"></script> --> | 96 <!-- <script src="https://d3js.org/d3.v3.min.js" type="text/javascript"></script> --> |
97 <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" type="text/javascript"></script> | 97 <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" type="text/javascript"></script> |
98 <script type="text/javascript"> | 98 <script type="text/javascript"> |
99 backendApiPrefix = ""; | 99 backendApiPrefix = ""; |
100 searchApi = {}; | |
100 $(function () { | 101 $(function () { |
101 function showText(text_id) { | 102 function showText(text_id) { |
102 $.get(backendApiPrefix+"/textandcommentaries/" + encodeURIComponent(text_id), | 103 $.get(backendApiPrefix+"/textandcommentaries/" + encodeURIComponent(text_id), |
103 function (data) { | 104 function (data) { |
104 if (!data) return; | 105 if (!data) return; |
152 }); | 153 }); |
153 showText(data[0].text.ismi_id); | 154 showText(data[0].text.ismi_id); |
154 }, "json"); | 155 }, "json"); |
155 return false; | 156 return false; |
156 } | 157 } |
157 | 158 // export API |
159 searchApi.showText = showText; | |
160 searchApi.search = search; | |
161 // start search | |
158 $("#search").submit(search); | 162 $("#search").submit(search); |
159 search(); | 163 search(); |
160 }) | 164 }) |
161 </script> | 165 </script> |
162 | 166 |
184 var node = svg.selectAll(".node") | 188 var node = svg.selectAll(".node") |
185 .data(graph.nodes).enter() | 189 .data(graph.nodes).enter() |
186 .append("circle") | 190 .append("circle") |
187 .attr("class", function (d) { return "node "+d.label+" ismi-"+d.ismi_id}) | 191 .attr("class", function (d) { return "node "+d.label+" ismi-"+d.ismi_id}) |
188 .attr("r", 8) // 10 | 192 .attr("r", 8) // 10 |
193 .attr("data-ismi_id", function(d) {return d.ismi_id}) | |
194 .on("click", function() { | |
195 console.log("click on ", this); | |
196 var id = this.getAttribute("data-ismi_id"); | |
197 searchApi.showText(id); | |
198 }) | |
189 .call(force.drag); | 199 .call(force.drag); |
190 | 200 |
201 console.log("searchApi:", searchApi); | |
191 // html title attribute | 202 // html title attribute |
192 node.append("title") | 203 node.append("title") |
193 .text(function (d) { return d.title; }) | 204 .text(function (d) { return d.title; }) |
194 | 205 |
195 // force feed algo ticks | 206 // force feed algo ticks |