Browse files

Remove force-html example.

  • Loading branch information...
1 parent 626dd3a commit 3208345a27c972616b784dd38de73e77fac1c0cd @mbostock mbostock committed Dec 20, 2012
Showing with 0 additions and 89 deletions.
  1. +0 −89 examples/force/force-html.html
View
89 examples/force/force-html.html
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Force-Directed Layout</title>
-<style>
-
-div.node {
- border-radius: 6px;
- width: 12px;
- height: 12px;
- margin: -6px 0 0 -6px;
- position: absolute;
-}
-
-div.link {
- position: absolute;
- border-bottom: solid #999 1px;
- height: 0;
- -webkit-transform-origin: 0 0;
- -moz-transform-origin: 0 0;
- -ms-transform-origin: 0 0;
- -o-transform-origin: 0 0;
- transform-origin: 0 0;
-}
-
-</style>
-<body>
-<script src="../../d3.js"></script>
-<script>
-
-var width = 960,
- height = 500,
- radius = 6,
- fill = d3.scale.category20();
-
-var force = d3.layout.force()
- .charge(-120)
- .linkDistance(30)
- .size([width, height]);
-
-var svg = d3.select("body").append("div")
- .style("width", width + "px")
- .style("height", height + "px");
-
-d3.json("miserables.json", function(error, json) {
- var link = svg.selectAll("div.link")
- .data(json.links)
- .enter().append("div")
- .attr("class", "link");
-
- var node = svg.selectAll("div.node")
- .data(json.nodes)
- .enter().append("div")
- .attr("class", "node")
- .style("background", function(d) { return fill(d.group); })
- .style("border-color", function(d) { return d3.rgb(fill(d.group)).darker(); })
- .call(force.drag);
-
- force
- .nodes(json.nodes)
- .links(json.links)
- .on("tick", tick)
- .start();
-
- function tick() {
- node.style("left", function(d) { return (d.x = Math.max(radius, Math.min(width - radius, d.x))) + "px"; })
- .style("top", function(d) { return (d.y = Math.max(radius, Math.min(height - radius, d.y))) + "px"; });
-
- link.style("left", function(d) { return d.source.x + "px"; })
- .style("top", function(d) { return d.source.y + "px"; })
- .style("width", length)
- .style("-webkit-transform", transform)
- .style("-moz-transform", transform)
- .style("-ms-transform", transform)
- .style("-o-transform", transform)
- .style("transform", transform);
- }
-
- function transform(d) {
- return "rotate(" + Math.atan2(d.target.y - d.source.y, d.target.x - d.source.x) * 180 / Math.PI + "deg)";
- }
-
- function length(d) {
- var dx = d.target.x - d.source.x,
- dy = d.target.y - d.source.y;
- return Math.sqrt(dx * dx + dy * dy) + "px";
- }
-});
-
-</script>

0 comments on commit 3208345

Please sign in to comment.