Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
93dc51a
baseline for the new update pattern code to display the subnet graph
TimeBandit Jun 16, 2015
ce00903
first draft of update code
TimeBandit Jun 16, 2015
0e85b7f
can display graph but updates are buggy
TimeBandit Jun 18, 2015
00f18d6
complete re-write based on closures, http://bost.ocks.org/mike/chart/
TimeBandit Jun 19, 2015
9d442c6
re-write with custom Array method
TimeBandit Jun 20, 2015
9f0fe1e
debug phase
TimeBandit Jun 21, 2015
a076562
a few minor bug fixes, layout not rendering correctly but nodes visible
TimeBandit Jun 22, 2015
69b1fca
looking for bug with bad px/py values, error seems to be only restric…
TimeBandit Jun 23, 2015
f0620fe
sub section now working, nodes will re-render epending on which node …
TimeBandit Jun 24, 2015
1bd0430
cleanup
TimeBandit Jun 24, 2015
60b0736
new subnet extractor using recursive method, in working order
TimeBandit Jun 25, 2015
539b709
cleanup of code - WORKING CODE
TimeBandit Jun 25, 2015
c067146
removed epdate after every node addition, all nodes added at once an…
TimeBandit Jun 26, 2015
2b252c3
minor experiments
TimeBandit Jun 28, 2015
2aa0c58
centrering nodes for stability
TimeBandit Jun 30, 2015
526b574
added code for week tree structure
TimeBandit Jun 30, 2015
bffe540
tweaks
TimeBandit Jun 30, 2015
aed8ea3
working baseline
TimeBandit Jun 30, 2015
669d882
cleanup
TimeBandit Jul 3, 2015
87ca761
cleanup
TimeBandit Jul 3, 2015
72f86d8
working baseline
TimeBandit Jul 3, 2015
ae33df6
Merge branch 'master' of https://github.com/TimeBandit/graphSub
TimeBandit Jul 3, 2015
739d092
initial version
TimeBandit Jul 4, 2015
74d529b
Merge pull request #2 from TimeBandit/floating-labels
TimeBandit Jul 4, 2015
ea50f32
made labels clickable
TimeBandit Jul 7, 2015
017e16a
working clickable nodes
TimeBandit Jul 7, 2015
42eda93
Merge branch 'master' of https://github.com/TimeBandit/graphSub
TimeBandit Jul 7, 2015
eecbe07
resolved minor conflicts
TimeBandit Jul 7, 2015
63bc174
Merge pull request #3 from TimeBandit/clickable-text-labels
TimeBandit Jul 7, 2015
a79f8a5
no changes
TimeBandit Jul 7, 2015
254bdf4
cleanup, working order
TimeBandit Jul 7, 2015
7e0ca5c
began adding floating labels, not working
TimeBandit Jul 7, 2015
d32d47c
began adding floating labels, not working
TimeBandit Jul 8, 2015
544cb93
floating labels rendering but not transforming to position in force1
TimeBandit Jul 10, 2015
8317917
not working
TimeBandit Jul 11, 2015
af0aae1
debugging
TimeBandit Jul 12, 2015
f00c388
completed floating labels
TimeBandit Jul 12, 2015
1df0bd7
made floating labels clickable, graph also initialises correctly
TimeBandit Jul 12, 2015
876dbac
made changes to sample data in fm.json
TimeBandit Jul 12, 2015
8b1db5a
Merge pull request #4 from TimeBandit/floating-labels
TimeBandit Jul 12, 2015
35548f6
added some code for paths and arrows
TimeBandit Jul 13, 2015
8b37942
nothing to see hear
TimeBandit Jul 14, 2015
5fadb74
nothing to see here
TimeBandit Jul 14, 2015
71d906e
completed arrows feature
TimeBandit Jul 15, 2015
3c1051b
Merge pull request #5 from TimeBandit/arrows
TimeBandit Jul 15, 2015
acd6399
removed redundant transitions
TimeBandit Jul 15, 2015
7a332ad
further cleanup
TimeBandit Jul 15, 2015
0959d26
added sources used to readme file
TimeBandit Jul 15, 2015
9aa694c
added line breaks to readme file
TimeBandit Jul 15, 2015
c2428f7
corrected
TimeBandit Jul 15, 2015
2617b61
more sources added
TimeBandit Jul 15, 2015
a7ade9a
description updated
TimeBandit Jul 15, 2015
0c340fd
description updated
TimeBandit Jul 15, 2015
9e93212
removal of redundant code
TimeBandit Jul 16, 2015
6bfe659
nothing to see here
TimeBandit Jul 16, 2015
e8fc41e
began live search code
TimeBandit Jul 16, 2015
2e4cb27
nothing to see here
TimeBandit Jul 18, 2015
0d811b2
first working draft complete
TimeBandit Jul 18, 2015
7d9e245
Merge pull request #6 from TimeBandit/live-search
TimeBandit Jul 18, 2015
780ce49
search box value now updates to name of clicked node
TimeBandit Jul 18, 2015
6d9536d
began work to move to resuable chart structure
TimeBandit Jul 23, 2015
605122b
nothing to see here
TimeBandit Jul 24, 2015
72fd349
restructuring code to MVC format to make it easier to manage
TimeBandit Jul 25, 2015
d1ac682
completed refactor of code into a reusable chart
TimeBandit Jul 26, 2015
7bc114a
Merge pull request #7 from TimeBandit/reusable-chart
TimeBandit Jul 26, 2015
179f4d8
fixed typo
TimeBandit Jul 26, 2015
a7bff8e
add line gradients to the DOM for the node links, also experimented w…
TimeBandit Jul 27, 2015
0fec7ac
some minor adjustments
TimeBandit Jul 27, 2015
67b0d3e
added first draft of code for label background colors
TimeBandit Jul 28, 2015
62ca79d
nothing to see here
TimeBandit Aug 3, 2015
5799877
added coloured background box to text nodes
TimeBandit Aug 5, 2015
b4f0554
first draft of grphi json reader
TimeBandit Aug 5, 2015
e790e90
creating clean versions of nodes from json data, cleaned up car names…
TimeBandit Aug 6, 2015
59a1ffc
minor changes
TimeBandit Aug 6, 2015
0c56e8f
created git ignore file
TimeBandit Aug 7, 2015
b91a8f0
comments added
TimeBandit Aug 8, 2015
198a6e0
linear gradiens cant be seen on tablets, changes links to lines instead
TimeBandit Aug 10, 2015
086777b
minor changes
TimeBandit Aug 12, 2015
f898640
updated file to match project page
TimeBandit Aug 17, 2015
7e8ea13
code wrapped in an IIFE to prevent polution of global namespace
TimeBandit Sep 2, 2015
2512ad6
Merge branch 'master' of https://github.com/TimeBandit/graphSub
TimeBandit Sep 2, 2015
22ec3b6
block.ord demo not working
TimeBandit Apr 29, 2016
d23bbe0
Update underscore-min.js
TimeBandit Jul 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/temp
65 changes: 62 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,67 @@
| (_| | | | (_| | |_) | | | |___) | |_| | |_) |
\__, |_| \__,_| .__/|_| |_|____/ \__,_|_.__/
|___/ |_|

