{"id":1599,"date":"2012-11-02T10:57:49","date_gmt":"2012-11-02T01:57:49","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=1599"},"modified":"2017-09-21T19:38:18","modified_gmt":"2017-09-21T10:38:18","slug":"post-1599","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/d3v4\/1599","title":{"rendered":"\u3010D3.js\u3011Google\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u5165\u529b\u3057\u305f\u30c7\u30fc\u30bf\u3092\u53ef\u8996\u5316\u3059\u308b"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>Google Visualization API\u306b\u306f\u3001Google\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u7c21\u6613DB\u3068\u3057\u3066\u5916\u90e8\u304b\u3089\u547c\u3073\u51fa\u3057\u3066\u4f7f\u3046\u3053\u3068\u306e\u3067\u304d\u308b\u6a5f\u80fd\u304c\u5099\u308f\u3063\u3066\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/developers.google.com\/chart\/interactive\/docs\/reference?hl=ja\">Google Visualization API Reference<\/a><\/p>\n<p>\u53c2\u8003<br \/>\n<a href=\"http:\/\/webos-goodies.jp\/archives\/51311993.html\">Google Visualization API \u8a73\u7d30\u3001\u304a\u3088\u3073 Gadgets-in-Docs \u306e\u4f5c\u308a\u65b9<\/a><\/p>\n<p>\u3053\u306eAPI\u3092\u4f7f\u3063\u3066Google\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u30c7\u30fc\u30bf\u3092D3.js\u3067\u53ef\u8996\u5316\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><a href=\"http:\/\/bl.ocks.org\/shimizu\/733513c348f2a4bd6c8aef749ab8b556\/c163c98a8c2db145db26510f40aabe6dac62f584\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/11\/D3v4_with_data_from-GoogleSheets.png\" alt=\"D3v4_with_data_from\" width=\"590\" height=\"262\" class=\"aligncenter size-full wp-image-5480 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/11\/D3v4_with_data_from-GoogleSheets.png 590w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2012\/11\/D3v4_with_data_from-GoogleSheets-300x133.png 300w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/bl.ocks.org\/shimizu\/733513c348f2a4bd6c8aef749ab8b556\/c163c98a8c2db145db26510f40aabe6dac62f584\">example<\/a><\/p>\n<h2>\u30dd\u30a4\u30f3\u30c8<\/h2>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u304b\u3089\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u51fa\u3057\u3066\u3044\u308b\u90e8\u5206\u306f\u4ee5\u4e0b\u3002<\/p>\n<pre class=\"lang:js decode:true \" >\r\ngoogle.load(\"visualization\", \"1\");\r\ngoogle.setOnLoadCallback(init);\r\n\r\nfunction init() {\r\n\tvar query = new google.visualization.Query(\"https:\/\/docs.google.com\/spreadsheet\/ccc?key=0ArOQLX5U1kUqdFYxUzcwTDB0UUVnZHBKRnRzbUc3aGc\");\r\n\tquery.setQuery(\"select *  where B &amp;gt; 3000000  \"); \/\/SQL\u306b\u4f3c\u305f\u69cb\u6587\u3067\u30d5\u30a3\u30eb\u30bf\u3092\u304b\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\r\n\tquery.send(handleQueryResponse);\r\n}\r\n\r\nfunction handleQueryResponse(response) {\r\n\t\/\/ \u30c7\u30fc\u30bf\u53d6\u5f97\r\n\tvar data = response.getDataTable();\r\n\t\r\n\t\/\/DataTable\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4e8c\u6b21\u5143\u306b\u5909\u63db\r\n\tvar DataArray = new Array(data.getNumberOfRows());\r\n\tfor (var row = 0; row &amp;lt; data.getNumberOfRows(); row++) {\r\n\t\t DataArray[row] = new Array(data.getNumberOfColumns());\r\n\t\tfor (var col = 0, n = data.getNumberOfColumns(); col &amp;lt; n; col++) {\r\n\t\t\tif(col &amp;gt; 0){\r\n\t\t\t\tDataArray[row][col] = Math.floor(data.getFormattedValue(row, col) \/ 10000); \/\/\u4e07\u4eba\u5358\u4f4d\u306b\u5909\u63db\r\n\t\t\t}else{\r\n\t\t\t\tDataArray[row][col] = data.getFormattedValue(row, col);\r\n\t\t\t}\r\n\t\t}    \r\n\t}\r\n\t\r\n\t\/\/\u5909\u63db\u3057\u305f\u914d\u5217\u3092D3.js\u306b\u6e21\u3059\r\n\trendering(DataArray);\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Google Visualization A&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1605,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[],"class_list":["post-1599","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\/1599","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=1599"}],"version-history":[{"count":9,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1599\/revisions"}],"predecessor-version":[{"id":5479,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/1599\/revisions\/5479"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/1605"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}