Permalink
Browse files

much better

  • Loading branch information...
1 parent e4b47b6 commit e713ff50e30b98c0d37bbf82294e9ffd21338a16 @maxdemarzi committed Mar 26, 2012
Showing with 8 additions and 54 deletions.
  1. +3 −8 hive_plot.rb
  2. +2 −43 public/lib_data.js
  3. +3 −3 public/lib_mouse.js
View
@@ -26,7 +26,7 @@ def forkedrepos(language)
temp_writers = []
wroterepos(params[:name]).each_pair do |key, value|
- repos << {"name" => key, "imports" => value}
+ repos << {"name" => key, "imports" => value, "node_type" => "repo"}
temp_writers << { "name" => value[0] }
end
@@ -39,17 +39,12 @@ def forkedrepos(language)
end
temp_writers.group_by {|i| i["name"]}.each do |w, f|
- writers << {"name" => w, "imports" => f.collect{|y| y["imports"]}.flatten.uniq}
+ writers << {"name" => w, "imports" => f.collect{|y| y["imports"]}.flatten.uniq, "node_type" => "worker"}
end
- puts writers.inspect # collect{|y| y["name"]}.inspect
-
temp_forkers.flatten.uniq.delete_if{|x| writers.collect{|y| y["name"]}.include?(x)}.each do |f|
- forkers << {"name" => f, "imports" => []}
+ forkers << {"name" => f, "imports" => [], "node_type" => "forker"}
end
- puts "-------------------"
- puts forkers.inspect
(repos + writers + forkers).to_json
-
end
View
@@ -6,20 +6,6 @@ var prep_data = function(plot_info, nodes) {
var g = plot_info.global
g.nodes = nodes;
- /*
- The input data file, flare-imports.json, is firmly rooted in the
- problem domain. It uses a list of hashes (aka objects) to define
- a directed graph. Each hash defines a software module, giving its
- name, size, and a list of names for modules it imports.
-
- g.nodes = [
- { "name": "flare.analytics.cluster.AgglomerativeCluster",
- "size": 3938,
- "imports": [ "flare.animate.Transitioner", ... ]
- }, ...
- ];
- */
-
var check_nodes = function(nodes) {
var defined = {};
@@ -60,35 +46,13 @@ var prep_data = function(plot_info, nodes) {
var index_by_node_name = function(d) {
d.connectors = [];
- d.packageName = d.name.split('.')[1];
+ d.packageName = d.node_type;
g.nodesByName[d.name] = d;
};
g.nodesByName = {};
g.nodes.forEach(index_by_node_name);
- /* Convert the import lists into links with sources and targets.
- Save an index hash for looking up sources.
-
- g.links = [
- {
- "source": {
- "degree": 0,
- "node": <nodesByName object>,
- "type": "source"
- },
-
- "target": {
- "degree": 0,
- "node": <nodesByName object>,
- "type": "source-target"
- }, ... ];
-
- g.sources = {
- <target name>: <source name>, ...
- }
- */
-
var do_source = function(source) {
var do_target = function(targetName) {
@@ -157,11 +121,6 @@ var prep_data = function(plot_info, nodes) {
.sortKeys(d3.ascending)
.entries(nodes);
- // Duplicate the target-source axis as source-target.
-
- g.nodesByType.push({ key: 'source-target',
- values: g.nodesByType[2].values });
-
// Compute the rank for each type, with padding between packages.
var type_rank = function(type) {
@@ -185,7 +144,7 @@ var prep_data = function(plot_info, nodes) {
// Console logging calls.
- if (false) {
+ if (true) {
console.log('g.links', g.links); //T
console.log('g.nodes', g.nodes); //T
console.log('g.nodesByType', g.nodesByType); //T
View
@@ -29,9 +29,9 @@ var setup_mouse = function(plot_info) {
if (!html_inp) return '';
if (css_class == 'ib')
- hdr = '<h4 class="ib">Imported by:</h4>';
+ hdr = '<h4 class="ib">Connected by:</h4>';
else
- hdr = '<h4 class="im">Imports:</h4>';
+ hdr = '<h4 class="im">Connected:</h4>';
return '<span class="' + css_class+ '">'
+ hdr + html_inp + '</span>';
@@ -76,7 +76,7 @@ var setup_mouse = function(plot_info) {
var html_ib = on_mouseover_h('ib', sources);
var html_im = on_mouseover_h('im', targets);
- var html = '<h3>Node:</h3>' + d.node.name
+ var html = '<h3>Node:</h3>' + d.node.name
+ html_ib + html_im;
notes.html(html);

0 comments on commit e713ff5

Please sign in to comment.