{"id":1133,"date":"2012-07-18T20:23:43","date_gmt":"2012-07-18T11:23:43","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=1133"},"modified":"2017-09-13T10:23:21","modified_gmt":"2017-09-13T01:23:21","slug":"post-1133","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3-js\/1133","title":{"rendered":"\u3010D3.js\u3011 \u30ef\u30fc\u30c9\u30af\u30e9\u30a6\u30c9\u3000\u300cd3-cloud\u300d\u30d7\u30e9\u30b0\u30a4\u30f3"},"content":{"rendered":"<p>\u3010\u8ffd\u8a18\u3011<br \/>\n\u30d0\u30fc\u30b8\u30e7\u30f3\u4e0a\u304c\u3063\u3066\u52d5\u304b\u306a\u304f\u306a\u3063\u305f\u307f\u305f\u3044\u306a\u306e\u3067\u3001\u4ee5\u4e0b\u3092\u3069\u3046\u305e\u3002<br \/>\n<a href=\"https:\/\/gunmagisgeek.com\/blog\/d3-js\/2711\">\u3010D3.js\u3011\u300c\u5168\u30c4\u30a4\u30fc\u30c8\u5c65\u6b74\u300d\u304b\u3089Word cloud\u3092\u4f5c\u3063\u3066\u307f\u305f\u3002<\/a><\/p>\n<hr>\n<p><a href=\"https:\/\/github.com\/jasondavies\/d3-cloud\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/07\/687474703a2f2f7777772e6a61736f6e6461766965732e636f6d2f776f7264636c6f75642f616d617a696e672e706e67.png\" alt=\"\" title=\"687474703a2f2f7777772e6a61736f6e6461766965732e636f6d2f776f7264636c6f75642f616d617a696e672e706e67\" width=\"960\" height=\"600\" class=\"alignnone size-full wp-image-1134\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/07\/687474703a2f2f7777772e6a61736f6e6461766965732e636f6d2f776f7264636c6f75642f616d617a696e672e706e67.png 960w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/07\/687474703a2f2f7777772e6a61736f6e6461766965732e636f6d2f776f7264636c6f75642f616d617a696e672e706e67-240x150.png 240w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/07\/687474703a2f2f7777772e6a61736f6e6461766965732e636f6d2f776f7264636c6f75642f616d617a696e672e706e67-768x480.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/p>\n<p>\u300c\u30bf\u30b0\u30af\u30e9\u30a6\u30c9\u300d\u3068\u3044\u3046\u547c\u3073\u540d\u306e\u65b9\u304c\u4e00\u822c\u7684\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u300cd3-clud\u300d\u306f\u30ef\u30fc\u30c9\u30af\u30e9\u30a6\u30c9\u3092\u751f\u6210\u3059\u308b\u3001d3.js\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.jasondavies.com\/wordcloud\/\">\u30c7\u30e2<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/jasondavies\/d3-cloud\">\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a><\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u4e2d\u306b\u542b\u307e\u308c\u3066\u3044\u308bsimple.html\u306e\u30bd\u30fc\u30b9\u3092\u898b\u308b\u306e\u304c\u65e9\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u3001\u753b\u9762\u3092\u66f4\u65b0\u3059\u308b\u305f\u3073\u5358\u8a9e\u304c\u91cd\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u81ea\u52d5\u7684\u306b\u8abf\u6574\u3055\u308c\u3066\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >!(function(){\r\n    d3.layout.cloud().size([300, 300])\r\n        .words([\r\n            \"Hello\", \"world\", \"normally\", \"you\", \"want\", \"more\", \"words\",\r\n            \"than\", \"this\"].map(function(d) {\r\n                return {text: d, size: 10 + Math.random() * 90}; \r\n            })\r\n        ) \/\/\u8868\u793a\u3059\u308b\u5358\u8a9e\u3092\u7d0d\u3081\u305f\u914d\u5217\u3092\u3001words\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5909\u63db\r\n        .rotate(function() { return ~~(Math.random() * 2) * 90; })\u3000\/\/\u8868\u793a\u3059\u308b\u6587\u5b57\u306e\u89d2\u5ea6\u3092\u6307\u5b9a\u3002\u3053\u3053\u3067\u306f\u3001\u30e9\u30f3\u30c0\u30e0\u3067\u30000\u2103\u3000or 90\u2103\r\n        .fontSize(function(d) { return d.size; })\r\n        .on(\"end\", draw)\r\n        .start();\r\n    \r\n   \/\/\u30ef\u30fc\u30c9\u63cf\u753b\r\n   function draw(words) {\r\n        d3.select(\"body\").append(\"svg\")\r\n            .attr(\"width\", 300)\r\n            .attr(\"height\", 300)\r\n            .append(\"g\")\r\n            .attr(\"transform\", \"translate(150,150)\")\r\n            .selectAll(\"text\")\r\n            .data(words) \/\/words\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6e21\u3055\u308c\u308b\r\n            .enter().append(\"text\")\r\n            .style(\"font-size\", function(d) { return d.size + \"px\"; })\r\n            .attr(\"text-anchor\", \"middle\")\r\n            .attr(\"transform\", function(d) {\r\n                return \"translate(\" + [d.x, d.y] + \")rotate(\" + d.rotate + \")\"; \/\/\u3053\u3053\u3067\u3001\u5b9f\u969b\u306e\u6587\u5b57\u306e\u89d2\u5ea6\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\r\n            })\r\n            .text(function(d) { return d.text; });\r\n   }    \r\n\r\n}());    <\/pre>\n<p>\u624b\u8efd\u3067\u898b\u6804\u3048\u3082\u3088\u304f\u3066\u3001\u3068\u3066\u3082\u4fbf\u5229\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u306a\u306e\u3067\u3059\u304cSVG\u3067\u51fa\u529b\u3055\u308c\u308b\u305f\u3081\u3001SVG\u306b\u5bfe\u5fdc\u3057\u3044\u306a\u3044\u30d6\u30e9\u30a6\u30b6\u3067\u306f\u51fa\u529b\u3055\u308c\u305f\u30ef\u30fc\u30c9\u30af\u30e9\u30a6\u30c9\u304c\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u4eca\u306e\u3068\u3053\u308d\u4f7f\u3044\u3069\u3053\u308d\u306f\u9650\u3089\u308c\u3066\u304f\u308b\u304b\u3082\u3002<\/p>\n<p>\u5099\u8003<br \/>\ntext\u30bf\u30b0\u306bwriting-mode=&#8221;tb&#8221;\uff08\u7e26\u66f8\u304d\uff09\u3092\u6307\u5b9a\u3059\u308b\u3068\u3046\u307e\u304f\u914d\u7f6e\u3055\u308c\u307e\u305b\u3093\u306d\u3002<\/p>\n<p><script type=\"text\/javascript\" src=\"http:\/\/jsdo.it\/blogparts\/AaOX\/js?width=465&#038;height=496&#038;view=screenshot\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u8ffd\u8a18\u3011 \u30d0\u30fc\u30b8\u30e7\u30f3\u4e0a\u304c\u3063\u3066\u52d5\u304b\u306a\u304f\u306a\u3063\u305f\u307f\u305f\u3044\u306a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1134,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1133","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\/1133","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=1133"}],"version-history":[{"count":8,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1133\/revisions"}],"predecessor-version":[{"id":1138,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1133\/revisions\/1138"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/1134"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=1133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=1133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=1133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}