Skip to content
This repository was archived by the owner on Nov 7, 2018. It is now read-only.

Expose raw array for hexagon #107

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
Prev Previous commit
d3brokeandmadeart
  • Loading branch information
emeeks committed Jun 4, 2015
commit d23fc8088fc6c0c08bf54ed5faa5eb12d76bdea1
12 changes: 5 additions & 7 deletions adjacencyMatrix/d3.layout.adjacencyMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
}
});

console.log("nodes", nodes, nodes.length)

nodes.forEach(function (sourceNode, a) {
nodes.forEach(function (targetNode, b) {
var grid = {id: nodeID(sourceNode) + "-" + nodeID(targetNode), source: sourceNode, target: targetNode, x: xScale(b), y: yScale(a), weight: 0, height: nodeHeight, width: nodeWidth};
Expand All @@ -51,7 +53,7 @@
edgeWeight = edgeHash[grid.id].weight;
grid.weight = edgeWeight;
};
if (directed === true || grid.x < grid.y) {
if (directed === true || b < a) {
matrix.push(grid);
if (directed === false) {
var mirrorGrid = {id: nodeID(sourceNode) + "-" + nodeID(targetNode), source: sourceNode, target: targetNode, x: xScale(a), y: yScale(b), weight: 0, height: nodeHeight, width: nodeWidth};
Expand All @@ -62,6 +64,8 @@
});
});

console.log("matrix", matrix, matrix.length)

return matrix;
}

Expand All @@ -77,12 +81,6 @@
return matrix;
}

matrix.width = function(x) {
if (!arguments.length) return width;
width = x;
return matrix;
}

matrix.nodes = function(x) {
if (!arguments.length) return nodes;
nodes = x;
Expand Down