Skip to content

Instantly share code, notes, and snippets.

Avatar

yuta_0 yuta-01

View GitHub Profile
@yuta-01
yuta-01 / d3.js
Last active Jan 27, 2016
pack layout(総出場時間)
View d3.js
var svgWidth = 800;
var svgHeight = 800;
var diameter = 800;
var svg = d3.select("#myGraph").append("svg")
.attr("width", svgWidth).attr("height", svgHeight);
var bubble = d3.layout.pack()
.size([diameter, diameter])
.padding(10);
@yuta-01
yuta-01 / d3.js
Last active Jan 27, 2016
treemap(通算出場時間)
View d3.js
var width = window.innerWidth;
var height = window.innerHeight;
var svg = d3.select("#myGraph").append("svg")
.attr("width", width)
.attr("height", height);
var colorSelect = function(d){
var color = '#fff';
switch(d){
@yuta-01
yuta-01 / 2015.json
Last active Jan 21, 2016
bar chart(2015 1st 観客動員数)
View 2015.json
[
{ "date" : "2015/03/14", "vs" : "清水", "scoa" : "△0-0", "att" : 19537, "referee" : "扇谷 健司" },
{ "date" : "2015/03/22", "vs" : "", "scoa" : "○3-2", "att" : 18193, "referee" : "井上 知大" },
{ "date" : "2015/04/18", "vs" : "神戸", "scoa" : "△2-2", "att" : 16068, "referee" : "吉田 寿光" },
{ "date" : "2015/04/29", "vs" : "F東京", "scoa" : "●0-1", "att" : 22318, "referee" : "木村 博之" },
{ "date" : "2015/05/06", "vs" : "山形", "scoa" : "△1-1", "att" : 25009, "referee" : "村上 伸次" },
{ "date" : "2015/05/16", "vs" : "仙台", "scoa" : "●0-3", "att" : 16764, "referee" : "佐藤 隆治" },
{ "date" : "2015/05/30", "vs" : "甲府", "scoa" : "●0-2", "att" : 23197, "referee" : "吉田 寿光" },
{ "date" : "2015/06/07", "vs" : "名古屋", "scoa" : "△1-1", "att" : 19030, "referee" : "東城 穣" }
]
@yuta-01
yuta-01 / d3.js
Last active Jan 19, 2016
heatmap(2004〜2015得点時間帯)
View d3.js
d3.csv("score.csv",function(errer,csv){
var max = Math.max.apply(null,csv.map(function(d){return d.s }));
var ScolorScale = d3.scale.linear().domain([0, max]).range(["#FFF5F2", "#FF4500"]); //カラースケールを作成
var year = d3.nest().key(function(d){return d.y;}).entries(csv); //CSVから取得したデータをネスト
var time = d3.nest().key(function(d){return d.t;}).entries(csv); //CSVから取得したデータをネスト
@yuta-01
yuta-01 / d3.js
Last active Jan 19, 2016
force(ベンゼンヘキサクロリド)
View d3.js
var list = {
nodes : [
{ name : "C" },
{ name : "C" },
{ name : "C" },
{ name : "C" },
{ name : "C" },
{ name : "C" },
{ name : "Cl" },
{ name : "Cl" },