{"id":2942,"date":"2013-07-17T11:10:38","date_gmt":"2013-07-17T02:10:38","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2942"},"modified":"2013-12-30T21:29:07","modified_gmt":"2013-12-30T12:29:07","slug":"post-2942","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2942","title":{"rendered":"\u3010D3.js\u3011\u30b5\u30a4\u30ba\u306e\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u53ef\u8996\u5316\u3059\u308b\uff08\u30c4\u30ea\u30fc\u30de\u30c3\u30d7\uff09"},"content":{"rendered":"<p><a href=\"http:\/\/shimz.me\/example\/d3js\/treemap\/02\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/filelisttreemap.jpg\" alt=\"filelisttreemap\" width=\"582\" height=\"300\" class=\"aligncenter border size-full wp-image-2946\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/filelisttreemap.jpg 582w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/filelisttreemap-291x150.jpg 291w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/d3js\/treemap\/02\/\">example<\/a><\/p>\n<p>\u4ee5\u524d\u3001<a href=\"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2755\">\u30a2\u30af\u30bb\u30b9\u6d41\u5165\u5143\u3092\u30c4\u30ea\u30fc\u30de\u30c3\u30d7\u3067\u8868\u793a\u3057\u3066\u307f\u305f<\/a>\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30d5\u30a1\u30a4\u30eb\u30ea\u30b9\u30c8\u3092\u53ef\u8996\u5316\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u306b\u6bd4\u4f8b\u3057\u3066\u30d6\u30ed\u30c3\u30af\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3067\u5b9f\u969b\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br \/>\n\u30b5\u30a4\u30ba\u306e\u5927\u304d\u3044\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u6b86\u3069\u304c\u5730\u7406\u60c5\u5831\u30d5\u30a1\u30a4\u30eb(geojson)\u3067\u3057\u305f\u3002<\/p>\n<h2>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u4f5c\u6210<\/h2>\n<p>\u3076\u3063\u3061\u3083\u3051\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3059\u308b\u306e\u304c\u4e00\u756a\u30e1\u30f3\u30c9\u30a6\u3067\u3059\u3002<br \/>\nD3\u306etreemap\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u4ee5\u4e0b\u306e\u5f62\u5f0f\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >{\n\tname:'root',\n\tchildren:[\n\t\tname:'child-dir1'\n\t\t'hoge1.txt',\n\t\t'hoge2.txt',\n\t\tchildren:[\n\t\t\tname:'child-dir2',\n\t\t\t'hello1.txt',\n\t\t\t'hello2.txt'\n\t\t]\n\t},\n\t'file1.txt',\n\t'file2.txt'\n}<\/pre>\n<p>\u624b\u52d5\u3067\u4f5c\u6210\u3059\u308b\u306e\u306f\u5927\u5909\u306a\u306e\u3067\u30d5\u30a1\u30a4\u30eb\u4e00\u89a7\u3092\u51fa\u529b\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092node.js\u3067\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/gunmagisgeek.com\/blog\/node-js\/2944\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u518d\u5e30\u7684\u306b\u305f\u3069\u3063\u3066\u30d5\u30a1\u30a4\u30eb\u4e00\u89a7\u3092JSON\u3068\u3057\u3066\u51fa\u529b\u3059\u308b<\/a><\/p>\n<p>\u4e0a\u8a18\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30b5\u30fc\u30d0\u30fc\u306e\u666e\u6bb5\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u7f6e\u3044\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u5b9f\u884c\u3057\u3066\u51fa\u529b\u3057\u305f\u3082\u306e\u304c\u4e0b\u8a18\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/shimz.me\/example\/d3js\/treemap\/02\/files.json\">files.json<\/a><\/p>\n<p>\u3053\u306e\u30c7\u30fc\u30bf\u5f62\u5f0f(\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)\u306f\u3001D3\u306e\u69d8\u3005\u306a\u30ec\u30a4\u30a2\u30a6\u30c8\u3067\u4f7f\u7528\u3055\u308c\u308b\u306e\u3067\u5909\u63db\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u3063\u3066\u304a\u304f\u3068\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u4f5c\u6210\u304c\u697d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30c4\u30ea\u30fc\u30de\u30c3\u30d7\u306e\u8868\u793a<\/h2>\n<p><a href=\"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2755\">\u524d\u56de\u884c\u3063\u305f\u5185\u5bb9<\/a>\u3068\u7279\u306b\u5909\u308f\u308a\u304c\u306a\u3044\u306e\u3067\u30dd\u30a4\u30f3\u30c8\u3060\u3051\u3002<\/p>\n<p>\u8868\u793a\u3059\u308b\u30b5\u30a4\u30ba(width,height)\u3092\u6307\u5b9a\u3057\u3066treemap\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >var treemap = d3.layout.treemap().size([w, h]);\n<\/pre>\n<p>\u4f5c\u6210\u3057\u305f\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8(json)\u3092\u8aad\u307f\u8fbc\u307f\u3001treemap\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u306b\u6e21\u3057\u307e\u3059\u3002value\u30e1\u30bd\u30c3\u30c9\u3067\u30d6\u30ed\u30c3\u30af\u306e\u30b5\u30a4\u30ba\u3092\u6c7a\u5b9a\u3059\u308b\u30c7\u30fc\u30bf\u8981\u7d20\u3092\u6307\u5b9a\u3057\u3001nodes\u30e1\u30bd\u30c3\u30c9\u3067\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >d3.json('files.json', function(data){\n\tvar treemapData = treemap.value(function(d){  return d.size}\u3000).nodes(data);\n\tconsole.log(treemapData);\n});\n<\/pre>\n<p>treemap\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u306e\u623b\u308a\u5024\u306f\u3001\u5143\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306bx(x\u5ea7\u6a19)\u3001y(y\u5ea7\u6a19)\u3001dx(\u5e45)\u3001dy(\u9ad8\u3055)\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u4ed8\u52a0\u3055\u308c\u305f\u3082\u306e\u304c\u8fd4\u308a\u307e\u3059\u3002<br \/>\n\u5f8c\u306f\u3053\u306e\u30c7\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066rect\u8981\u7d20\u3092\u63cf\u753b\u3059\u308b\u3068\u30c4\u30ea\u30fc\u30de\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n \u3010\u4f59\u8ac7\u3011<br \/>\n\u30c7\u30fc\u30bf\u6570\u304c\u591a\u3044\u3068\u30e9\u30d9\u30eb\u304c\u91cd\u306a\u3063\u3066\u898b\u96e3\u304f\u306a\u308a\u307e\u3059\u3002\u4eca\u56de\u306f2MB\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u30e9\u30d9\u30eb\u3092\u8868\u793a\u3057\u306a\u3044\u3053\u3068\u3067\u56de\u907f\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3082\u3063\u3068\u3001\u4e0a\u624b\u3044\u898b\u305b\u65b9\u304c\u3067\u304d\u308b\u3068\u826f\u3044\u306e\u3067\u3059\u304c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>example \u4ee5\u524d\u3001\u30a2\u30af\u30bb\u30b9\u6d41\u5165\u5143\u3092\u30c4\u30ea\u30fc\u30de\u30c3\u30d7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2946,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-2942","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-d3-js","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2942","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=2942"}],"version-history":[{"count":1,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2942\/revisions"}],"predecessor-version":[{"id":2947,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2942\/revisions\/2947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/2946"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}