{"id":2960,"date":"2013-07-23T10:55:32","date_gmt":"2013-07-23T01:55:32","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=2960"},"modified":"2017-02-03T01:19:41","modified_gmt":"2017-02-02T16:19:41","slug":"post-2960","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2960","title":{"rendered":"\u3010D3.js\u3011NHK\u306e\u53c2\u8b70\u9662\u9078\u6319\u30b5\u30a4\u30c8\u3067\u4f7f\u7528\u3055\u308c\u3066\u3044\u305f\u8b0e\u30b0\u30e9\u30d5(Chord graph)\u7684\u306a\u3082\u306e\u3092\u4f5c\u3063\u3066\u307f\u308b\u3002"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/chordgraph.jpg\" alt=\"chordgraph\" width=\"500\" height=\"492\" class=\"aligncenter size-full wp-image-2961\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/chordgraph.jpg 500w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/chordgraph-152x150.jpg 152w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306a\u56f3\u3092\u300cChord graph(\u30b3\u30fc\u30c9\u30b0\u30e9\u30d5)\u300d\u3068\u3044\u3046\u3089\u3057\u3044\u3067\u3059\u3002\u65e5\u672c\u8a9e\u306b\u76f4\u3059\u3068\u5f26\u30b0\u30e9\u30d5\u3067\u3059\u304b\u306d\uff1fD3.js\u306b\u306fChord\u30ec\u30a4\u30a2\u30a6\u30c8\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u4f5c\u6210\u3059\u308b\u306e\u306f\u6bd4\u8f03\u7684\u7c21\u5358\u3067\u3059\u3002\u9811\u5f35\u308c\u3070<span class=\"removed_link\" title=\"http:\/\/www3.nhk.or.jp\/senkyo\/#\">NHK\u306e\u53c2\u8b70\u9662\u9078\u6319\u30b5\u30a4\u30c8<\/span>\u3067\u4f7f\u308f\u308c\u3066\u3044\u305f\u30ab\u30c3\u30b3\u30a4\u30a4\uff01\u30b0\u30e9\u30d5\u3082\u4f5c\u308c\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/test000002.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/test000002-150x150.jpg\" alt=\"test000002\" width=\"150\" height=\"150\" class=\"aligncenter size-thumbnail wp-image-2962\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/test000002-150x150.jpg 150w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2013\/07\/test000002-100x100.jpg 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"lang:js decode:true \" >var svg = d3.select(&quot;svg&quot;)\r\n\r\n\/\/\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u4f5c\u6210\r\ndataLength = 12; \r\nvar data = d3.range(dataLength).map(function() {\r\n\treturn d3.range(dataLength).map(function(){ return Math.floor(Math.random() *dataLength) })\r\n});\r\n\/\/console.log(data);\r\n\r\n\/\/\u30ab\u30e9\u30fc\u30b9\u30b1\u30fc\u30eb\r\nvar color = d3.scale.category20();\r\n\r\n\/\/chord\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u751f\u6210\r\nvar chord = d3.layout.chord()\r\n\t.padding(0.1)\/\/\u30c7\u30fc\u30bf\u675f\u9593\u306e\u9699\u9593\r\n\t.matrix(data);\r\n\r\n\/\/chord\u5168\u4f53\r\nvar chordGroup = svg.append('g')\r\n\t.attr(&quot;transform&quot;, &quot;translate(&quot;+[400, 400]+&quot;)&quot; );\r\n\r\n\/\/\u5916\u5186\r\nchordGroup.selectAll(&quot;path.groups&quot;)\r\n\t.data(chord.groups)\r\n\t.enter()\r\n\t.append(&quot;path&quot;)\r\n\t.attr({\r\n\t\t&quot;fill&quot;: function(d) { return color(d.index); },\r\n\t\t&quot;stroke&quot;: function(d) { return color(d.index); },\r\n\t\t&quot;d&quot;: d3.svg.arc().innerRadius(350).outerRadius(400),\r\n\t});\r\n\r\n\r\n\/\/\u30c7\u30fc\u30bf\u9593\u306e\u30ea\u30f3\u30af\r\nchordGroup.selectAll(&quot;path.chord&quot;)\r\n\t.data(chord.chords)\r\n\t.enter()\r\n\t.append(&quot;path&quot;)\r\n\t.attr({\r\n\t\t&quot;fill&quot;: function(d) { return color(d.source.index); },\r\n\t\t&quot;d&quot;: d3.svg.chord().radius(400),\r\n\t\t&quot;opacity&quot;: 0.5\r\n\t})\r\n\t.on('mouseover', function(){\r\n\t\td3.select(this).attr({\r\n\t\t\t'fill': &quot;red&quot;,\r\n\t\t\t&quot;opacity&quot;: 1\r\n\t\t});\r\n\t})\r\n\t.on('mouseout', function(){\r\n\t\td3.select(this).attr({\r\n\t\t\t'fill':  function(d) { return color(d.source.index); },\r\n\t\t\t&quot;opacity&quot;: 0.5\r\n\t\t});\r\n\t});\r\n<\/pre>\n<p>\u300c\u30c7\u30fc\u30bf\u306e\u95a2\u9023\u6027\u3084\u76f8\u95a2\u95a2\u4fc2\u3092\u8868\u3059\u306e\u306b\u9069\u3057\u305f\u56f3\u300d\u3089\u3057\u3044\u306e\u3067\u3059\u304c\u2026\u2026\u3076\u3063\u3061\u3083\u3051\u3053\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u3063\u3066\u305d\u3093\u306a\u306b\u898b\u3084\u3059\u304f\u306f\u306a\u3044\u3068\u601d\u3046\u3093\u3067\u3059\u3088\u306d\u30fc\u3002<\/p>\n<blockquote><p>\u76ee\u7684\u3092\u982d\u306b\u7f6e\u304d\u7d9a\u3051\u307e\u3057\u3087\u3046\u3002\u305d\u308c\u304c\u8a66\u91d1\u77f3\u3068\u306a\u308a\u3001\u5c0e\u304d\u306e\u5149\u3068\u306a\u308a\u307e\u3059\u3002<strong>\u5186\u5f62\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u3068\u3044\u3046\u8a98\u60d1<\/strong>\u306e\u8a00\u8449\u3084\u3001\u8ffd\u52a0\u30c7\u30fc\u30bf\u306e\u8a98\u60d1\u306b\u3001\u300c\u3067\u304d\u308b\u306e\u3060\u304b\u3089\u300d\u3068\u3055\u3055\u3084\u304f\u507d\u9810\u8a00\u8005\u306b\u60d1\u308f\u3055\u308c\u305d\u3046\u306b\u306a\u3063\u305f\u3089\u3001\u76ee\u7684\u3092\u601d\u3044\u51fa\u3057\u307e\u3057\u3087\u3046\u3002\u3053\u308c\u3089\u306f\u65c5\u306e\u969c\u5bb3\u3067\u3059\u3002<br \/>\n<br \/>\n<a href=\"http:\/\/www.oreilly.co.jp\/books\/9784873115429\/\">\u30c7\u30b6\u30a4\u30cb\u30f3\u30b0\u30fb\u30c7\u30fc\u30bf\u30d3\u30b8\u30e5\u30a2\u30e9\u30a4\u30bc\u30fc\u30b7\u30e7\u30f3<\/a>\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u8a18\u306e\u3088\u3046\u306a\u56f3\u3092\u300cChord graph(\u30b3\u30fc\u30c9\u30b0&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2961,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-2960","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\/2960","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=2960"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/2960\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/2961"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=2960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=2960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=2960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}