{"id":5810,"date":"2018-03-28T17:02:03","date_gmt":"2018-03-28T08:02:03","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=5810"},"modified":"2019-08-26T15:44:00","modified_gmt":"2019-08-26T06:44:00","slug":"d3-js-ver-5%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%80%82","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3v4\/5810","title":{"rendered":"D3.js ver.5\u306b\u3064\u3044\u3066\u3002"},"content":{"rendered":"<p>2018\u5e743\u670822\u65e5\u306bD3.js\u306ever.5\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u5f8c\u65b9\u4e92\u63db\u3092\u3076\u3063\u305f\u65ac\u3063\u3066\u6368\u3066\u305fver.3\u7cfb\u304b\u3089ver.4\u7cfb\u3078\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u6bd4\u3079\u308b\u3068\u3001\u4eca\u56de\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3067ver.4\u7cfb\u3068\u4e92\u63db\u6027\u306e\u306a\u3044\u5909\u66f4\u70b9\u306f\u308f\u305a\u304b\u3067\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u3076\u3063\u3061\u3083\u3051\u3042\u3093\u307e\u308a\u66f8\u304f\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\uff08\u3064\u307e\u3089\u306a\u3044\uff09<\/p>\n<h2>\u5909\u66f4\u70b9<\/h2>\n<p>\u3068\u304f\u306bver.4\u7cfb\u3068\u4e92\u63db\u6027\u306e\u306a\u3044\u5909\u66f4\u70b9\u306b\u3064\u3044\u3066\u3002<\/p>\n<h3>\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u95a2\u6570\u306e\u4ed5\u69d8\u5909\u66f4<\/h3>\n<p>d3.csv\u3084d3.json\u306a\u3069\u3001\u5916\u90e8\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u30d1\u30fc\u30b9\u3092\u884c\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u3068\u5909\u63db\u3057\u3066\u304f\u308c\u308bD3\u306e\u4fbf\u5229\u306a\u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f\u95a2\u6570\u306e\u4ed5\u69d8\u304c\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>ver.\uff14\u3067\u306f\u3001\u8aad\u307f\u8fbc\u3093\u3060\u30c7\u30fc\u30bf\u3092\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3067\u53d7\u3051\u53d6\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001ver.5\u3067\u306f\u3001Promises\u3092\u8fd4\u3059\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" title=\"ver.4\" >d3.csv(\"file.csv\", function(error, data) {\n  if (error) throw error;\n  console.log(data);\n});<\/pre>\n<pre class=\"lang:js decode:true \" title=\"ver.5\"  >d3.csv(\"file.csv\").then(function(data) {\n  console.log(data);\n});<\/pre>\n<p>Promises\u3092\u8fd4\u3059\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u3067await\u3092\u4f7f\u3063\u3066\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" title=\"ver.5\" >async function load() {\n    const res = await d3.csv(\"file.csv\");\n    return res;\n}\n\nconst dataset = load()<\/pre>\n<p>\u5185\u90e8\u7684\u306b\u306fXHR(XMLHttpRequest)\u3092\u4f7f\u3063\u3066\u3044\u305fd3-request\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5ec3\u6b62\u3055\u308c\u3001\u4ee3\u308f\u308a\u306bFetch API\u3092\u4f7f\u3063\u305f d3-fetch\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u5909\u66f4\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3> d3-queue \u304c\u975e\u63a8\u5968\u306b<\/h3>\n<p>\u8907\u6570\u306e\u5916\u90e8\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u306e\u306b\u4fbf\u5229\u3060\u3063\u305f <a href=\"https:\/\/github.com\/d3\/d3-queue\">d3-queue<\/a> \u304c\u975e\u63a8\u5968\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u300c\u666e\u901a\u306bPromise.all\u4f7f\u3046\u304b\u3001\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30d8\u30eb\u30d1\u30fc\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u306a\u308a\u3057\u3066\u300d\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u305d\u3093\u306a\u308f\u3051\u3067\u3001d3-queue\u3092\u4f7f\u3063\u3066\u3044\u305f\u65b9\u306f\u304a\u6c17\u3092\u3064\u3051\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u305d\u306e\u4ed6<\/h3>\n<p>\u30d7\u30e9\u30b0\u30a4\u30f3\u3060\u3063\u305f\u3001d3-contour\u304c\u6a19\u6e96\u306b\u306a\u3063\u305f\u308a\u3001\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30e0\u304cColorBrewer\u30d9\u30fc\u30b9\u306b\u306a\u3063\u305f\u308a\u3068\u5c0f\u3055\u306a\u5909\u66f4\u70b9\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u65e2\u5b58\u306ever.4\u7cfb\u30b3\u30fc\u30c9\u306b\u4e0e\u3048\u308b\u5f71\u97ff\u306f\u307b\u3068\u3093\u3069\u306a\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u8a73\u3057\u304f\u306fchangelog\u3092\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/d3\/d3\/blob\/master\/CHANGES.md#changes-in-d3-50\">d3\/CHANGES.md at master \u00b7 d3\/d3<\/a><\/p>\n<h2>\u3053\u306e\u30d6\u30ed\u30b0\u306e\u30ab\u30c6\u30b4\u30ea\u306b\u3064\u3044\u3066<\/h2>\n<p>D3v4\u30ab\u30c6\u30b4\u30ea\u306e\u540d\u79f0\u3092\u3001<a href=\"https:\/\/gunmagisgeek.com\/blog\/category\/d3v4\">D3v4\/5<\/a>\u30ab\u30c6\u30b4\u30ea\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<br \/>\n\u4e00\u90e8\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3001\u5916\u90e8\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u306b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u4f7f\u3063\u3066\u3044\u308b\u30b3\u30fc\u30c9\u304c\u3042\u308b\u306e\u3067v5\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u305d\u306e\u3042\u305f\u308a\u3092\u6ce8\u610f\u3057\u3066\u3044\u305f\u3060\u3051\u308b\u3068\u52a9\u304b\u308a\u307e\u3059\u3002<br \/>\n\u6700\u7d42\u7684\u306b\u306f\u3001v5\u306b\u6e96\u62e0\u3057\u305f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306b\u5909\u66f4\u3059\u308b\u4e88\u5b9a\u3067\u3059\u304c\u3001v3->v4\u3078\u306e\u4fee\u6b63\u304c\u7d42\u308f\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u3057\u3070\u3089\u304f\u6642\u9593\u304c\u304b\u304b\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2018\u5e743\u670822\u65e5\u306bD3.js\u306ever.5\u304c\u30ea\u30ea&hellip;<\/p>\n","protected":false},"author":1,"featured_media":5033,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[],"class_list":["post-5810","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-d3v4","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/5810","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=5810"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/5810\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/5033"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=5810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=5810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=5810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}