Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With all due respect to @mbostock and his answer, I thought I would add some additional resources for anyone coming across this question.</p> <p>The example in the link provided by @Yaron Naveh appears to be a <a href="http://en.wikipedia.org/wiki/Mercator_projection" rel="nofollow" title="Mercator projection">Mercator projection</a>. You can find out more about d3.js' Mercator projection facilities in the <a href="https://github.com/mbostock/d3/wiki/Geo-Projections" rel="nofollow" title="d3.js API - Geo Projections">d3.js API</a>. @mbostock has also been kind enough to create blocks/gists for each of the projections in the API (click on the projection thumbnail image for the example). Here are the links to a simple Mercator projection <a href="http://bl.ocks.org/2869760" rel="nofollow" title="Mercator block">block</a>/<a href="https://gist.github.com/2869760" rel="nofollow" title="Mercator gist">gist</a>.</p> <p>Regarding the "The Art of Asking - How are you feeling?" link, here is a little code to go with what @mbostock said about coloring using the fill style as a function of data. In this example, I am simply picking the unicode value for the first character of the country's name in the JSON file and making a CSS color from that value using "steelblue" (#4682B4 = 4620980) as a sort of seed (you will probably want to calculate shades/tints).</p> <pre><code>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())) .style("fill", function(d) { return '#'+Math.floor(d.properties.name.charCodeAt(0)/100*4620980).toString(16); }); }); </code></pre> <p>You can check out the full example here as a <a href="http://bl.ocks.org/4121134" rel="nofollow" title="Colored block">block</a>/<a href="https://gist.github.com/4121134" rel="nofollow" title="Colored gist">gist</a>.</p> <p>(@mbostock - Thank you for such a great tool!)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload