Mercurial > hg > Members > nobuyasu > TwitterBootstrap
changeset 12:29d39f0e7ee7 draft
add viewer
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 21 Sep 2012 17:38:22 +0900 |
parents | 899900981cf8 |
children | 8b4447c379e5 |
files | viewer/dimViewer.html viewer/js/library.js viewer/json/graph.json |
diffstat | 3 files changed, 139 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/viewer/dimViewer.html Fri Sep 21 17:38:22 2012 +0900 @@ -0,0 +1,58 @@ +<html> + +<body onload="main();"> + + +<div id="node1" style="background-color:blue; border-radius:30px; width:50px; height:50px;"></div> +<div id="outputdiv" style="border-style:ridge; border-color:red; border-radius:10px; width:150px;"> + <div style="border-radius:10px; margin-top:5%; margin-left:5%; margin-right:5%; text-align:center; background-color:#ccc;"> + title + </div> + <div style="background-color:#ccf; border-radius:10px; margin:5%;"> + content + <div> + aaaa + <div> + aaa + <div> + aaa + <div> + aaa + </div> + <div> + + </div> +</div> + +<script src="../assets/js/jquery.js"></script> +<script src="./js/library.js"></script> +<script> + filename = "./json/graph.json" + function main() { + var output = document.getElementById("outputdiv"); + var data = loadFile(filename); + var jobj = JSON.parse(data); + + var root = jobj["root"]; +// output.textContent = "root : " + root; + + var title = jobj.Nodes[root].data.title; +// output.textContent += "title : " + title; + + var content = jobj.Nodes[root].data.content; +// output.textContent += "content: " + content; + + + + + + + + } + + + +</script> +</body> + +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/viewer/js/library.js Fri Sep 21 17:38:22 2012 +0900 @@ -0,0 +1,15 @@ +function loadFile(file) { + var http=new XMLHttpRequest(); + http.open("GET",file,false); + http.send(); + return http.responseText; +} + + + + + + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/viewer/json/graph.json Fri Sep 21 17:38:22 2012 +0900 @@ -0,0 +1,66 @@ +{ + "root": "Node1", + "Nodes" : { + "Node1" : { + "data" : { + "title" : "GraphDBは使いやすい。", + "content" : "グラフの関係を使った計算がしやすい。" + } + }, + "Node2" : { + "data" : { + "title" : "RDBでもいいじゃない。", + "content" : "RDBには今までの経験がある。" + } + }, + "Node3" : { + "type" : "user", + "data" : { + "name" : "user1" + } + }, + "Node4" : { + "type" : "user", + "data" : { + "name" : "user2" + } + } + }, + + "Relationships" : { + "rel1" : { + "from" : "Node1", + "to" : "Node3", + "type" : "author", + "data" : {} + }, + "rel2" : { + "from" : "Node1", + "to" : "Node4", + "type" : "agreement request", + "data" : { + "state" : "reserve" + } + }, + "rel3" : { + "from" : "Node2", + "to" : "Node1", + "type" : "rebuttle", + "data" : {} + }, + "rel4" : { + "from" : "Node2", + "to" : "Node4", + "type" : "author", + "data" : {} + }, + "rel5" : { + "from" : "Node2", + "to" : "Node3", + "type" : "agreement request", + "data" : { + "state" : "reserve" + } + } + } +}