Sha256: 78b2ab2cfeef1949cf1f5017f12a5a31c1145d7d07c17d252984e85daaf93f7d

Contents?: true

Size: 1.22 KB

Versions: 25

Compression:

Stored size: 1.22 KB

Contents

<!DOCTYPE html>
<html>
  <head>
    <title>Pie Chart</title>
    <script type="text/javascript" src="../../d3.js"></script>
    <script type="text/javascript" src="../../d3.layout.js"></script>
    <style type="text/css">

body {
  font: 10px sans-serif;
}

    </style>
  </head>
  <body>
    <script type="text/javascript">

var w = 400,
    h = 400,
    r = Math.min(w, h) / 2,
    data = d3.range(10).map(Math.random),
    color = d3.scale.category20(),
    donut = d3.layout.pie(),
    arc = d3.svg.arc().innerRadius(r * .6).outerRadius(r);

var vis = d3.select("body")
  .append("svg")
    .data([data])
    .attr("width", w)
    .attr("height", h);

var arcs = vis.selectAll("g.arc")
    .data(donut)
  .enter().append("g")
    .attr("class", "arc")
    .attr("transform", "translate(" + r + "," + r + ")");

arcs.append("path")
    .attr("fill", function(d, i) { return color(i); })
    .attr("d", arc);

arcs.append("text")
    .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; })
    .attr("dy", ".35em")
    .attr("text-anchor", "middle")
    .attr("display", function(d) { return d.value > .15 ? null : "none"; })
    .text(function(d, i) { return d.value.toFixed(2); });

    </script>
  </body>
</html>

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/examples/pie/pie.html