</pre>

graphSub is a Javasctipt module for extracting
a subset of a larger graph defined as per the
force directed graph examples given in d3js.
graphSub is a re-usable force directed chart for displaying connected data. Written in Javascript with the [d3js](http://d3js.org) library. It has some cool features rolled in.

### Featues include:
* Display graph subsets. Given a data-set with 1000+ nodes, displaying all nodes at once can clutter your screen. With graphSub you can display only a subset of your data-set whilst being able to navigate through the entire data-set with mouse clicks.
* The search box feature allows you to quickly locate the node that you are interested in.
* None over-lapping labels means that node labels do not obscure each other.
* Works on touch screens.
* The responsive chart resizes upon a browser resize.
* The code uses an MVC architecture, making future development easier to manage.
* More features to be added....

### Instructions:

The following code can be found at the end of static/js/graphsub.js please modify it to suit your needs.
Your data must follow the format given in the example data-set. This can be found in /data/miserables.json
More information on d3s' force layouts can be found [here](https://github.com/mbostock/d3/wiki/Force-Layout#force).


/*----------------------------------------------------------------------------`
The code example below:
1. Loads the JSON data.
2. Sets the width to 760px.
3. Set the height to 500px.
4. Displays all nodes within 2 hops of the selected node.
5. Attaches the chart to the DOM element with id #chart
*/

d3.json("data/miserables.json", function(error, graph) {
if (error) throw error;

// Parse JSON into the correct format if needed

var chart = d3.graphSub()
.width(760)
.height(500)
.hops(2);

d3.select("#chart")
.datum(graph)
.call(chart);
});

Want to contribute a bug fix or enhancement; then feel free to clone the repository and make a pull request.

****A working example can be seen by downloading the repo and opening index.html****

Example bl.ock.s used in the development of this graph:

[Simple example of reusable d3 plugin](http://bl.ocks.org/cpbotha/5073718)

[Force-based label placement](http://bl.ocks.org/MoritzStefaner/1377729)

[Force-Directed Graph](http://bl.ocks.org/mbostock/4062045)

[General Update Pattern, I](http://bl.ocks.org/mbostock/3808218)

[General Update Pattern, II](http://bl.ocks.org/mbostock/3808221)

[General Update Pattern, III](http://bl.ocks.org/mbostock/3808234)

[Animating Changes in Force Diagram](http://bl.ocks.org/ericcoopey/6c602d7cb14b25c179a4)
42 changes: 21 additions & 21 deletions data/fm.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
{
"nodes":[
{"name":"a"},
{"name":"b"},
{"name":"c"},
{"name":"d"},
{"name":"e"},
{"name":"f"},
{"name":"g"},
{"name":"h"},
{"name":"i"},
{"name":"j"},
{"name":"k"},
{"name":"l"},
{"name":"m"},
{"name":"n"}
{"name":"a-asdasdasd", "group":1},
{"name":"b-dfgdfgdfg", "group":2},
{"name":"c-hjfghjfgj", "group":3},
{"name":"d-sthdfhdfg", "group":4},
{"name":"e-vbncvbvcb", "group":5},
{"name":"f-qwerqwere", "group":6},
{"name":"g-xfgxfgdff", "group":7},
{"name":"h-sdfghdfhd", "group":1},
{"name":"i-arsargfas", "group":2},
{"name":"j-hdgfhdgfh", "group":3},
{"name":"k-asefasdfd", "group":4},
{"name":"l-sthsdhgsd", "group":5},
{"name":"m-awsefraea", "group":6},
{"name":"n-rtyhrthyt", "group":7}
],
"links":[
{"source":0,"target":1,"value":1},
{"source":0,"target":5,"value":1},
{"source":0,"target":6,"value":1},
{"source":0,"target":7,"value":1},
{"source":1,"target":5,"value":1},
{"source":1,"target":6,"value":1},
{"source":1,"target":7,"value":1},
{"source":2,"target":3,"value":1},
{"source":4,"target":5,"value":1},
{"source":7,"target":8,"value":1},
{"source":9,"target":10,"value":1},
{"source":11,"target":12,"value":1},
{"source":0,"target":5,"value":1},
{"source":1,"target":5,"value":1},
{"source":0,"target":6,"value":1},
{"source":1,"target":6,"value":1},
{"source":0,"target":7,"value":1},
{"source":1,"target":7,"value":1},
{"source":2,"target":8,"value":1},
{"source":3,"target":8,"value":1},
{"source":2,"target":9,"value":1},
{"source":3,"target":8,"value":1},
{"source":3,"target":9,"value":1},
{"source":4,"target":11,"value":1},
{"source":5,"target":11,"value":1},
Expand Down
95 changes: 0 additions & 95 deletions graphSub.html

This file was deleted.

62 changes: 62 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>graphSub</title>
<title>Animating Changes in Force Diagram</title>
<script src="http://d3js.org/d3.v3.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<style>
.link {
stroke-width: 4px;
}

.node {
stroke: #fff;
stroke-width: 2px;
}

.textClass {
stroke: #23232;
font-family: "Arial", "Liberation Sans", Arial, Helvetica, sans-serif;
font-weight: bold;

stroke-width: 3;
font-size: 20px;

}

#licensing {
fill: green;
}

.link.licensing {
stroke: green;
}

#chart, .ui-widget {
border-style: solid;
border-width: 2px;
border-color: white;
}

body {
background-color: white;
}
</style>
</head>
<body>
<div class="ui-widget">
<label for="search">Search: </label>
<input id="search">
</div>
<div id="chart">
</div>
</body>
<script src="static/js/g2j4d3.js"></script>
<script src="static/js/graphSub.js"></script>
</html>
68 changes: 0 additions & 68 deletions miserables.html

This file was deleted.

Loading