{"id":4711,"date":"2016-02-15T19:47:30","date_gmt":"2016-02-15T10:47:30","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=4711"},"modified":"2016-02-15T19:47:30","modified_gmt":"2016-02-15T10:47:30","slug":"post-4711","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3-js\/4711","title":{"rendered":"\u30cf\u30fc\u30c8\u578b\u306e\u5730\u56f3"},"content":{"rendered":"<p>\u30cf\u30c3\u30d4\u30fc\u30d0\u30ec\u30f3\u30bf\u30a4\u30f3\uff081\u65e5\u9045\u308c\uff09<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Oronce_Fin%C3%A9#\/media\/File:Map-heart-054.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2016\/02\/Map-heart-054.jpg\" alt=\"Map-heart-054\" width=\"590\" height=\"520\" class=\"aligncenter size-full wp-image-4710 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2016\/02\/Map-heart-054.jpg 590w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2016\/02\/Map-heart-054-170x150.jpg 170w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><\/p>\n<p>\u4e0a\u8a18\u306f\u30aa\u30ed\u30f3\u30b9\u30fb\u30d5\u30a3\u30cd(\u30aa\u30ed\u30f3\u30c6\u30a3\u30a6\u30b9\u30fb\u30d5\u30a3\u30cd\u30a6\u30b9)\u3055\u3093\u4f5c\u6210\u306e\u30cf\u30fc\u30c8\u578b\u306e\u5730\u56f3\u3067\u3059\u3002\u3053\u306e\u6642\u671f\u306b\u306a\u308b\u3068\u3001\u3084\u305f\u3089\u3068\u6d77\u5916\u306eGeo\u7cfb\u30d6\u30ed\u30b0\u3067\u898b\u304b\u3051\u308b\u4e00\u90e8\u306e\u4eba\u306b\u3068\u3063\u3066\u306f\u304a\u306a\u3058\u307f\u306e\u5730\u56f3\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u7528\u6027\u306f\u307e\u3063\u305f\u304f\u7121\u3055\u305d\u3046\u306a\u306e\u3067\u3059\u304c\u5f62\u304c\u9762\u767d\u3044\u3067\u3059\u306d\u3002<br \/>\nD3.js\u306b\u3082\u540c\u69d8\u306e\u6295\u5f71\u6cd5\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p>D3.js\u3067<a href=\"https:\/\/ja.wikipedia.org\/wiki\/%E3%83%9C%E3%83%B3%E3%83%8C%E5%9B%B3%E6%B3%95\">\u30dc\u30f3\u30cc\u56f3\u6cd5<\/a>\u3067\u306e\u63cf\u753b\u65b9\u6cd5\u3067\u3059\u3002\u3064\u3044\u3067\u306b\u56de\u8ee2\u3055\u305b\u3066\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/shimz.me\/example\/d3js\/geo_example3\/hartMap\/index.html\" rel=\"attachment wp-att-4712\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2016\/02\/d3hartmap.png\" alt=\"d3 hartmap\" width=\"590\" height=\"525\" class=\"aligncenter size-full wp-image-4712 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2016\/02\/d3hartmap.png 590w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2016\/02\/d3hartmap-169x150.png 169w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/d3js\/geo_example3\/hartMap\/index.html\">example<\/a><\/p>\n<p> D3.js\u306eprojection\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u5fc5\u8981\u306a\u306e\u3067\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:xhtml decode:true \" >&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/d3\/3.5.3\/d3.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/d3-geo-projection\/0.2.9\/d3.geo.projection.min.js\"&gt;&lt;\/script&gt;\r\n<\/pre>\n<pre class=\"lang:js decode:true \" >\/\/\u30dd\u30ea\u30b4\u30f3\u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f\r\nd3.json(\"world.geojson\", function(json) {\r\n    mapdraw(json);\r\n});\r\n \r\nfunction mapdraw(json){\r\n  var width = 960;\r\n  var height = 960;\r\n\t\r\n  var feature = json.features;\t\t\r\n\t \r\n  \/\/\u30dc\u30f3\u30cc\u56f3\u6cd5\u3092\u6307\u5b9a\u3059\u308b\r\n  var projection = d3.geo.bonne()\r\n\t.center([0, 27])\r\n\t.scale(180)\r\n\t.translate([width \/ 2, height \/ 2])\r\n\t.precision(.1);\r\n\r\n  var path = d3.geo.path().projection(projection);\r\n\r\n\t\r\n  var svg = d3.select(\"body\").append('svg')\r\n\t.attr(\"width\", width)\r\n\t.attr(\"height\", height);\r\n\r\n\t\t\r\n  \/*\u5916\u67a0\u63cf\u753b\u7528\u306epath\u8981\u7d20\u3092\u8ffd\u52a0\u3059\u308b*\/\t\r\n  var border = svg.append(\"defs\").append(\"path\")\r\n\t.datum({type: \"Sphere\"})\r\n\t.attr(\"id\", \"sphere\")\r\n\t\r\n  svg.append(\"use\")\r\n\t.attr(\"class\", \"stroke\")\r\n\t.attr(\"xlink:href\", \"#sphere\");\r\n\t\r\n  svg.append(\"use\")\r\n\t.attr(\"class\", \"fill\")\r\n\t.attr(\"xlink:href\", \"#sphere\");\r\n\t  \r\n        \r\n  \/*\u30b0\u30ea\u30c3\u30c9\u63cf\u753b\u7528\u306epath\u8981\u7d20\u3092\u8ffd\u52a0\u3059\u308b*\/\t\r\n  var graticule = d3.geo.graticule();\r\n\r\n  var grid = svg.append(\"path\")\r\n\t.datum(graticule)\r\n\t.attr(\"class\", \"graticule\")\r\n\r\n  \/*\u5927\u9678\u63cf\u753b\u7528\u306epath\u8981\u7d20\u3092\u8ffd\u52a0\u3059\u308b*\/\t        \r\n  var land = svg.selectAll('.land')\r\n\t.data(feature)\r\n\t.enter()\r\n\t.append('path')\r\n\t.attr({\r\n\t\t\"stroke\": \"red\",\r\n\t\t\"fill\": \"pink\"\r\n\t});\r\n\r\n  \/\/\u30d1\u30b9\u3092\u751f\u6210\u3059\u308b\r\n  grid.attr(\"d\", path)\r\n  land.attr(\"d\", path)\r\n  border.attr(\"d\", path)\r\n  \r\n  \/\/x\u8ef8\u3067\u56de\u8ee2\u3055\u305b\u308b\t\r\n  setInterval(rotate(), 100);\t\r\n\t\t\r\n  function rotate(){\r\n\tvar i = 0;\r\n\treturn function(){\r\n\t\tprojection.rotate([i++, 0, 0])\r\n\t\tgrid.attr(\"d\", path)\r\n\t\tland.attr(\"d\", path)\r\n\t}\r\n  }\r\n       \r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30cf\u30c3\u30d4\u30fc\u30d0\u30ec\u30f3\u30bf\u30a4\u30f3\uff081\u65e5\u9045\u308c\uff09 \u4e0a\u8a18\u306f\u30aa\u30ed\u30f3\u30b9\u30fb&hellip;<\/p>\n","protected":false},"author":1,"featured_media":4710,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,66],"tags":[],"class_list":["post-4711","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-d3-js","category-map","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=4711"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/4711\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/4710"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=4711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=4711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=4711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}