Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active April 1, 2017 01:59
Show Gist options
  • Select an option

  • Save mbostock/2869760 to your computer and use it in GitHub Desktop.

Select an option

Save mbostock/2869760 to your computer and use it in GitHub Desktop.

Revisions

  1. mbostock revised this gist Apr 1, 2017. 4 changed files with 2 additions and 34 deletions.
    2 changes: 1 addition & 1 deletion .block
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    license: gpl-3.0
    redirect: 3757132
    1 change: 0 additions & 1 deletion countries.json
    0 additions, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
    33 changes: 1 addition & 32 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -1,32 +1 @@
    <!DOCTYPE html>
    <meta charset="utf-8">
    <title>Mercator Projection</title>
    <style>

    path {
    fill: #ccc;
    stroke: #fff;
    }

    </style>
    <svg width="960" height="500"></svg>
    <script src="//d3js.org/d3.v3.min.js"></script>
    <script>

    var projection = d3.geo.mercator();

    var path = d3.geo.path()
    .projection(projection);

    var svg = d3.select("svg");

    d3.json("countries.json", function(error, collection) {
    if (error) throw error;

    svg.selectAll("path")
    .data(collection.features)
    .enter().append("path")
    .attr("d", path);
    });

    </script>
    Moved to <a href="/mbostock/3757132">/mbostock/3757132</a>.
    Binary file removed thumbnail.png
    Binary file not shown.
  2. mbostock revised this gist Feb 9, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions .block
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    license: gpl-3.0
  3. mbostock revised this gist Oct 31, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@

    </style>
    <svg width="960" height="500"></svg>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
    <script src="//d3js.org/d3.v3.min.js"></script>
    <script>

    var projection = d3.geo.mercator();
  4. mbostock revised this gist Jun 11, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,8 @@
    var svg = d3.select("svg");

    d3.json("countries.json", function(error, collection) {
    if (error) return console.error(error);
    if (error) throw error;

    svg.selectAll("path")
    .data(collection.features)
    .enter().append("path")
  5. mbostock revised this gist Jun 11, 2015. 3 changed files with 2 additions and 180 deletions.
    1 change: 1 addition & 0 deletions countries.json
    1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@

    var svg = d3.select("svg");

    d3.json("readme.json", function(error, collection) {
    d3.json("countries.json", function(error, collection) {
    if (error) return console.error(error);
    svg.selectAll("path")
    .data(collection.features)
    179 changes: 0 additions & 179 deletions readme.json
    0 additions, 179 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
  6. mbostock revised this gist Jun 11, 2015. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -10,14 +10,22 @@

    </style>
    <svg width="960" height="500"></svg>
    <script src="http://d3js.org/d3.v2.js?2.9.1"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
    <script>

    d3.json("readme.json", function(collection) {
    d3.select("svg").selectAll("path")
    var projection = d3.geo.mercator();

    var path = d3.geo.path()
    .projection(projection);

    var svg = d3.select("svg");

    d3.json("readme.json", function(error, collection) {
    if (error) return console.error(error);
    svg.selectAll("path")
    .data(collection.features)
    .enter().append("path")
    .attr("d", d3.geo.path().projection(d3.geo.mercator()));
    .attr("d", path);
    });

    </script>
  7. mbostock revised this gist Oct 12, 2012. 1 changed file with 0 additions and 0 deletions.
    Binary file added thumbnail.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  8. mbostock revised this gist Jun 4, 2012. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,9 @@
    <script>

    d3.json("readme.json", function(collection) {
    d3.select("svg").append("path")
    .datum(collection)
    d3.select("svg").selectAll("path")
    .data(collection.features)
    .enter().append("path")
    .attr("d", d3.geo.path().projection(d3.geo.mercator()));
    });

  9. mbostock revised this gist Jun 4, 2012. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,8 @@
    <script>

    d3.json("readme.json", function(collection) {
    d3.select("svg").selectAll("path")
    .data(collection.features)
    .enter().append("path")
    d3.select("svg").append("path")
    .datum(collection)
    .attr("d", d3.geo.path().projection(d3.geo.mercator()));
    });

  10. mbostock created this gist Jun 4, 2012.
    23 changes: 23 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <!DOCTYPE html>
    <meta charset="utf-8">
    <title>Mercator Projection</title>
    <style>

    path {
    fill: #ccc;
    stroke: #fff;
    }

    </style>
    <svg width="960" height="500"></svg>
    <script src="http://d3js.org/d3.v2.js?2.9.1"></script>
    <script>

    d3.json("readme.json", function(collection) {
    d3.select("svg").selectAll("path")
    .data(collection.features)
    .enter().append("path")
    .attr("d", d3.geo.path().projection(d3.geo.mercator()));
    });

    </script>
    179 changes: 179 additions & 0 deletions readme.json
    179 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.