source: Dev/branches/jQueryUI/d3/examples/delaunay/delaunay.html @ 244

Last change on this file since 244 was 76, checked in by fpvanagthoven, 14 years ago

d3

File size: 1003 bytes
Line 
1<!DOCTYPE html>
2<html>
3  <head>
4    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
5    <title>Delaunay Triangulation</title>
6    <script type="text/javascript" src="../../d3.js"></script>
7    <script type="text/javascript" src="../../d3.geom.js"></script>
8    <style type="text/css">
9
10@import url("../../lib/colorbrewer/colorbrewer.css");
11
12path {
13  stroke: #000;
14  stroke-width: .5px;
15}
16
17    </style>
18  </head>
19  <body>
20    <script type="text/javascript">
21
22var w = 960,
23    h = 500;
24
25var vertices = d3.range(500).map(function(d) {
26  return [Math.random() * w, Math.random() * h];
27});
28
29var svg = d3.select("body")
30  .append("svg:svg")
31    .attr("width", w)
32    .attr("height", h)
33    .attr("class", "PiYG");
34
35svg.append("svg:g")
36  .selectAll("path")
37    .data(d3.geom.delaunay(vertices))
38  .enter().append("svg:path")
39    .attr("class", function(d, i) { return "q" + (i % 9) + "-9"; })
40    .attr("d", function(d) { return "M" + d.join("L") + "Z"; });
41
42    </script>
43  </body>
44</html>
Note: See TracBrowser for help on using the repository browser.