LoginSignup
0
0

More than 3 years have passed since last update.

plunkerでd3 その6

Posted at

概要

plunkerでd3やってみた。
signateのcovid-19読んでみた。

写真

image

サンプルコード

var url = "https://docs.google.com/spreadsheets/d/16G_J5W-yOnn6RoMM_fdH84v6efPtuLt2HcmlXhe2wFM/export?gid=0&format=csv";

d3.csv(url, function(data) {
  var keys = data.columns;
  //alert(keys[0]);
  var table = d3.select("body").append("table").attr("border", "1")
  table.append("thead").append("tr").selectAll("th").data(keys).enter().append("th").text(function(d) {
    return d;
  });
  for (var i = 0; i < data.length; i++)
  {
    if (data[i]["受診都道府県"] == "山形県")
    {
      var rows = [];  
      keys.map(function(c) {
        rows.push(data[i][c])
      });
      table.append("tbody").append("tr").selectAll("td").data(rows).enter().append("td").text(function(d) {
        return d;
      });
    }
  }  
});

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0