Skip to content

Commit

Permalink
minor style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
capan committed Nov 29, 2018
1 parent 5bb25ef commit 446d0e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
11 changes: 8 additions & 3 deletions f_force.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ var node = svg.append("g")
.selectAll("circle")
.data(graph.nodes)
.enter().append("circle")
.attr("r", 3)
.attr("r", 4)
.attr("fill", function (d, i) { return color(d.source); })
.call(d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended));

// node.append("title")
// .text(function (d) { return d.name; });
node.on("mouseover", function (d) {
var result;
document.getElementById("nameText").innerHTML = d.name.split(' ')[0];
result = graph.links.filter(word => word.source === d.index);
console.log(result);
});

simulation
Expand Down Expand Up @@ -69,4 +70,8 @@ function dragended(d) {
if (!d3.event.active) simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
}

function returnConnections(i) {

}
28 changes: 12 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>The d3 test</title>
<style>
.chart {
background-color: aliceblue;
background-color: transparent;
}

.main text {
Expand All @@ -26,6 +26,8 @@
}
svg {
position: absolute;
fill: transparent;

}
</style>

Expand All @@ -35,25 +37,19 @@
</head>

<body>
<div style={{
backgroundColor: 'lightpink',
resize: 'horizontal',
overflow: 'hidden',
width: '1000px',
height: 'auto',


}}>
<svg width="1500" height="1000" viewbox="0 0 1200 1200" preserveAspectRatio="xMidYMid meet"></svg>
</div>
<svg width="1500" height="1000" viewbox="0 0 1200 1200" preserveAspectRatio="xMidYMid meet">

<svg height="30" width="200">
<style>
.nameText{ font: italic 40px serif; fill: red; }
</style>
<text id="nameText" class="nameText" x="50" y="50" fill="red">Move mouse over the dots!</text>
.nameText{ font: bold 30px sans-serif; }
</style>
<text id="nameText" class="nameText" x="50" y="50" fill="black">Move mouse over the dots!</text>
Sorry, your browser does not support inline SVG.
</svg>


<svg height="30" width="200">

</svg>
<script src="gra.js"></script>
<script type="text/javascript" src="f_force.js"></script>
</body>
Expand Down

0 comments on commit 446d0e9

Please sign in to comment.